Hi Craig,

please look at the docs, it explicitly says so that it won't calculate the inverse if the matrix isn't square.

"    m, matrix, Matrix
       The transformation matrix. It does not even have to be square, if you
       want to change the dimensionality of your input. If it is invertible
       (note: must be square for that), then you automagically get an
       inverse transform too.
"

I guess the real issue here is that trying to decompose the non-square matrix leads to an error instead of an undefined inverse - in MatrixOps?

Ingo


On 25.09.25 5:37 PM, DeForest, Craig E. wrote:
I think the concern is that Transform::Linear is trying to produce an inverse matrix, which of course doesn’t exist.  Using a pseudoinverse, projecting to a 2-D plane, is probably the right answer in this context.

On Sep 25, 2025, at 8:31 AM, Ingo Schmid via pdl-general <[email protected]> wrote:

[EXTERNAL EMAIL]

Hi,

I need coordinate transformations from pixel space to real 3D space. PDL::Transform is great for this kind of operations. I've got the two vectors (and hence a 2x3) matrix, let's call it $tm, of the x and y axes.

Unfortunately, t_linear(m=>$tm) complains that the matrix is not square. The docs explicitly say that this should work.

Tested on 2.079 and 2.100.

pdl> $tm=ones(3,2); # That would also scale

pdl> t_linear(matrix=>$tm);
Runtime error: lu_decomp requires a square (2D) PDL
 at matrixops.pd line 897.
PDL::MatrixOps::lu_decomp(PDL=SCALAR(0x55929b90eb70)) called at matrixops.pd line 337     PDL::MatrixOps::det(PDL=SCALAR(0x55929b90eb70), HASH(0x55929b910d88)) called at transform.pd line 2769 PDL::Transform::Linear::new("PDL::Transform::Linear", "matrix", PDL=SCALAR(0x55929ba84d30)) called at transform.pd line 2639     PDL::Transform::t_linear("matrix", PDL=SCALAR(0x55929ba84d30)) called at (eval 472) line

It would be great to restore that feature.

Ingo


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

Reply via email to