public static void inner_reorder_lower ( DMatrix1Row A , DMatrix1Row B ) { final int cols = A . numCols ; B . reshape ( cols , cols ) ; Arrays . fill ( B . data , 0 ) ; for ( int i = 0 ; i < cols ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { B . data [ i * cols + j ] += A . data [ i ] * A . data [ j ] ; } for ( int k = 1 ; k < A . numRows ; k ++ ) { int indexRow = k * cols ; double valI = A . data [ i + indexRow ] ; int indexB = i * cols ; for ( int j = 0 ; j <= i ; j ++ ) { B . data [ indexB ++ ] += valI * A . data [ indexRow ++ ] ; } } } }
Computes the inner product of A times A and stores the results in B . The inner product is symmetric and this function will only store the lower triangle . The value of the upper triangular matrix is undefined .