A matrix. This may be used to represent a tensor. While the syntactic representation of a tensor is that of nested arrays, the elements of the tensor are stored in a flattened manner. Presumambly, this makes things easier in the case when a Tensor is used as a square matrix.

Type Parameters

  • T extends U = U

Hierarchy (view full)

Constructors

Properties

end?: number
name: string
pos?: number
type: "tensor" = "tensor"

Accessors

Methods

  • Returns the size of the specified dimension. This is the number of elements at the specified level of nesting.

    Parameters

    • n: number

      The zero-based index of the dimension.

    Returns number

  • Applies the predicate to every element of this tensor.

    Parameters

    • predicate: ((element) => boolean)

      The predicate applied.

        • (element): boolean
        • Parameters

          • element: T

          Returns boolean

    Returns boolean

    true if every element satisfies the predicate.

  • Parameters

    • callbackfn: ((value, index, array) => boolean)
        • (value, index, array): boolean
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns boolean

    Returns U[]

  • Parameters

    • callbackfn: ((value, index, array) => boolean)
        • (value, index, array): boolean
        • Parameters

          • value: T
          • index: number
          • array: T[]

          Returns boolean

    Returns boolean

  • Returns a new tensor with the same dimensions as this, but with different elements. This element avoids the copy of the dims array.

    Type Parameters

    • X extends U

    Parameters

    • elems: X[]

    Returns Tensor<X>