Using PDL::Complex is very convenient, but one should be wary in that it produces some unexpected surprises. For example:
pdl> $a=sequence(3)+i*2*sequence(3) pdl> p $a #three complex numbers [0 +0i 1 +2i 2 +4i] pdl> p $a->sumover #complex sums over index 1, not 0 3 +6i pdl> p $a->prodover #real product over index 0, not 1 [0 2 8] pdl> p $a->prodover->info PDL::Complex: Double D [3] #Complex number with three components! sumover yields an expected result, i.e., the complex sum of three numbers, but prodover sums over index 0, i.e., multiplies real times imaginary parts, yielding three real numbers, which are nevertheless interpreted as a complex number! (Somehow, I expected sumover to behave as prodover, and I was wrongly shuffling dimensions before the reduction). I understand pdl3 will address these issues, but meanwhile, are these kind of behaviors documented? I'm using PDL v2.007, perlDL shell v1.357, perl 5.18.1. Best regards, Luis _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
