ArrayTools
AllNonZero
true when the Array has no zero entries
HasZero
true when the Array has a zero entry
HasNonZero
true when the Array has a nonzero entry
IsZero
true when the Array has only zero entries
AnyNonZeros
collapse nonzero lines to 1, zero lines to 0
Calling Sequence
Parameters
Description
Examples
AllNonZero(A)
HasNonZero(A)
HasZero(A)
IsZero(A)
AnyNonZeros(A,dim)
A
-
Matrix, Vector, or Array
dim
optional; integer dimension
These commands check for the presence of zero or nonzero entries in an Array.
The HasNonZero command returns true when a single element of the Array is nonzero.
The HasZero command returns true when a single element of the Array is zero.
The IsZero command returns true when every element of the array is zero.
The AnyNonZeros command returns 0, 1, or an Array. The first non-singleton dimension, or the dimension specified is replaced with constant zeros or ones depending on the presence of nonzero values.
These commands are part of the ArrayTools package, so they can be used in the short form AllNonZero(..), HasZero(..), HasNonZero(..), IsZero(..), or AnyNonZeros(..) only after executing the command with(ArrayTools). However, they can always be accessed through the long form of the command by using ArrayTools[AllNonZero](..), ArrayTools[HasZero](..), ArrayTools[HasNonZero](..), ArrayTools[IsZero](..), or ArrayTools[AnyNonZeros](..), respectively.
with⁡ArrayTools:
AllNonZero⁡Array⁡a,b,c,0,e,f
false
IsZero⁡Array⁡0,0,0,0
true
AnyNonZeros⁡Array⁡0,b,0,0,e,f
011
See Also
Download Help Document