Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whereND drops all dimensions when mask is all zeroes #428

Closed
falsifian opened this issue Apr 23, 2023 · 1 comment
Closed

whereND drops all dimensions when mask is all zeroes #428

falsifian opened this issue Apr 23, 2023 · 1 comment

Comments

@falsifian
Copy link
Contributor

One of these is not like the others:

pdl> p zeroes( 2, 3, 1 )->whereND( pdl '1 1' )->shape
[2 3 1]
pdl> p zeroes( 2, 3, 1 )->whereND( pdl '1 0' )->shape
[1 3 1]
pdl> p zeroes( 2, 3, 1 )->whereND( pdl '0 1' )->shape
[1 3 1]
pdl> p zeroes( 2, 3, 1 )->whereND( pdl '0 0' )->shape
[0]

I would expect the last output to be [0 3 1].

@falsifian
Copy link
Contributor Author

falsifian commented Apr 23, 2023

This is PDL 2.081 on OpenBSD current on amd64.

Here's another behaviour that seems like a bug:

pdl> p zeroes( 2, 1 )->whereND( pdl '1 1' )

[
 [0 0]
]

pdl> p zeroes( 2, 0 )->whereND( pdl '1 1' )
Stringizing problem: Error in splitdim:nsp 2 cannot be greater than dim 0.     eval {...} called at /home/falsifian/perl5/lib/perl5/amd64-openbsd/PDL/Core.pm line 2849
        PDL::string(PDL=SCALAR(0x15b28c54b20), undef, "") called at /home/falsifian/perl5/bin/perldl line 409
        main::p(PDL=SCALAR(0x15b28c54b20)) called at (eval 343) line 4
        main::__ANON__() called at /home/falsifian/perl5/bin/perldl line 682
        eval {...} called at /home/falsifian/perl5/bin/perldl line 682
        main::eval_and_report("p zeroes( 2, 0 )->whereND( pdl '1 1' )\x{a}") called at /home/falsifian/perl5/bin/perldl line 618
        main::process_input() called at /home/falsifian/perl5/bin/perldl line 638
        eval {...} called at /home/falsifian/perl5/bin/perldl line 638
 at /home/falsifian/perl5/lib/perl5/amd64-openbsd/PDL/Core.pm line 2880, <STDIN> line 50.
        PDL::string(PDL=SCALAR(0x15b28c54b20), undef, "") called at /home/falsifian/perl5/bin/perldl line 409
        main::p(PDL=SCALAR(0x15b28c54b20)) called at (eval 343) line 4
        main::__ANON__() called at /home/falsifian/perl5/bin/perldl line 682
        eval {...} called at /home/falsifian/perl5/bin/perldl line 682
        main::eval_and_report("p zeroes( 2, 0 )->whereND( pdl '1 1' )\x{a}") called at /home/falsifian/perl5/bin/perldl line 618
        main::process_input() called at /home/falsifian/perl5/bin/perldl line 638
        eval {...} called at /home/falsifian/perl5/bin/perldl line 638

I would expect the second output to be an empty ndarray with shape [0 0] EDIT: [2 0].

mohawk2 pushed a commit to falsifian/pdl that referenced this issue Apr 26, 2023
mohawk2 pushed a commit that referenced this issue Apr 26, 2023
mohawk2 pushed a commit to falsifian/pdl that referenced this issue Apr 26, 2023
mohawk2 pushed a commit to falsifian/pdl that referenced this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant