It's a universal issue with computer languages.   Do you want matrices to 
operate as they appear on screen, or to operate as they are indexed?  Since 
most languages, including PDL, index as (x, y), i.e. (column, row) on screen, 
you have to choose one or the other.  Linear algebra textbooks always use (row, 
column) indexing, i.e. (y, x).  If, as a language designer, you choose your 
operators to use the same indexing scheme then "print $a" (or equivalent) will 
generally render the transpose of the matrix.

PDL's matrix operator was written by folks with a more visual bent, so PDL made 
the choice to render its matrices as they would appear if written out.  Thus: 
'printf(" %s x\n %s =\n %s", $a, $b, $a x $b)' will print something sensical.  
The cost is that you index the locations in the matrix in (x,y) order -- i.e. 
the opposite way a mathematical screed would.

This is a wart in the underlying mathematical convention -- it is analogous to 
the wart, in physics, that the main charge carrier (the electron) is negatively 
charged.  It doesn't make sense, but it's far too late to regularize it now.


> On Jan 4, 2015, at 10:50 PM, mraptor <[email protected]> wrote:
> 
> hi,
> 
> PDL seems to use col x rows convention, but Matrix math is the opposite.
> Is there a way to switch this with some flag or something ... it is
> very confusing ?
> Or do you have some other trick to handle this ...
> Perl arrays also use rows x cols convention.
> 
> thanks
> 
> 
> -------| http://ifni.co
> 
> _______________________________________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
> 


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

Reply via email to