Search in sources :

Example 16 with PrimitiveDenseStore

use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.

the class GaussianField method getM1.

MatrixStore<Double> getM1(final K[] args) {
    final int tmpLength = args.length;
    final PrimitiveDenseStore retVal = FACTORY.makeZero(tmpLength, 1);
    for (int i = 0; i < tmpLength; i++) {
        retVal.set(i, 0, myMeanFunction.invoke(args[i]));
    }
    return retVal;
}
Also used : PrimitiveDenseStore(org.ojalgo.matrix.store.PrimitiveDenseStore)

Example 17 with PrimitiveDenseStore

use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.

the class GaussianField method getM2differenses.

MatrixStore<Double> getM2differenses() {
    final List<ComparableToDouble<K>> tmpObservations = this.getObservations();
    final int tmpSize = tmpObservations.size();
    final PrimitiveDenseStore retVal = FACTORY.makeZero(tmpSize, 1);
    ComparableToDouble<K> tmpObservation;
    double tmpDiff;
    for (int i = 0; i < tmpSize; i++) {
        tmpObservation = tmpObservations.get(i);
        tmpDiff = tmpObservation.value - myMeanFunction.invoke(tmpObservation.key);
        retVal.set(i, 0, tmpDiff);
    }
    return retVal;
}
Also used : ComparableToDouble(org.ojalgo.type.keyvalue.ComparableToDouble) PrimitiveDenseStore(org.ojalgo.matrix.store.PrimitiveDenseStore)

Example 18 with PrimitiveDenseStore

use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.

the class ComplexNumber method toMultiplicationMatrix.

public MatrixStore<Double> toMultiplicationMatrix() {
    final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(this);
    this.supplyTo(retVal);
    return retVal;
}
Also used : PrimitiveDenseStore(org.ojalgo.matrix.store.PrimitiveDenseStore)

Example 19 with PrimitiveDenseStore

use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.

the class ComplexNumber method toRotationMatrix.

public MatrixStore<Double> toRotationMatrix() {
    final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(2L, 2L);
    final double s = myRealValue;
    final double ss = s * s;
    final double ii = i * i;
    final double invs = 1.0 / (ii + ss);
    final double r00 = (ii + ss) * invs;
    final double r11 = (ss - ii) * invs;
    retVal.set(0L, r00);
    retVal.set(3L, r11);
    return retVal;
}
Also used : PrimitiveDenseStore(org.ojalgo.matrix.store.PrimitiveDenseStore)

Example 20 with PrimitiveDenseStore

use of org.ojalgo.matrix.store.PrimitiveDenseStore in project ojAlgo by optimatika.

the class ComplexNumber method toMultiplicationVector.

public MatrixStore<Double> toMultiplicationVector() {
    final PrimitiveDenseStore retVal = PrimitiveDenseStore.FACTORY.makeZero(2L, 1L);
    retVal.set(0L, myRealValue);
    retVal.set(1L, i);
    return retVal;
}
Also used : PrimitiveDenseStore(org.ojalgo.matrix.store.PrimitiveDenseStore)

Aggregations

PrimitiveDenseStore (org.ojalgo.matrix.store.PrimitiveDenseStore)72 Test (org.junit.jupiter.api.Test)37 Optimisation (org.ojalgo.optimisation.Optimisation)16 NumberContext (org.ojalgo.type.context.NumberContext)15 ExpressionsBasedModel (org.ojalgo.optimisation.ExpressionsBasedModel)12 ComparableToDouble (org.ojalgo.type.keyvalue.ComparableToDouble)7 Result (org.ojalgo.optimisation.Optimisation.Result)6 ComplexNumber (org.ojalgo.scalar.ComplexNumber)4 SimultaneousPrimitive (org.ojalgo.matrix.decomposition.HermitianEvD.SimultaneousPrimitive)3 PhysicalStore (org.ojalgo.matrix.store.PhysicalStore)3 Builder (org.ojalgo.optimisation.convex.ConvexSolver.Builder)3 IntRowColumn (org.ojalgo.access.Structure2D.IntRowColumn)2 ComplexDenseStore (org.ojalgo.matrix.store.ComplexDenseStore)2 LinearSolver (org.ojalgo.optimisation.linear.LinearSolver)2 Normal (org.ojalgo.random.Normal)2 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Disabled (org.junit.jupiter.api.Disabled)1 Tag (org.junit.jupiter.api.Tag)1 ProgrammingError (org.ojalgo.ProgrammingError)1