Hello all!

I faced with error using simple 3D rotation:
_______________________
use PDL;
use PDL::Transform;

$in=pdl[1,1,1];
$f = t_rot([0,90,0]);
$out= $in->apply($f);
print $out;
_______________________
Dim mismatch in matmult of [2x2] x [3x3]: 2 != 3 at 
/usr/local/lib64/perl5/PDL/Primitive.pm line 265.

Why? I use only 3D vectors. Where appeared a 2D vector?

I scan the code Transform.pm and found this place in function t_linear 
which link with t_rot.

Row 1904 defines dimensions:
$me->{idim} = $me->{odim} = 3 if($me->{params}->{rot}->nelem == 3);
It works.

But then in row 1924 there is a last condition "else", and in row 1926:
$me->{idim} = $me->{odim} = 2;
That redefine early defined values of dimensions.

This happens due to avoid variable $o_dims (row 1922).  Indeed, if I write
$f = t_rot([0,90,0],dim=>3);
or
$f = t_linear(rot=>[0,90,0],dim=>3);
the code is executed fine.

If after row 1905 we insert  $o_dims=$me->{idim} then the problem will 
be fixed.

Good luck
Yury


------------------------------------------------------------------------------
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to