PDLPorters / pdl-linearalgebra

https://p3rl.org/PDL::LinearAlgebra
1 stars 7 forks source link

Slice has too many dims in call to mtoeplitz on 0.27 and higher #16

Closed jjatria closed 2 years ago

jjatria commented 2 years ago

The release of 0.27 last April seems to have caused some calls to mtoeplitz to start failing with a slice has too many dims error message, as seen below:

$ perl -MPDL::LinearAlgebra -E 'say $PDL::LinearAlgebra::VERSION'
0.27
$ perl -Ilib -MPDL -MPDL::LinearAlgebra::Special -e 'print PDL::LinearAlgebra::Special::mtoeplitz(pdl [0, 1])'
Error in slice:slice has too many dims (indexes dim 1; highest is 0) at ops.pd line 646.
        PDL::__ANON__(PDL=SCALAR(0x5568efaa5050), PDL=SCALAR(0x5568efa43f60), undef) called at .../PDL/LinearAlgebra/Special.pm line 225
        PDL::mtoeplitz(PDL=SCALAR(0x5568efaa4e70)) called at -e line 1

but

$ perl -MPDL::LinearAlgebra -E 'say $PDL::LinearAlgebra::VERSION'
0.26
$ perl -Ilib -MPDL -MPDL::LinearAlgebra::Special -e 'print PDL::LinearAlgebra::Special::mtoeplitz(pdl [0, 1])'

[
 [0 1]
 [1 0]
]

This seems to be down to https://github.com/PDLPorters/pdl-linearalgebra/commit/62d5760c3e51acad7c49512d642150cbfa8db3b5, although I haven't figure out what about it is causing the problem.

This has broken recent tests for PDL::DSP::Windows, but I imagine that this is an issue with PDL::LinearAlgebra, since a call that used to work no longer does. Here's an example of a recent failure.

mohawk2 commented 2 years ago

Thanks! Fixed, released as 0.33.

mohawk2 commented 2 years ago

(The problem was my converting to the $slice_prefix scheme to accommodate PDL::Complex had a mistake in omitting ().)