Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Meditations on the Nature of Code Exams

by jeroenes (Priest)
on Mar 21, 2001 at 18:06 UTC ( #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
Node Status?
node history
Node Type: note [id://66022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-09-24 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (246 votes), past polls