Class MatrixFlipRowView

Hierarchy

Constructors

Properties

Methods

[iterator] abs acos acosh add addColumnVector addRowVector and apply asin asinh atan atanh cbrt ceil center clone clz32 cos cosh cumulativeSum diag diagonal div divColumnVector divRowVector divide dot echelonForm entries exp expm1 fill flipColumns flipRows floor fround get getColumn getColumnVector getRow getRowVector isColumnVector isDistance isEchelonForm isEmpty isReducedEchelonForm isRowVector isSquare isSymmetric isVector kroneckerProduct kroneckerSum leftShift log log10 log1p log2 max maxColumn maxColumnIndex maxIndex maxRow maxRowIndex mean min minColumn minColumnIndex minIndex minRow minRowIndex mmul mmulStrassen mod modulus mpow mul mulColumn mulColumnVector mulRow mulRowVector multiply neg negate norm not or pow product reducedEchelonForm repeat rightShift round scale scaleColumns scaleRows selection set setColumn setRow setSubMatrix sign signPropagatingRightShift sin sinh sortColumns sortRows sqrt standardDeviation strassen2x2 strassen3x3 sub subColumnVector subMatrix subMatrixColumn subMatrixRow subRowVector subtract sum swapColumns swapRows tan tanh tensorProduct to1DArray to2DArray toJSON toString trace transpose trunc values variance xor zeroFillRightShift abs acos acosh add and asin asinh atan atanh cbrt ceil checkMatrix clz32 columnVector copy cos cosh diag diagonal div divide exp expm1 eye floor from1DArray fround identity isMatrix leftShift log log10 log1p log2 max min mod modulus mul multiply not ones or pow rand randInt random rightShift round rowVector sign signPropagatingRightShift sin sinh sqrt sub subtract tan tanh trunc xor zeroFillRightShift zeros

Constructors

Properties

columns: number

Number of columns of the matrix.

rows: number

Number of rows of the matrix.

size: number

Total number of elements in the matrix.

