Appends to matrices by rows.

@param m1 The first matrix
@param m2 The second matrix.
@return Returns the new row-bound matrix.
484221
public static RealMatrix rbind (RealMatrix m1, RealMatrix m2) {
        return MatrixUtils.createRealMatrix(ArrayUtils.addAll(m1.getData(), m2.getData()));
    }
320991
public Matrix multiply(Matrix m) throws MatrixException
    {
        // Validate m's dimensions.
        if (nCols != m.nRows) {
            throw new MatrixException(
                                MatrixException.INVALID_DIMENSIONS);
        }

        double pv[][] = new double[nRows][m.nCols];  // product values

        // Compute values of the product.
        for (int r = 0; r < nRows; ++r) {
            for (int c = 0; c < m.nCols; ++c) {
                double dot = 0;
                for (int k = 0; k < nCols; ++k) {
                    dot += values[r][k] * m.values[k][c];
                }
                pv[r][c] = dot;
            }
        }

        return new Matrix(pv);
    }
701965
public static double[][] transposeTimes(final double[] v1, final double[][] m2) {
    assert m2.length == v1.length : ERR_MATRIX_INNERDIM;
    final int columndimension = m2[0].length;
    final double[][] re = new double[1][columndimension];
    for(int j = 0; j < columndimension; j++) {
      double s = 0;
      for(int k = 0; k < v1.length; k++) {
        s += v1[k] * m2[k][j];
      }
      re[0][j] = s;
    }
    return re;
  }
225751
public static final DoubleMatrix2D add(DoubleMatrix2D A, DoubleMatrix2D B){
		if(A.rows()!=B.rows() || A.columns()!=B.columns()){
			throw new IllegalArgumentException("wrong matrices dimensions");
		}
		DoubleMatrix2D ret = DoubleFactory2D.dense.make(A.rows(), A.columns());
		for(int i=0; i<ret.rows(); i++){
			for(int j=0; j<ret.columns(); j++){
				ret.setQuick(i, j, A.getQuick(i, j) + B.getQuick(i, j));
			}
		}

		return ret;
	}
869655
public Matrix4x3d m21(double m21) {
        this.m21 = m21;
        properties &= ~PROPERTY_ORTHONORMAL;
        if (m21 != 0.0)
            properties &= ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
        return this;
    }
145988
private void set(Matrix m)
    {
        this.nRows  = this.nCols = Math.min(m.nRows, m.nCols);
        this.values = m.values;
    }
1056365
public Matrix3d set(double m[]) {
        m00 = m[0];
        m01 = m[1];
        m02 = m[2];
        m10 = m[3];
        m11 = m[4];
        m12 = m[5];
        m20 = m[6];
        m21 = m[7];
        m22 = m[8];
        return this;
    }
178847
public Vector2d mulDirection(Matrix3x2dc mat, Vector2d dest) {
        double rx = mat.m00() * x + mat.m10() * y;
        double ry = mat.m01() * x + mat.m11() * y;
        dest.x = rx;
        dest.y = ry;
        return dest;
    }
535211
public Vector2d mulPosition(Matrix3x2dc mat, Vector2d dest) {
        double rx = mat.m00() * x + mat.m10() * y + mat.m20();
        double ry = mat.m01() * x + mat.m11() * y + mat.m21();
        dest.x = rx;
        dest.y = ry;
        return dest;
    }
341740
public static double[][] minusEquals(final double[][] m1, final double[][] m2) {
    final int columndimension = getColumnDimensionality(m1);
    assert getRowDimensionality(m1) == getRowDimensionality(m2) && columndimension == getColumnDimensionality(m2) : ERR_MATRIX_DIMENSIONS;
    for(int i = 0; i < m1.length; i++) {
      final double[] row1 = m1[i], row2 = m2[i];
      for(int j = 0; j < columndimension; j++) {
        row1[j] -= row2[j];
      }
    }
    return m1;
  }
421638
public Matrix4x3f m21(float m21) {
        this.m21 = m21;
        properties &= ~PROPERTY_ORTHONORMAL;
        if (m21 != 0.0f)
            properties &= ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
        return this;
    }
