Constructors

  • The constructor function initializes a matrix object with the provided data and options, or with default values if no options are provided.

    Parameters

    • data: number[][]

      A 2D array of numbers representing the data for the matrix.

    • Optional options: MatrixOptions

      The options parameter is an optional object that can contain the following properties:

    Returns Matrix

Accessors

  • get addFn(): ((a, b) => undefined | number)
  • The above function returns the value of the _addFn property.

    Returns ((a, b) => undefined | number)

    The value of the property _addFn is being returned.

      • (a, b): undefined | number
      • Parameters

        • a: undefined | number
        • b: number

        Returns undefined | number

  • get cols(): number
  • The function returns the value of the protected variable _cols.

    Returns number

    The number of columns.

  • get data(): number[][]
  • The function returns a two-dimensional array of numbers.

    Returns number[][]

    The data property, which is a two-dimensional array of numbers.

  • get multiplyFn(): ((a, b) => number)
  • The function returns the value of the _multiplyFn property.

    Returns ((a, b) => number)

    The _multiplyFn property is being returned.

      • (a, b): number
      • Parameters

        • a: number
        • b: number

        Returns number

  • get rows(): number
  • The function returns the number of rows.

    Returns number

    The number of rows.

  • get subtractFn(): ((a, b) => number)
  • The function returns the value of the _subtractFn property.

    Returns ((a, b) => number)

    The _subtractFn property is being returned.

      • (a, b): number
      • Parameters

        • a: number
        • b: number

        Returns number

Methods

  • The function _addScaledRow multiplies a row in a matrix by a scalar value and adds it to another row.

    Parameters

    • targetRow: number

      The targetRow parameter represents the index of the row in which the scaled values will be added.

    • sourceRow: number

      The sourceRow parameter represents the index of the row from which the values will be scaled and added to the targetRow.

    • scalar: number

      The scalar parameter is a number that is used to scale the values in the source row before adding them to the target row.

    Returns void

  • The function scales a specific row in a matrix by a given scalar value.

    Parameters

    • row: number

      The row parameter represents the index of the row in the matrix that you want to scale. It is a number that indicates the position of the row within the matrix.

    • scalar: number

      The scalar parameter is a number that is used to multiply each element in a specific row of a matrix.

    Returns void

  • The function _swapRows swaps the positions of two rows in an array.

    Parameters

    • row1: number

      The row1 parameter is the index of the first row that you want to swap.

    • row2: number

      The row2 parameter is the index of the second row that you want to swap with the first row.

    Returns void

  • The add function adds two matrices together, returning a new matrix with the result.

    Parameters

    • matrix: Matrix

      The matrix parameter is an instance of the Matrix class.

    Returns undefined | Matrix

    The add method returns a new Matrix object that represents the result of adding the current matrix with the provided matrix parameter.

  • The clone function returns a new instance of the Matrix class with the same data and properties as the original instance.

    Returns Matrix

    The clone() method is returning a new instance of the Matrix class with the same data and properties as the current instance.

  • The dot function calculates the dot product of two matrices and returns a new matrix.

    Parameters

    • matrix: Matrix

      The matrix parameter is an instance of the Matrix class.

    Returns undefined | Matrix

    a new Matrix object.

  • The get function returns the value at the specified row and column index if it is a valid index.

    Parameters

    • row: number

      The row parameter represents the row index of the element you want to retrieve from the data array.

    • col: number

      The parameter "col" represents the column number of the element you want to retrieve from the data array.

    Returns undefined | number

    The get function returns a number if the provided row and column indices are valid. Otherwise, it returns undefined.

  • The inverse function calculates the inverse of a square matrix using Gaussian elimination.

    Returns undefined | Matrix

    a Matrix object, which represents the inverse of the original matrix.

  • The function checks if the dimensions of the given matrix match the dimensions of the current matrix.

    Parameters

    • matrix: Matrix

      The parameter matrix is of type Matrix.

    Returns boolean

    a boolean value.

  • The function checks if a given row and column index is valid within a specified range.

    Parameters

    • row: number

      The row parameter represents the row index of a two-dimensional array or matrix. It is a number that indicates the specific row in the matrix.

    • col: number

      The "col" parameter represents the column index in a two-dimensional array or grid. It is used to check if the given column index is valid within the bounds of the grid.

    Returns boolean

    A boolean value is being returned.

  • The multiply function performs matrix multiplication between two matrices and returns the result as a new matrix.

    Parameters

    • matrix: Matrix

      The matrix parameter is an instance of the Matrix class.

    Returns undefined | Matrix

    a new Matrix object.

  • The set function updates the value at a specified row and column in a two-dimensional array.

    Parameters

    • row: number

      The "row" parameter represents the row index of the element in a two-dimensional array or matrix. It specifies the row where the value will be set.

    • col: number

      The "col" parameter represents the column index of the element in a two-dimensional array.

    • value: number

      The value parameter represents the number that you want to set at the specified row and column in the data array.

    Returns boolean

    a boolean value. It returns true if the index (row, col) is valid and the value is successfully set in the data array. It returns false if the index is invalid and the value is not set.

  • The subtract function performs element-wise subtraction between two matrices and returns a new matrix with the result.

    Parameters

    • matrix: Matrix

      The matrix parameter is an instance of the Matrix class. It represents the matrix that you want to subtract from the current matrix.

    Returns undefined | Matrix

    a new Matrix object with the result of the subtraction operation.

  • The transpose function takes a matrix and returns a new matrix that is the transpose of the original matrix.

    Returns Matrix

    The transpose() function returns a new Matrix object with the transposed data.

Generated using TypeDoc