Methods

  • iterator from left to right, from top to bottom yield [row, column, value]

    Returns Generator<[row: number, column: number, value: number], void, void>

  • Applies a callback for each element of the matrix. The function is called in the matrix (this) context.

    Parameters

    • callback: ((row, column) => void)

      Function that will be called for each element in the matrix.

        • (row, column): void
        • Parameters

          • row: number
          • column: number

          Returns void

    Returns MatrixFlipRowView

  • iterator from left to right, from top to bottom yield [row, column, value]

    Returns Generator<[row: number, column: number, value: number], void, void>

  • Returns the value of the given element of the matrix.

    Parameters

    • rowIndex: number

      Index of the element's row.

    • columnIndex: number

      Index of the element's column.

    Returns number

    • The value of the element.
  • Returns a new array with the values from the given column index.

    Parameters

    • index: number

      Column index.

    Returns number[]

  • Returns a new array with the values from the given row index.

    Parameters

    • index: number

      Row index.

    Returns number[]

  • Returns the maximum value of the matrix.

    Returns number

  • Returns the maximum value by the given dimension.

    Parameters

    • by: MatrixDimension

      max by 'row' or 'column'.

    Returns number[]

  • Returns the index of the maximum value of one column.

    Parameters

    • column: number

      Column index.

    Returns [number, number]

  • Returns the index of the maximum value of one row.

    Parameters

    • row: number

      Row index.

    Returns [number, number]

  • Returns the minimum value of the matrix.

    Returns number

  • Returns the minimum value by the given dimension.

    Parameters

    • by: MatrixDimension

      min by 'row' or 'column'.

    Returns number[]

  • Returns the index of the minimum value of one column.

    Parameters

    • column: number

      Column index.

    Returns [number, number]

  • Returns the index of the maximum value of one row.

    Parameters

    • row: number

      Row index.

    Returns [number, number]

  • Returns the square matrix raised to the given power

    Parameters

    • scalar: number

      the non-negative integer power to raise this matrix to

    Returns Matrix

  • Returns the norm of a matrix.

    Parameters

    • Optional type: "max" | "frobenius"

      Norm type. Default: 'frobenius'.

    Returns number

  • Creates a new matrix that is a repetition of the current matrix. New matrix has rows times the number of rows of the original matrix, and columns times the number of columns of the original matrix.

    Parameters

    Returns Matrix

    Example

    var matrix = new Matrix([[1, 2]]);
    matrix.repeat({ rows: 2 }); // [[1, 2], [1, 2]]
  • Return a new matrix based on a selection of rows and columns. Order of the indices matters and the same index can be used more than once.

    Parameters

    • rowIndices: ArrayLike<number>

      The row indices to select.

    • columnIndices: ArrayLike<number>

      The column indices to select.

    Returns Matrix

  • Set a part of the matrix to the given sub-matrix.

    Parameters

    • matrix: MaybeMatrix

      The source matrix from which to extract values.

    • startRow: number

      The index of the first row to set.

    • startColumn: number

      The index of the first column to set.

    Returns MatrixFlipRowView

  • Returns a subset of the matrix.

    Parameters

    • startRow: number

      First row index.

    • endRow: number

      Last row index.

    • startColumn: number

      First column index.

    • endColumn: number

      Last column index.

    Returns Matrix

  • Returns a subset of the matrix based on an array of column indices.

    Parameters

    • indices: ArrayLike<number>

      Array containing the column indices.

    • Optional startRow: number

      First row index. Default: 0.

    • Optional endRow: number

      Last row index. Default: this.rows - 1.

    Returns Matrix

  • Returns a subset of the matrix based on an array of row indices.

    Parameters

    • indices: ArrayLike<number>

      Array containing the row indices.

    • Optional startColumn: number

      First column index. Default: 0.

    • Optional endColumn: number

      Last column index. Default: this.columns - 1.

    Returns Matrix

  • Returns the sum of all elements of the matrix.

    Returns number

  • Returns the sum by the given dimension.

    Parameters

    • by: MatrixDimension

      sum by 'row' or 'column'.

    Returns number[]

  • iterator from left to right, from top to bottom yield value

    Returns Generator<number, void, void>

  • Creates a diagonal matrix based on the given array.

    Parameters

    • data: ArrayLike<number>

      Array containing the data for the diagonal.

    • Optional rows: number

      Number of rows. Default: data.length.

    • Optional columns: number

      Number of columns. Default: rows.

    Returns Matrix

    • The new diagonal matrix.
  • Creates an identity matrix with the given dimension. Values of the diagonal will be 1 and others will be 0.

    Parameters

    • rows: number

      Number of rows.

    • Optional columns: number

      Number of columns. Default: rows.

    • Optional value: number

      Value to fill the diagonal with. Default: 1.

    Returns Matrix

    • The new identity matrix.
  • Constructs a matrix with the chosen dimensions from a 1D array.

    Parameters

    • newRows: number

      Number of rows.

    • newColumns: number

      Number of columns.

    • newData: ArrayLike<number>

      A 1D array containing data for the matrix.

    Returns Matrix

    The new matrix.

  • Returns a matrix whose elements are the maximum between matrix1 and matrix2.

    Parameters

    • matrix1: MaybeMatrix
    • matrix2: MaybeMatrix

    Returns Matrix

  • Returns a matrix whose elements are the minimum between matrix1 and matrix2.

    Parameters

    • matrix1: MaybeMatrix
    • matrix2: MaybeMatrix

    Returns Matrix

  • Creates a matrix with the given dimensions. Values will be set to one.

    Type Parameters

    Parameters

    • rows: number

      Number of rows.

    • columns: number

      Number of columns.

    Returns M

    The new matrix.

  • Creates a matrix with the given dimensions. Values will be randomly set.

    Parameters

    • rows: number

      Number of rows.

    • columns: number

      Number of columns.

    • Optional options: IRandomOptions

      Options object.

    Returns Matrix

    The new matrix.

  • Creates a row vector, a matrix with only one row.

    Parameters

    • newData: ArrayLike<number>

      A 1D array containing data for the vector.

    Returns Matrix

    The new matrix.

  • Creates a matrix with the given dimensions. Values will be set to zero. This is equivalent to calling the Matrix constructor.

    Type Parameters

    Parameters

    • rows: number

      Number of rows.

    • columns: number

      Number of columns.

    Returns _M

    The new matrix.