148149150151152153154155156157158
// double acc=0.0; // for (int k=0; k<ic; k++) { // acc+=a.unsafeGet(i, k)*tmp[k]; // } double acc=DoubleArrays.dotProduct(a.data, i*ic, tmp, 0, ic); result.unsafeSet(i,j,acc); } } return result; }
170171172173174175176177178179180
for (int j=0; j<cc; j++) { double acc=0.0; for (int k=0; k<ic; k++) { acc+=a.unsafeGet(i, k)*b.unsafeGet(k, j); } result.unsafeSet(i,j,acc); } } return result; } }
96979899100101102103104105106
Matrix l = Matrix.create(n, n); for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { l.unsafeSet(i, j, m.get(i, j)); } l.unsafeSet(i, i, 1.0); } // clear low elements to ensure upper triangle only is populated
9899100101102103104105106107108
for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { l.unsafeSet(i, j, m.get(i, j)); } l.unsafeSet(i, i, 1.0); } // clear low elements to ensure upper triangle only is populated Matrix u = m; for (int i = 0; i < n; i++) {
105106107108109110111112113114115
// clear low elements to ensure upper triangle only is populated Matrix u = m; for (int i = 0; i < n; i++) { for (int j = 0; j < i; j++) { u.unsafeSet(i, j, 0.0); } } return new LUPResult (l, u, p); }
138139140141142143144145146147148
int n = compact ? numSingular : numCols; Matrix S = Matrix.create(m,n); for( int i = 0; i < numSingular; i++ ) { S.unsafeSet(i,i, singularValues[i]); } return S; }