Skip to content

Commit

Permalink
no inflate size-1 dims on [phys]
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 24, 2024
1 parent b7931db commit db71519
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Basic/Core/pdlbroadcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ pdl_error pdl_dim_checks(
/* Dimensional promotion when number of dims is less than required: */
ind_sz = ind_sizes[ind_id] = 1;
if (load_only && creating[i]) continue;
if (ind_sz == -1 || (j < ndims && ind_sz == 1)) {
if (ind_sz == -1 || (!(flags & PDL_PARAM_ISPHYS) && j < ndims && ind_sz == 1)) {
ind_sizes[ind_id] = dims[j];
continue;
}
Expand Down
1 change: 1 addition & 0 deletions t/core.t
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ subtest 'dim compatibility' => sub {
[\&polyroots, [ones(2), zeroes(2), zeroes(1), zeroes(1)], 2, [-1], '[phys] output=[1]'],
[\&polyroots, [ones(2), zeroes(1), zeroes(), zeroes(1)], 2, qr/dim has size 1/, '[phys] output=[2] mismatch'],
[\&polyroots, [ones(2), zeroes(1), zeroes(1), zeroes(1)], 2, qr/dim has size 1/, '[phys] output=[2] mismatch'],
[\&polyroots, [ones(2), zeroes(2), zeroes(2), zeroes(2)], 2, qr/dim has size 2/, '[phys] output=[2] mismatch'],
[\&polyroots, [ones(2), zeroes(2), zeroes(1,2), zeroes(1)], 2, qr/implicit dim/, '[phys] one outputs=[1,2],[1] no promote output implicit dims'],
[\&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), zeroes(1,2)], 2, qr/implicit dim/, '[phys] output=[1,2] not ok broadcast over output implicit dim'],
Expand Down

0 comments on commit db71519

Please sign in to comment.