ArrayTools - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Low-level Manipulation : Matrices, Vectors, and Arrays : ArrayTools : ArrayTools/AllNonZero

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 AllNonZero(A) HasNonZero(A) HasZero(A) IsZero(A) AnyNonZeros(A,dim)

Parameters

 A - Matrix, Vector, or Array dim - optional; integer dimension

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{ArrayTools}\right):$
 > $\mathrm{AllNonZero}\left(\mathrm{Array}\left(\left[\left[a,b,c\right],\left[0,e,f\right]\right]\right)\right)$
 ${\mathrm{false}}$ (1)
 > $\mathrm{IsZero}\left(\mathrm{Array}\left(\left[0,0,0,0\right]\right)\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{AnyNonZeros}\left(\mathrm{Array}\left(\left[\left[0,b,0\right],\left[0,e,f\right]\right]\right)\right)$
 $\left[\begin{array}{rrr}{0}& {1}& {1}\end{array}\right]$ (3)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam