public Matrix multiply ( final Matrix m ) throws MatrixException { // Validate m's dimensions. if ( m_nCols != m . m_nRows ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } final float pv [ ] [ ] = new float [ m_nRows ] [ m . m_nCols ] ; // product values // Compute values of the product. for ( int r = 0 ; r < m_nRows ; ++ r ) { for ( int c = 0 ; c < m . m_nCols ; ++ c ) { float dot = 0 ; for ( int k = 0 ; k < m_nCols ; ++ k ) { dot += m_aValues [ r ] [ k ] * m . m_aValues [ k ] [ c ] ; } pv [ r ] [ c ] = dot ; } } return new Matrix ( pv ) ; }
Multiply this matrix by another matrix .