The problem is with using PDL::Matrix and PDL::Transform together. >From 'help PDL::Matrix' in the section BUGS AND PROBLEMS: > > Because we change the way piddles are constructed, not all pdl operators > may be applied to piddle-matrices. The inner product is not redefined. > We might have missed some functions/methods. Internal consistency of our > approach needs yet to be established. > > Because PDL::Matrix changes the way slicing behaves, it breaks many > operators, notably those in MatrixOps.
I'm don't work with PDL::Matrix so I would not know how to work around the problem or if it is possible to do so. The example works if you don't use PDL::Matrix and replace the mzeroes() call by zeroes(). --Chris On Mon, Aug 15, 2011 at 11:03 AM, Ben <[email protected]> wrote: > Hi, > > I am trying to use t-linear to transform a "collection" of points. What would > be > the right way of doing that? As an example, let's say I want to stretch all > coordinates in $a by a factor of 3: > > > #!/usr/bin/perl > > use PDL; > use PDL::Matrix; > use PDL::Transform; > > $a = mzeroes(2,1, 10); > for ($i = 0; $i < 10; $i++) { > $a->set(0,0,$i,$i); > $a->set(1,0,$i,$i); > } > print $a; > > $f = t_linear(s=>3); > $d= $a->apply($f); > > print $d; > > This code doesn't work, gives an error > PDL: Dim mismatch in matmult of [2x2] x [2x1]: 2 != 1 > > (Why?) > > However, if I were to change the line $a = mzeroes(2,1, 10); to $a = > mzeroes(2,2, 10); it gives me an answer, but I've just added unnecessary > entries > to my collection of points. You'll also need to ensure that the answer is correct. A scale by 3 operation could have indices backwards and still give the same results. _______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
