Skip to content

← array package

MatrixTrace

Calculate the trace (sum of diagonal elements) of a matrix or stack of matrices (where the last two dimensions are the matrix dimensions).

More Info... Version 1.0.0

Ports/Properties

array

Matrix (stack) to process.

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

offset

Offset relative to main diagonal. If positive, then a diagonal above the main diagonal is used, and if negative, a diagonal below the main diagonal is used.

verbose name
Off-Diagonal Offset
default value
0
port type
IntPort
value type
int (can be None)

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)

lists_as_arrays

Whether to treat lists as numeric arrays, as opposed to a recursive data structure. This is equivalent to converting any list operand(s) to arrays before passing them to the node. Broadly, enabling this allows for more efficient processing of lists of arrays as operands, with some limitations and caveats, as follows. If one operand was a list and the other an array, an array will be returned, and if all were lists, a list will be returned (if the operand lists themselves contained arrays, the result is still a "pure" list of potentially nested lists of numbers). A limitation is that input lists may contain ONLY numbers or arrays of the same shape. In contrast, when the option is disabled, then if one operand is a list and the other is not a list (e.g., a number, array, etc), then each element of the list is separately undergoing the operation while the other operand is held fixed. This has the consequence that a) the result will generally be a list if at least one operand is a list and b) the result will be mathematically different when one is a list and the other is an array, because the array will be separately combined with each list element. Note the default for this option was enabled by default in NeuroPype 2023. The option can also be set globally or in a context using the WithOptions node, for example for pipeline-wide backwards compatibility.

verbose name
Lists As Arrays
default value
False
port type
BoolPort
value type
bool (can be None)