Examples of toDoubleMatrix2D()


Examples of com.opengamma.analytics.math.linearalgebra.TridiagonalMatrix.toDoubleMatrix2D()

    }

    final TridiagonalMatrix m = new TridiagonalMatrix(c, u, l);
    final DoubleMatrix1D xVec = new DoubleMatrix1D(x);
    DoubleMatrix1D y1 = (DoubleMatrix1D) ALGEBRA.multiply(m, xVec);
    DoubleMatrix2D full = m.toDoubleMatrix2D();
    DoubleMatrix1D y2 = (DoubleMatrix1D) ALGEBRA.multiply(full, xVec);

    for (int i = 0; i < n; i++) {
      assertEquals(y1.getEntry(i), y2.getEntry(i), 1e-12);
    }
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(threadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

    StatesToConsider filter = TestLearnerGraphND.createInstanceOfFilter(filterClass, gr);
    double score_CC=1./2,score_BB=(2+score_CC*k)/4, score_AA=(1+k*score_BB)/2;
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreNone, false);
      LSolver solver = ndGraph.buildMatrix(threadNumber);
      DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
      Assert.assertEquals(6,Ax.columns());
    }
    Set<PairScore> pairsSet = addAllPermutations(gr.pairscores.chooseStatePairs(PAIR_INCOMPATIBLE*2,10,threadNumber,null,filter, new NonRandomRandom()));
    Set<PairScore> exp = addAllPermutations(Arrays.asList(new PairScore[]{
        new PairScore(gr.findVertex("A"),gr.findVertex("A"),(int)(10*score_AA),1),
 
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(threadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

    StatesToConsider filter = TestLearnerGraphND.createInstanceOfFilter(filterClass, gr);
    double score_CC=1./2,score_BB=(2+score_CC*k)/4, score_AA=(1+k*score_BB)/2;
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreNone, false);
      LSolver solver = ndGraph.buildMatrix(threadNumber);
      DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
      Assert.assertEquals(6,Ax.columns());
    }
    Set<PairScore> pairsSet = addAllPermutations(gr.pairscores.chooseStatePairs(PAIR_INCOMPATIBLE*2,10,threadNumber,null,filter, new NonRandomRandom()));
    Set<PairScore> exp = addAllPermutations(Arrays.asList(new PairScore[]{
        new PairScore(gr.findVertex("A"),gr.findVertex("A"),(int)(10*score_AA),1),
 
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(ThreadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

    StatesToConsider filter = TestLearnerGraphND.createInstanceOfFilter(filterClass, gr);
    double score_CC=1./2,score_BB=(2+score_CC*k)/4, score_AA=(1+k*score_BB)/2;
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreNone, false);
      LSolver solver = ndGraph.buildMatrix(ThreadNumber);
      DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
      Assert.assertEquals(6,Ax.columns());
    }
    Set<PairScore> pairsSet = addAllPermutations(gr.pairscores.chooseStatePairs(PAIR_INCOMPATIBLE*2,10,ThreadNumber,null,filter, new NonRandomRandom()));
    Set<PairScore> exp = addAllPermutations(Arrays.asList(new PairScore[]{
        new PairScore(gr.findVertex("A"),gr.findVertex("A"),(int)(10*score_AA),1),
 
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

    Assert.assertArrayEquals(new int[] {0, 2, 5, 9, 10, 12}, s.j_Ap);
    Assert.assertArrayEquals(new int[] {010,   24123,   4214}, s.j_Ai);
    for(int i=0;i<s.j_Ap.length;++i)
      Assert.assertEquals(new double[]{2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.}[i], s.j_Ax[i],Configuration.fpAccuracy);
   
    DoubleMatrix2D mat = s.toDoubleMatrix2D();
    Assert.assertEquals(testMatrix, mat);
  }
 
  @Test
  public final void testMediumSizeSparseMatrix_takes_35sec()
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

   */
  protected void checkBuildMatrix(LearnerGraph gr, DoubleMatrix2D expectedAx, DoubleMatrix1D expectedB)
  {
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, false);
    LSolver solver = ndGraph.buildMatrix(threadNumber);
    DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
    Assert.assertEquals(getExpectedMatrix2DSlowly(gr),Ax);
    if (expectedAx != null) Assert.assertEquals(expectedAx, Ax);
    DoubleMatrix1D b=solver.toDoubleMatrix1D();
    if (expectedB != null) Assert.assertEquals(expectedB, b);Assert.assertEquals(getExpectedMatrix1DSlowly(gr),b);
    solver.solveExternally(1);// check if we have a solution, just in case it fails.
View Full Code Here

Examples of statechum.analysis.learning.rpnicore.LSolver.toDoubleMatrix2D()

    StatesToConsider filter = TestLearnerGraphND.createInstanceOfFilter(filterClass, gr);
    double score_CC=1./2,score_BB=(2+score_CC*k)/4, score_AA=(1+k*score_BB)/2;
    {
      GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreNone, false);
      LSolver solver = ndGraph.buildMatrix(threadNumber);
      DoubleMatrix2D Ax=solver.toDoubleMatrix2D();
      Assert.assertEquals(6,Ax.columns());
    }
    Set<PairScore> pairsSet = addAllPermutations(gr.pairscores.chooseStatePairs(PAIR_INCOMPATIBLE*2,10,threadNumber,null,filter, new NonRandomRandom()));
    Set<PairScore> exp = addAllPermutations(Arrays.asList(new PairScore[]{
        new PairScore(gr.findVertex("A"),gr.findVertex("A"),(int)(10*score_AA),1),
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.