Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Meditations on the Nature of Code Exams

by jeroenes (Priest)
on Mar 21, 2001 at 18:06 UTC ( [id://66022]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    Matlab:
        load data.txt
        a=data;
    Perl:
        $a = supersplit_open( 'data.txt' ); #Without supersplit, it's more
    + code
    
  2. or download this
    Matlab:
        sum(a')
    Perl:
        $sum = map{ my $c = 0; map{ $c += $_; }@$_; $c; } @$a;
    
  3. or download this
    Matlab:
        sum(a)
    ...
        my $last = $#{$a->[0]};
        $sum = [ map {0} 0..$last ];
        map{ $sum->[$i] += $_->[$i] for my $i (0..$last) } @$a;
    
  4. or download this
    large=find( a(:,1) > 1E10 );
    large_ok = find( a(:,1) > 1E10 & a(:,3) > 0 );
    sum( a(large,:) )
    mean( a(large_ok,:) )
    
  5. or download this
    SELECT mean(a1), mean(a2), mean(a3), mean(a4), mean(a5)
     FROM a
     WHERE a1 > 1.0E10 and a3 > 0;
    
  6. or download this
    Matlab:
        for i=1:length(b)
    ...
    Perl:
        my $localsum = 0;
        $s = [ map{ $localsum += $_ } @$b ];
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://66022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-03-29 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found