Skip to content

Package: tensor_math

Tensor math operations.

These nodes implement mathematical operations that can be applied to any kind of data tensor (n-way array). These nodes make no domain-specific assumptions (unlike, e.g., signal processing nodes in the filters module), and therefore it is usually necessary to choose the axis along which they should act. Most of these operations will work on packets, chunks, blocks, arrays, and lists (of lists) and return their output in the same format as the input. The package includes some key operations such as selecting, sorting, and reversing along an axis, reordering axes, retyping (overriding) axes, or dropping singleton axes. Also the unit of measurement, if applicable, will usually be by default the most generic unit (such as indices on an array), and for certain axes you may need to set it to a domain-specific value to be useful (e.g., Hz for the frequency axis).

Nodes in this package:

  • Add Axis Array
    Create (add) a new array (field) to an existing axis.

  • Append/Insert Axis
    Append a new one-element axis to the incoming packet.

  • Concatenate Data
    Concatenate the given data (packets, chunks, blocks, arrays or lists) along a new or existing axis.

  • Finite Differences
    Calculate the discrete n'th derivative of the given data along a chosen axis using finite differences.

  • Finite Differences Central
    Calculate the discrete n'th derivative of the given data along a chosen axis using central finite differences.

  • Fold Into Axis
    Fold an axis into another axis.

  • Log Spacing
    Keep elements along an axis with logarithmic spacing.

  • Move Axis First
    Move the given axis to the beginning of the list of axes.

  • Operate Along Axis
    Perform an operation (subtract, add, multiply, divide) on the data values between pairs of elements in an axis (instance, feature, space), and expand the data tensor along that axis to add the result.

  • Override Axis
    Override a specific axis in the data by a new axis.

  • Random Subset
    Select a random subset of instances in the given data.

  • Reorder Axes
    Reorder the axes in the given data.

  • Reverse
    Reorder the elements along an axis, and the corresponding data slices, so they are in reverse order.

  • Select Range
    Select a subset (slice) of the data along any axis, such as space (channels), time (seconds), frequency (Hz), instance (segments or trials), feature (names), etc.

  • Separate Axis Elements
    Separate the given axis elements into new axis elements.

  • Set Axis Values
    Set values for the fields of an axis.

  • Sort
    Sort the data along an axis, either by the data values themselves (default), or by an index field of the chosen axis (e.g

  • Squeeze Axes
    Strip all axes whose length is 1.

  • Strip Singleton Axis
    Strip the given singleton axis from the data.

  • Tensor Product (Contraction)
    Apply a tensor product / contraction between two arrays.

  • Unique Values or Slices
    Reduce data to its unique values along an axis.

  • Select Upper Triangular
    Extract the upper triangular part of a symmetric matrix.

  • Cross Product (Vector)
    Compute the cross product of two (sets of) 3d vectors represented by the given axis in the data.

  • Dot Product (Vector)
    Compute the dot product (inner product) of two (sets of) vectors represented by the given axis in the data.

  • Norm (Vector)
    Compute a norm of the vectors represented by the given axis.