Class Mat

Hierarchy

  • Mat

Constructors

  • Parameters

    • values: number[]
    • Optional options: {
          numCols: number;
          numRows: number;
      }
      • numCols: number
      • numRows: number

    Returns Mat

Properties

numCols: number
numRows: number
values: number[]

Methods

  • add two matrices

    Returns

    result matrix

    Parameters

    • otherMatrix: Mat

      matrix to add

    Returns Mat

  • get column at a given index

    Returns

    column as an array of numbers

    Parameters

    • column: number

      index of column starting from 0

    Returns number[]

  • calculate determinant, implemented for mat2, mat3, mat4

    Returns number

  • check for equality

    Returns

    true or false

    Parameters

    • otherMatrix: Mat

      matrix to compare

    Returns boolean

  • Checks if the matrix contains NaN or Infinity values

    Returns

    true if all values are finite (neither NaN nor Infinity)

    Returns boolean

  • Checks if the matrix contains NaN values

    Returns

    true if one of the values is NaN

    Returns boolean

  • matrix multiplication

    Returns

    a vector in case of matrix vector multiplication, else a matrix

    Throws

    dimension Mismatch if dimensions doesn't match

    Parameters

    • param: number | Mat

      can be a matrix, a number or a vector

    Returns Mat

  • Parameters

    Returns Vec

  • check for rough equality (because in JS, .1+.2 !== .3)

    Returns

    true or false

    Parameters

    • otherMatrix: Mat

      matrix to compare

    • delta: number = 1e-14

      tolerance, by default 1e-14

    Returns boolean

  • get row at a given index

    Returns

    row as an array of numbers

    Parameters

    • row: number

      index of row starting from 0

    Returns number[]

  • subtract another matrix

    Returns

    result matrix

    Parameters

    • otherMatrix: Mat

      matrix to subtract

    Returns Mat

  • convert to array

    Returns number[]

  • convert matrix to string

    Returns

    a string containing matROWSxCOLS(comma-separated-values)

    Returns string

  • get value at a given position

    Parameters

    • row: number

      row index starting from 0

    • column: number

      column index starting from 0

    Returns number

  • Converts a vector with dimension n into a matrix with 1 col and n rows useful for matrix multiplication

    Parameters

    • value: Vec

      the input vector

    Returns Mat

  • Converts a bunch of vectors into a matrix

    Parameters

    • Optional vectors: Vec[]

    Returns Mat

  • create identity matrix

    Parameters

    • dimension: number

      dimension of the matrix

    Returns Mat

Generated using TypeDoc