Class Matrix

A Matrix class that uses sparse matrix representation under the hood.

Hierarchy

  • Matrix

Constructors

Properties

Accessors

Methods

Constructors

Properties

Accessors

  • get col(): number
  • Get the number of column

    Returns number

  • get row(): number
  • Get the number of row

    Returns number

  • get size(): number
  • Get the number of non-empty elements

    Returns number

Methods

  • Parameters

    • row: number
    • col: number

    Returns [boolean, number]

  • Get the element value of this matrix

    Parameters

    • row: number
    • col: number

    Returns number

  • Apply a map function to each non-zero element of this matrix

    Parameters

    • func: ((value: number, row: number, col: number) => number)
        • (value: number, row: number, col: number): number
        • Parameters

          • value: number
          • row: number
          • col: number

          Returns number

    Returns Matrix

  • Set the element value of this matrix

    Parameters

    • row: number
    • col: number
    • value: number

    Returns Matrix

  • Get this matrix in 2D array form

    Returns number[][]

  • Create an empty matrix with given shape

    Parameters

    • row: number
    • col: number

    Returns Matrix

Generated using TypeDoc