private static void multBlockAdd ( double [ ] blockA , double [ ] blockB , double [ ] blockC , final int m , final int n , final int o , final int blockLength ) { // for( int i = 0; i < m; i++ ) { // for( int j = 0; j < o; j++ ) { // double val = 0; // for( int k = 0; k < n; k++ ) { // val += blockA[ i*blockLength + k]*blockB[ k*blockLength + j]; // } // // blockC[ i*blockLength + j] += val; // } // } // int rowA = 0; // for( int i = 0; i < m; i++ , rowA += blockLength) { // for( int j = 0; j < o; j++ ) { // double val = 0; // int indexB = j; // int indexA = rowA; // int end = indexA + n; // for( ; indexA != end; indexA++ , indexB += blockLength ) { // val += blockA[ indexA ]*blockB[ indexB ]; // } // // blockC[ rowA + j] += val; // } // } // for( int k = 0; k < n; k++ ) { // for( int i = 0; i < m; i++ ) { // for( int j = 0; j < o; j++ ) { // blockC[ i*blockLength + j] += blockA[ i*blockLength + k]*blockB[ k*blockLength + j]; // } // } // } for ( int k = 0 ; k < n ; k ++ ) { int rowB = k * blockLength ; int endB = rowB + o ; for ( int i = 0 ; i < m ; i ++ ) { int indexC = i * blockLength ; double valA = blockA [ indexC + k ] ; int indexB = rowB ; while ( indexB != endB ) { blockC [ indexC ++ ] += valA * blockB [ indexB ++ ] ; } } } }
Performs a matrix multiplication between inner block matrices .