multiply(value) {
    let i, j, m, k;
    if (value instanceof Matrix) {
      value = value._elements;
    }
    if (Array.isArray(value)) {
      // matrix multiplication
      m = [
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
      ];
      for (i = 0; i < this._elements.length; i++) {
        // row
        for (j = 0; j < this._elements[i].length; j++) {
          // column
          for (k = 0; k < 3; k++) {
            // row
            m[i][j] += this._elements[i][k] * value[k][j];
          }
        }
      }
      this._elements = m;
    } else {
      // scalar multiplication
      for (i = 0; i < this._elements.length; i++) {
        for (j = 0; j < this._elements[i].length; j++) {
          this._elements[i][j] *= value;
        }
      }
    }
    return this;
  }
/**
   *
   * If value is a number; multiplies each element in the matrix by the given value.
   * If value is a matrix; multiplies the two matrices.
   * @param {Number|Array|Matrix} value
   */
If value is a number; multiplies each element in the matrix by the given value.
If value is a matrix; multiplies the two matrices.
@param {Number|Array|Matrix} value
If value is a number ; multiplies each element in the matrix by the given value . If value is a matrix ; multiplies the two matrices . @param { Number|Array|Matrix } value
multiply(value) {
    let i, j, m, k;
    if (value instanceof Matrix) {
      value = value._elements;
    }
    if (Array.isArray(value)) {
      m = [
        [0, 0, 0],
        [0, 0, 0],
        [0, 0, 0],
      ];
      for (i = 0; i < this._elements.length; i++) {
        for (j = 0; j < this._elements[i].length; j++) {
          for (k = 0; k < 3; k++) {
            m[i][j] += this._elements[i][k] * value[k][j];
          }
        }
      }
      this._elements = m;
    } else {
      for (i = 0; i < this._elements.length; i++) {
        for (j = 0; j < this._elements[i].length; j++) {
          this._elements[i][j] *= value;
        }
      }
    }
    return this;
  }
multiply ( value ) { let i , j , m , k ; if ( value instanceof Matrix ) { value = value . _elements ; } if ( Array . isArray ( value ) ) { m = [ [ 0 , 0 , 0 ] , [ 0 , 0 , 0 ] , [ 0 , 0 , 0 ] , ] ; for ( i = 0 ; i < this . _elements . length ; i ++ ) { for ( j = 0 ; j < this . _elements [ i ] . length ; j ++ ) { for ( k = 0 ; k < 3 ; k ++ ) { m [ i ] [ j ] += this . _elements [ i ] [ k ] * value [ k ] [ j ] ; } } } this . _elements = m ; } else { for ( i = 0 ; i < this . _elements . length ; i ++ ) { for ( j = 0 ; j < this . _elements [ i ] . length ; j ++ ) { this . _elements [ i ] [ j ] *= value ; } } } return this ; }
If value is a number; multiplies each element in the matrix by the given value.
If value is a number ; multiplies each element in the matrix by the given value .
// matrix multiplication // row // column // row // scalar multiplication