Skip to content

Commit

Permalink
capture working dim-compatibility for (n,n), mark simq param as [io]
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 20, 2024
1 parent c19980c commit c090d9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Basic/MatrixOps/matrixops.pd
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,8 @@ EOD
# XXX Destroys a!!!
# To use the new a again, must store both a and ips.
pp_def("simq",
HandleBad => 0,
Pars => '[phys]a(n,n); [phys]b(n); [o,phys]x(n); int [o,phys]ips(n)',
HandleBad => 0,
Pars => '[io,phys]a(n,n); [phys]b(n); [o,phys]x(n); int [o,phys]ips(n)',
OtherPars => 'int flag;',
GenericTypes => ['D'],
Code => '
Expand Down
4 changes: 4 additions & 0 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use Test::More;
use Test::Exception;
use PDL::LiteF;
use PDL::Math; # for polyroots with [phys] params, for dim compat tests
use PDL::MatrixOps; # for simq with [phys] params, for dim compat tests
use Config;
use PDL::Types;
use Math::Complex ();
Expand Down Expand Up @@ -166,6 +167,9 @@ subtest 'dim compatibility' => sub {
[\&polyroots, [ones(2), zeroes(2), zeroes(1), zeroes(1)], 2, [-1], '[phys] output=[1]'],
[\&polyroots, [ones(2), zeroes(2,2), zeroes(1,2), zeroes(1,2)], 2, [[-1],[-1]], '[phys] output=[1,2] ok broadcast over input'],
[\&polyroots, [ones(2), zeroes(2,2), zeroes(1,1), zeroes(1,2)], 2, qr/implicit dim/, '[phys] outputs=[1,1],[1,2] not ok broadcast over output explicit dim'],
# phys params with (n,n)
[\&simq, [identity(3)+1, sequence(3,1), null, null, 0], 2, [[-0.75,0.25,1.25]], '[phys] output=[3,3]'],
[\&simq, [[[2,1,1]], sequence(3,1), null, null, 0], 2, qr/dim has size/, '[phys] input=[3,1] output=[3,3] no expand input phys multi-used dim of 1'],
) {
my ($func, $args, $exp_index, $exp, $label) = @$_;
if (ref $exp eq 'Regexp') {
Expand Down

0 comments on commit c090d9a

Please sign in to comment.