Examples of solve()


Examples of com.nr.interp.Laplace_interp.solve()

      q=myran.int32p()%M;
      mat[p][q]=1.e99;
    }
    System.out.printf("     Initial discrepancy: %g\n", maxel(matsub(actual,mat)));
    Laplace_interp mylaplace = new Laplace_interp(mat);
    mylaplace.solve();
    System.out.printf("     Final discrepancy: %g\n", maxel(matsub(actual,mat)));
    localflag = maxel(matsub(actual,mat)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Laplace_interp: Inaccurate Laplace interpolation of missing matrix data.");
View Full Code Here

Examples of com.nr.la.Bandec.solve()

    System.out.println("Testing bandec and banmul");
    double[][] c = new double[50][17];
    ranmat(c);
    Bandec clu = new Bandec(c,9,7);
    ranvec(r);
    clu.solve(r,y);
    Bandec.banmul(c,9,7,y,rr);
    sbeps = 5.e15;
    localflag = maxel(vecsub(r,rr)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

Examples of com.nr.la.Cholesky.solve()

    // Test cholesky
    System.out.println("Testing cholesky");
    double[][] aposdef = matmul(a,transpose(a));
    Cholesky ach  = new Cholesky(aposdef);
    ach.solve(r,y);
    sbeps = 5.e-15;
    localflag = maxel(vecsub(matmul(aposdef,y),r)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** cholesky: Error in solve() method");
View Full Code Here

Examples of com.nr.la.LUdcmp.solve()

      }
      if (norm) rhs[i] = sum*vals[i];
      else rhs[i] = vals[i];
    }
    LUdcmp lu = new LUdcmp(rbf);   // Solve the set of linear equations
    lu.solve(rhs,w);
  }

  /**
   * Return the interpolated function value at a dim-dimensional point pt.
   *
 
View Full Code Here

Examples of com.nr.la.QRdcmp.solve()

      fail("*** QRdcmp: Matrix aqr.qt is not orthogonal");
     
    }

    ranvec(r);
    aqr.solve(r,y);
    localflag = maxel(vecsub(matmul(a,y),r)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** QRdcmp: Error in solve() method");
     
View Full Code Here

Examples of com.nr.la.SVD.solve()

    // Test SVD (not very deeply, however)
    System.out.println("Testing SVD");
    SVD svd = new SVD(a);
    double[][] x = new double[b.length][b[0].length];
    svd.solve(b,x);
    sbeps = 1.e-14;
    localflag = maxel(matsub(matmul(a,x),b)) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** SVD: Inconsistent solution vector");
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.ConvectionDiffusionPDESolver.solve()

    }
    final MeshingFunction timeMesh = new ExponentialMeshing(0.0, maxT, nTimeSteps, timeMeshLambda);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(minMoneyness, maxMoneyness, centreMoneyness, nStrikeSteps, strikeMeshBunching);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    final Function1D<Double, Double> initialCond = (new InitialConditionsProvider()).getForwardCallPut(isCall);
    final PDEFullResults1D res = (PDEFullResults1D) solver.solve(new PDE1DDataBundle<>(pde, initialCond, lower, upper, grid));
    return res;
  }
}
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.CoupledFiniteDifference.solve()

    final CoupledPDEDataBundle d1 = new CoupledPDEDataBundle(_data[0], _initalCond1, lower1, upper, grid);
    final CoupledPDEDataBundle d2 = new CoupledPDEDataBundle(_data[1], _initalCond2, lower2, upper, grid);

    final CoupledFiniteDifference solver = new CoupledFiniteDifference(theta, true);
    final PDEResults1D[] res = solver.solve(d1, d2);
    final PDEFullResults1D res1 = (PDEFullResults1D) res[0];
    final PDEFullResults1D res2 = (PDEFullResults1D) res[1];

    final double[][] prices = new double[grid.getNumTimeNodes()][grid.getNumSpaceNodes()];
    for (int i = 0; i < grid.getNumTimeNodes(); i++) {
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.ExtendedCoupledFiniteDifference.solve()

    //BoundaryCondition lower = new DirichletBoundaryCondition(0.0, 0.0);//TODO for beta < 0.5 zero is accessible and thus there will be non-zero
    //density there
    final BoundaryCondition upper = new DirichletBoundaryCondition(0.0, grid.getSpaceNode(grid.getNumSpaceNodes() - 1));

    final ExtendedCoupledFiniteDifference solver = new ExtendedCoupledFiniteDifference(THETA);
    final PDEResults1D[] res = solver.solve(_data1, _data2, grid, lower, upper, lower, upper, null);
    //handle this with generics
    final PDEFullResults1D res1 = (PDEFullResults1D) res[0];
    final PDEFullResults1D res2 = (PDEFullResults1D) res[1];
    return new PDEFullResults1D[] {res1, res2 };
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.model.finitedifference.ThetaMethodFiniteDifference.solve()

    }
    final MeshingFunction timeMesh = new ExponentialMeshing(0.0, maxT, nTimeSteps, timeMeshLambda);
    final MeshingFunction spaceMesh = new HyperbolicMeshing(minMoneyness, maxMoneyness, centreMoneyness, nStrikeSteps, strikeMeshBunching);
    final PDEGrid1D grid = new PDEGrid1D(timeMesh, spaceMesh);
    final Function1D<Double, Double> initialCond = (new InitialConditionsProvider()).getForwardCallPut(isCall);
    final PDEFullResults1D res = (PDEFullResults1D) solver.solve(new PDE1DDataBundle<>(pde, initialCond, lower, upper, grid));
    return res;
  }
}
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.