use of org.ojalgo.matrix.store.RawStore in project ojAlgo by optimatika.
the class RawCholesky method doSolve.
private MatrixStore<Double> doSolve(final PhysicalStore<Double> preallocated) {
final RawStore tmpBody = this.getRawInPlaceStore();
preallocated.substituteForwards(tmpBody, false, false, false);
preallocated.substituteBackwards(tmpBody, false, true, false);
return preallocated;
}
use of org.ojalgo.matrix.store.RawStore in project ojAlgo by optimatika.
the class RawCholesky method getRank.
public int getRank() {
final double tolerance = SQRT.invoke(this.getAlgorithmEpsilon());
int rank = 0;
final RawStore inPlaceStore = this.getRawInPlaceStore();
final int limit = this.getMinDim();
for (int ij = 0; ij < limit; ij++) {
if (inPlaceStore.doubleValue(ij, ij) > tolerance) {
rank++;
}
}
return rank;
}
use of org.ojalgo.matrix.store.RawStore in project ojAlgo by optimatika.
the class RawCholesky method decompose.
public boolean decompose(final Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) {
final double[][] retVal = this.reset(matrix, false);
final RawStore tmpRawInPlaceStore = this.getRawInPlaceStore();
matrix.supplyTo(tmpRawInPlaceStore);
return this.doDecompose(retVal, tmpRawInPlaceStore);
}
use of org.ojalgo.matrix.store.RawStore in project ojAlgo by optimatika.
the class RawEigenvalue method getInverse.
public MatrixStore<Double> getInverse(final PhysicalStore<Double> preallocated) {
if (myInverse == null) {
final int dim = d.length;
final RawStore tmpMtrx = new RawStore(dim, dim);
double max = ONE;
for (int i = 0; i < dim; i++) {
final double val = d[i];
max = MAX.invoke(max, ABS.invoke(val));
if (PrimitiveScalar.isSmall(max, val)) {
for (int j = 0; j < dim; j++) {
tmpMtrx.set(i, j, ZERO);
}
} else {
final double[] colVi = myTransposedV[i];
for (int j = 0; j < dim; j++) {
tmpMtrx.set(i, j, colVi[j] / val);
}
}
}
myInverse = this.getV().multiply(tmpMtrx);
}
return myInverse;
}
use of org.ojalgo.matrix.store.RawStore in project ojAlgo by optimatika.
the class RawEigenvalue method getD.
/**
* Return the block diagonal eigenvalue matrix
*
* @return D
*/
public RawStore getD() {
final int n = this.getRowDim();
final RawStore X = new RawStore(n, n);
final double[][] D = X.data;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
D[i][j] = ZERO;
}
D[i][i] = d[i];
if (e[i] > 0) {
D[i][i + 1] = e[i];
} else if (e[i] < 0) {
D[i][i - 1] = e[i];
}
}
return X;
}
Aggregations