646285
def matrix_multiply(m0, m1):
    new_matrix = numpy.zeros((m0.shape[0],m1.shape[1]))
    ""
    for i in xrange(m0.shape[0]):
        for j in xrange(m1.shape[1]):
            r=0
            for k in xrange(m1.shape[0]):
                r += m0[i,k]*m1[k,j]
            new_matrix[i,j]=r
    return new_matrix
1225464
public Vector2f mulPosition(Matrix3x2fc mat, Vector2f dest) {
        dest.set(mat.m00() * x + mat.m10() * y + mat.m20(),
                 mat.m01() * x + mat.m11() * y + mat.m21());
        return dest;
    }
720788
public function fromMatrix(Matrix $mA)
    {
        $data = $mA->toArray();
        $rows = $mA->rows();
        $cols = $mA->columns();
        for ($y = 0; $y < $rows; $y++) {
            for ($x = 0; $x < $cols; $x++) {
                $this->append(new Vector2D($x, $y, $data[$y][$x]));
            }
        }

        return $this;
    }
199133
public Matrix add(Matrix m) throws MatrixException
    {
        // Validate m's size.
        if ((nRows != m.nRows) && (nCols != m.nCols)) {
            throw new MatrixException(
                                MatrixException.INVALID_DIMENSIONS);
        }

        double sv[][] = new double[nRows][nCols]; // sum values

        // Compute values of the sum.
        for (int r = 0; r < nRows; ++r) {
            for (int c = 0; c < nCols; ++c) {
                sv[r][c] = values[r][c] + m.values[r][c];
            }
        }

        return new Matrix(sv);
    }
1172924
public static double[] columnPackedCopy(final double[][] m1) {
    final int rowdim = m1.length, coldim = getColumnDimensionality(m1);
    final double[] vals = new double[m1.length * coldim];
    for(int i = 0; i < rowdim; i++) {
      final double[] rowM = m1[i];
      // assert rowM.length == coldim : ERR_MATRIX_RAGGED;
      for(int j = 0, k = i; j < coldim; j++, k += rowdim) {
        vals[k] = rowM[j];
      }
    }
    return vals;
  }
367879
public void multT(DoubleMatrix bMat, DoubleMatrix cMat, boolean transposeA, boolean transposeB) {
        if (!transposeA) {            
            throw new IllegalArgumentException("Multiplication where this matrix NOT transposed is not implemented.");
        }
        
        SparseRowDoubleMatrix.checkMultDimensions(this.viewTranspose(), transposeB ? bMat.viewTranspose() : bMat, cMat);

        int numRowsC = cMat.getNumRows();
        int numColsC = cMat.getNumColumns();
        
        if (bMat instanceof DenseDoubleMatrix) {
            DenseDoubleMatrix denseBMat = (DenseDoubleMatrix) bMat;
            for (int row = 0; row < numRowsC; row++) {
                for (int col = 0; col < numColsC; col++) {
                    if (transposeB) {
                        cMat.set(row, col, this.cols[row].dot(denseBMat.matrix[col]));
                    } else {
                        cMat.set(row, col, this.cols[row].dot(denseBMat.matrix, col));
                    }
                }
            }
        } else if (bMat instanceof SparseColDoubleMatrix && !transposeB) {
            SparseColDoubleMatrix sparseBMat = (SparseColDoubleMatrix) bMat;
            for (int row = 0; row < numRowsC; row++) {
                for (int col = 0; col < numColsC; col++) {
                    cMat.set(row, col, this.cols[row].dot(sparseBMat.cols[col]));
                }
            }
        } else if (bMat instanceof SparseRowDoubleMatrix && transposeB) {
            SparseRowDoubleMatrix sparseBMat = (SparseRowDoubleMatrix) bMat;
            for (int row = 0; row < numRowsC; row++) {
                for (int col = 0; col < numColsC; col++) {
                    cMat.set(row, col, this.cols[row].dot(sparseBMat.rows[col]));
                }
            }
        } else {
            throw new IllegalArgumentException("unhandled type: " + bMat.getClass().getCanonicalName());
        }
    }