use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class Quaternion method toMultiplicationMatrix.
public MatrixStore<Double> toMultiplicationMatrix() {
final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(this);
this.supplyTo(retVal);
return retVal;
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class Expression method getAdjustedGradient.
public MatrixStore<Double> getAdjustedGradient(final Access1D<?> point) {
final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(myModel.countVariables(), 1);
final BinaryFunction<Double> tmpBaseFunc = PrimitiveFunction.ADD;
double tmpAdjustedFactor;
UnaryFunction<Double> tmpModFunc;
for (final IntRowColumn tmpKey : this.getQuadraticKeySet()) {
tmpAdjustedFactor = this.getAdjustedQuadraticFactor(tmpKey);
tmpModFunc = tmpBaseFunc.second(tmpAdjustedFactor * point.doubleValue(tmpKey.column));
retVal.modifyOne(tmpKey.row, 0, tmpModFunc);
tmpModFunc = tmpBaseFunc.second(tmpAdjustedFactor * point.doubleValue(tmpKey.row));
retVal.modifyOne(tmpKey.column, 0, tmpModFunc);
}
for (final IntIndex tmpKey : this.getLinearKeySet()) {
tmpAdjustedFactor = this.getAdjustedLinearFactor(tmpKey);
tmpModFunc = tmpBaseFunc.second(tmpAdjustedFactor);
retVal.modifyOne(tmpKey.index, 0, tmpModFunc);
}
return retVal;
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class GaussianField method getC11.
MatrixStore<Double> getC11(final K[] args) {
final int tmpLength = args.length;
final PrimitiveDenseStore retVal = FACTORY.makeZero(tmpLength, tmpLength);
for (int j = 0; j < tmpLength; j++) {
for (int i = 0; i < tmpLength; i++) {
retVal.set(i, j, myCovarianceFunction.invoke(args[i], args[j]));
}
}
return retVal;
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class GaussianField method getC12.
MatrixStore<Double> getC12(final K[] args) {
final List<ComparableToDouble<K>> tmpObservations = this.getObservations();
final int tmpRowDim = args.length;
final int tmpColDim = tmpObservations.size();
final PrimitiveDenseStore retVal = FACTORY.makeZero(tmpRowDim, tmpColDim);
for (int j = 0; j < tmpColDim; j++) {
for (int i = 0; i < tmpRowDim; i++) {
retVal.set(i, j, myCovarianceFunction.invoke(args[i], tmpObservations.get(j).key));
}
}
return retVal;
}
use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.
the class GaussianField method getC22.
MatrixDecomposition.Solver<Double> getC22() {
final List<ComparableToDouble<K>> tmpObservations = this.getObservations();
final int tmpSize = tmpObservations.size();
final PrimitiveDenseStore tmpMatrix = FACTORY.makeZero(tmpSize, tmpSize);
for (int j = 0; j < tmpSize; j++) {
final K tmpColumnKey = tmpObservations.get(j).key;
for (int i = 0; i < tmpSize; i++) {
tmpMatrix.set(i, j, myCovarianceFunction.invoke(tmpObservations.get(i).key, tmpColumnKey));
}
}
final SingularValue<Double> retVal = SingularValue.PRIMITIVE.make();
retVal.decompose(tmpMatrix);
return retVal;
}
Aggregations