Hi,

I know there has to be a better, more succinct way of doing this, but I 
just don't seem to get it, not having done any explicit threading:

$allims is a stack of n images of size (xsize,ysize) from which I need to 
pull out vectors that have the same pixel for each image in the stack and 
do some matrix operations on it. The loops clearly slow it down. How do I 
get rid of the loops? ($invcovari is a nxn matrix).

my $out= ones($xsize, $ysize);
for my $j (0..$xsize-1){
         for my $k (0..$ysize-1){
                 my $vecf = (slice $allims,"*,$j,$k")->flat->cat;
                 my $vecft = $vecf->transpose;
                (slice $out,"$j,$k") .= $vecf x ($invcovari x $vecft);
         }
}

Thanks.

-ashish

Ashish Mahabal, Caltech Astronomy, Pasadena, CA 91125
http://www.astro.caltech.edu/~aam aam at astro.caltech.edu

Why is "abbreviation" such a long word?

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to