當前位置: 首頁>>代碼示例>>Java>>正文


Java Primitive64Array.wrap方法代碼示例

本文整理匯總了Java中org.ojalgo.array.Primitive64Array.wrap方法的典型用法代碼示例。如果您正苦於以下問題:Java Primitive64Array.wrap方法的具體用法?Java Primitive64Array.wrap怎麽用?Java Primitive64Array.wrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.ojalgo.array.Primitive64Array的用法示例。


在下文中一共展示了Primitive64Array.wrap方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testP20150809

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
/**
 * Issue reported at GitHub. A set of problems related to when Q is zero - a linear problem. Generally the
 * ConvexSolver is not the right option to handle linear problems, but there is some desireable behaviour.
 */
public void testP20150809() {

    final Primitive64Array tmpExpectedSolution = Primitive64Array.wrap(new double[] { 0.12, -0.05, 0.08, 0.07 });
    final Primitive64Array tmpBoundedSolution = Primitive64Array.wrap(new double[] { 99999, -99999, 99999, 99999 });

    ConvexSolver tmpSolver = P20150809.buildModel(true, false);
    Result tmpResult = tmpSolver.solve();
    TestUtils.assertStateNotLessThanOptimal(tmpResult);
    TestUtils.assertEquals(tmpExpectedSolution, tmpResult);

    tmpSolver = P20150809.buildModel(true, true);
    tmpResult = tmpSolver.solve();
    TestUtils.assertStateNotLessThanOptimal(tmpResult);
    TestUtils.assertEquals(tmpExpectedSolution, tmpResult);

    tmpSolver = P20150809.buildModel(false, false);
    tmpResult = tmpSolver.solve();
    TestUtils.assertEquals(Optimisation.State.UNBOUNDED, tmpResult.getState());

    tmpSolver = P20150809.buildModel(false, true);
    tmpResult = tmpSolver.solve();
    TestUtils.assertStateNotLessThanOptimal(tmpResult); // Since it is now constrained, the solver should be able find the optimal solution.
    TestUtils.assertEquals(tmpBoundedSolution, tmpResult);
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:29,代碼來源:ConvexProblems.java

示例2: testEmptySet

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testEmptySet() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        try {

            // The key thing is that all methods return something
            // 0.0, NaN, Inf... doesn't really matter...
            TestUtils.assertEquals(0.0, tmpSampleSet.getFirst());
            TestUtils.assertEquals(0.0, tmpSampleSet.getInterquartileRange());
            TestUtils.assertEquals(0.0, tmpSampleSet.getLargest());
            TestUtils.assertEquals(0.0, tmpSampleSet.getLast());
            TestUtils.assertEquals(0.0, tmpSampleSet.getMaximum());
            TestUtils.assertEquals(Double.NaN, tmpSampleSet.getMean());
            TestUtils.assertEquals(0.0, tmpSampleSet.getMedian());
            TestUtils.assertEquals(0.0, tmpSampleSet.getMinimum());
            TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile1());
            TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile2());
            TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile3());
            TestUtils.assertTrue(Double.isInfinite(tmpSampleSet.getSmallest()));
            TestUtils.assertEquals(0.0, tmpSampleSet.getStandardDeviation());
            TestUtils.assertEquals(0.0, tmpSampleSet.getSumOfSquares());
            TestUtils.assertEquals(0.0, tmpSampleSet.getVariance());

        } catch (final Exception exception) {
            // Important NOT to throw an exception!
            TestUtils.fail(exception.getMessage());
        }
    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:31,代碼來源:SampleSetTest.java

示例3: solve

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public Result solve(final Result kickStarter) {

        final int tmpNumberOfVariables = myTask.getnumvar();

        Optimisation.State tmpSate = Optimisation.State.FAILED;
        double tmpValue = Double.NaN;
        final double[] tmpSolution = new double[tmpNumberOfVariables];

        try {

            final Env tmpEnvironment = INTEGRATION.getEnvironment();

            DEFAULT.configure(tmpEnvironment, myTask, myOptions);
            final Optional<Configurator> optional = myOptions.getConfigurator(Configurator.class);
            if (optional.isPresent()) {
                optional.get().configure(tmpEnvironment, myTask, myOptions);
            }

            if (myTask.optimize() == rescode.ok) {

                final solsta[] tmpSolverState = new solsta[1];
                myTask.getsolsta(mySolutionType, tmpSolverState);

                myTask.getxx(mySolutionType, tmpSolution);

                switch (tmpSolverState[0]) {
                case optimal:
                case near_optimal:
                    tmpSate = Optimisation.State.OPTIMAL;
                    tmpValue = myTask.getprimalobj(mySolutionType);
                    break;
                case dual_infeas_cer:
                case prim_infeas_cer:
                case near_dual_infeas_cer:
                case near_prim_infeas_cer:
                    tmpSate = Optimisation.State.INFEASIBLE;
                    break;
                default:
                    tmpSate = Optimisation.State.FAILED;
                    break;
                }
            }

        } catch (final Exception xcptn) {
            throw xcptn;
        }

        return new Optimisation.Result(tmpSate, tmpValue, Primitive64Array.wrap(tmpSolution));
    }
 
開發者ID:optimatika,項目名稱:ojAlgo-extensions,代碼行數:50,代碼來源:SolverMosek.java

示例4: makeD

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
@Override
protected MatrixStore<N> makeD() {
    final DiagonalBasicArray<Double> tmpDiagonal = new DiagonalBasicArray<>(Primitive64Array.wrap(d), null, null, ZERO);
    return this.wrap(tmpDiagonal).diagonal(false).get();
}
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:6,代碼來源:HermitianEvD.java

示例5: testQuartileEx1

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileEx1() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 6, 7, 15, 36, 39, 40, 41, 42, 43, 47, 49 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(20.25, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(40.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(42.75, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例6: testQuartileEx2

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileEx2() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 7, 15, 36, 39, 40, 41 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(15.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(37.5, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(40.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例7: testQuartileSize0

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize0() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(0.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例8: testQuartileSize1

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize1() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(100.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(100.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(100.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例9: testQuartileSize2

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize2() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0, 200.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(100.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(150.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(200.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例10: testQuartileSize3

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize3() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0, 200.0, 300.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(125.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(200.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(275.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例11: testQuartileSize4

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize4() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0, 200.0, 300.0, 400.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(150.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(250.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(350.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例12: testQuartileSize6

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize6() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0, 200.0, 300.0, 400.0, 500.0, 600.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(200.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(350.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(500.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java

示例13: testQuartileSize8

import org.ojalgo.array.Primitive64Array; //導入方法依賴的package包/類
public void testQuartileSize8() {

        final Primitive64Array tmpSamples = Primitive64Array.wrap(new double[] { 100.0, 200.0, 300.0, 400.0, 500.0, 600.0, 700.0, 800.0 });
        final SampleSet tmpSampleSet = SampleSet.wrap(tmpSamples);

        TestUtils.assertEquals(250.0, tmpSampleSet.getQuartile1());
        TestUtils.assertEquals(450.0, tmpSampleSet.getQuartile2());
        TestUtils.assertEquals(650.0, tmpSampleSet.getQuartile3());

    }
 
開發者ID:optimatika,項目名稱:ojAlgo,代碼行數:11,代碼來源:SampleSetTest.java


注:本文中的org.ojalgo.array.Primitive64Array.wrap方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。