Re: [Pdl-general] Check for all element eq 0

2023-12-22 Thread David Mertens
Hello Yury, I offer the following clarification, hopefully: all($stuff == 0) # checks if every element in $stuff is zero all($stuff == 5) # checks if every element in $stuff is 5 all($stuff) # checks if every element in $stuff is boolean true all($stuff) == 0 # checks if it is not the

Re: [Pdl-general] Check for all element eq 0

2023-12-22 Thread Ingo Schmid via pdl-general
Hi I think it works as expected. What you are testing is if all ($a) is 0, which is true, since one element in $a is 0. You have to be careful with brackets. pdl> print all($a)==0;  # all returns 0 since the last value in $a == 0. 1 pdl> print all($a==0); # all returns 0 because only one $a