Class Packer

Class which can pack multiple values which may have multiple dimensions into a one-dimensional array of values, and unpack them again.

Constructors

Accessors

  • get length(): number

    Returns the total number of values which will be held in a one-dimensional array after packing by this Packer.

    Returns number

  • get nVariables(): number

    Returns the number of variables in the shape used to initialise this Packer.

    Returns number

Methods

  • Calculates the length of array required to contain the first n variables from the start of the shape this Packer was initialised with.

    Parameters

    • firstVariablePosition: number

      Index of start variable (inclusive)

    • lastVariablePosition: number

      Index of final variable (inclusive)

    Returns number

  • Unpacks a one-dimensional array to the shapes defined by this Packer.

    Parameters

    • x: number[]

      A standard number array

    Returns UnpackResult

  • Unpacks an NdArray to the shapes defined by this Packer. We require the first dimension in the NdArray to equal length. Any additional dimensions are added to the configured shapes for each unpacked value.

    Parameters

    • x: NdArray

      NdArray of numbers

    Returns UnpackResult