public void addMatrix ( double [ ] [ ] m ) { assert ( m . length == dim ) ; assert ( m [ 0 ] . length == dim ) ; // reset inverse transformation - needs recomputation. inv = null ; // extend the matrix with an extra row and column double [ ] [ ] ht = new double [ dim + 1 ] [ dim + 1 ] ; for ( int i = 0 ; i < dim ; i ++ ) { for ( int j = 0 ; j < dim ; j ++ ) { ht [ i ] [ j ] = m [ i ] [ j ] ; } } // the other cells default to identity matrix ht [ dim ] [ dim ] = 1.0 ; // Multiply from left. trans = times ( ht , trans ) ; }
Add a matrix operation to the matrix .