Skip to content

← array package

ArrayNonzeros

Get the indices or optionally n-dimensional index coordinates of the non-zero entries in an array.

By default, this returns a single vector of indices in the flattened array as the first (coord0) output. If flat is disabled, and if the array is n-dimensional (i.e. is a tensor), then for each non-zero entry in the tensor, its n index coordinates are appended to the n coordN output arrays. Thus each coord array is a vector with the same number of elements, which is the total number of non-zeros. Any coordN arrays for N > than the array dimension are None. The nonzeros are generally emitted (scanned out) in row-major a.k.a. C memory order (both in flat and non-flat mode). This only makes a difference if the array is multi-dimensional. In this case, the C / row-major order order means that array elements are scanned in such a way that the last dimension is the fastest varying (i.e., adjacent entries along the last dimension are adjacent in the scan order and a whole row of the last dimension is scanned before the next row is scanned). Thus the next set of entries in the scan order corresponds to the next index in the second-to-last dimension. More Info... Version 1.0.0

Ports/Properties

array

Array to process.

verbose name
Array
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
IN

coord1

Coordinate 1 of non-zero entries.

verbose name
Coord1
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord2

Coordinate 2 of non-zero entries.

verbose name
Coord2
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord3

Coordinate 3 of non-zero entries.

verbose name
Coord3
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord4

Coordinate 4 of non-zero entries.

verbose name
Coord4
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord5

Coordinate 5 of non-zero entries.

verbose name
Coord5
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord6

Coordinate 6 of non-zero entries.

verbose name
Coord6
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord7

Coordinate 7 of non-zero entries.

verbose name
Coord7
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord8

Coordinate 8 of non-zero entries.

verbose name
Coord8
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

coord9

Coordinate 9 of non-zero entries.

verbose name
Coord9
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

flat

If set, coord0 holds the indices of the non-zero entries in the flattened array. If False, for each non-zero in the original n-dimensional array, its n coordinate indices are emitted into the corresponding coordN ports.

verbose name
Flat
default value
True
port type
BoolPort
value type
bool (can be None)

coord0

Coordinate 0 of non-zero entries - UNUSED.

verbose name
Coord0
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)