public static long access2d ( DMatrixRMaj a , DMatrixRMaj b , DMatrixRMaj c ) { long timeBefore = System . currentTimeMillis ( ) ; for ( int i = 0 ; i < a . numRows ; i ++ ) { for ( int j = 0 ; j < b . numCols ; j ++ ) { c . set ( i , j , a . get ( i , 0 ) * b . get ( 0 , j ) ) ; } for ( int k = 1 ; k < b . numRows ; k ++ ) { for ( int j = 0 ; j < b . numCols ; j ++ ) { // c.set(i,j, c.get(i,j) + a.get(i,k)*b.get(k,j)); c . data [ i * b . numCols + j ] += a . get ( i , k ) * b . get ( k , j ) ; } } } return System . currentTimeMillis ( ) - timeBefore ; }
Only sets and gets that are by row and column are used .