Examples of LUdcmp


Examples of com.nr.la.LUdcmp

    // Test mprove
    System.out.println("Testing mprove");

    ranvec(r);
    LUdcmp alu = new LUdcmp(a);
    alu.solve(r,y);
    for (i=0;i<y.length;i++) y[i] += 0.005*(2.*ran.doub()-1.);
    localflag = maxel(vecsub(r,matmul(a,y))) < 0.001;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** mprove: Noisy vector too close to solution");
     
    }

    alu.mprove(r,y);
    sbeps = 5.e-15;
    localflag = maxel(vecsub(r,matmul(a,y))) > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** mprove: Attempt to recover accurate solution failed");
View Full Code Here

Examples of com.nr.la.LUdcmp

  {
    final int N=40;
    double[] g=new double[N];
    double[][] a=new double[N][N];
    new Quad_matrix(a);
    LUdcmp alu = new LUdcmp(a);
    for (int j=0;j<N;j++)
      g[j]=sin(j*PI/(N-1));
    alu.solve(g,g);
    for (int j=0;j<N;j++) {
      double x=j*PI/(N-1);
      System.out.printf("%d  %f  %f\n",(j+1), x, g[j]);
    }
    return 0;
View Full Code Here

Examples of com.nr.la.LUdcmp

      funk(x,fvec,fjac);
      double errf=0.0;
      for (i=0;i<n;i++) errf += abs(fvec[i]);
      if (errf <= tolf) return;
      for (i=0;i<n;i++) p[i] = -fvec[i];
      LUdcmp alu = new LUdcmp(fjac);
      alu.solve(p,p);
      double errx=0.0;
      for (i=0;i<n;i++) {
        errx += abs(p[i]);
        x[i] += p[i];
      }
View Full Code Here

Examples of com.nr.la.LUdcmp

        g[i]=sum;
      }
      for (i=0;i<n;i++) xold[i]=x[i];
      fold=f.val;
      for (i=0;i<n;i++) p[i] = -fvec[i];
      LUdcmp alu = new LUdcmp(fjac);
      alu.solve(p,p);
      lnsrch(xold,fold,g,p,x,f,stpmax,check,fmin);
      test=0.0;
      for (i=0;i<n;i++)
        if (abs(fvec[i]) > test) test=abs(fvec[i]);
      if (test < TOLF) {
View Full Code Here

Examples of com.nr.la.LUdcmp

    //double[] a = new double[]{1.0, 2.0,2.0,4.0, -4.0, -3.0, 2.0, 4.0,5.0};
    double[]a = new double[]{0.666667, 0.166667, -0.166667,
        2.16667, -0.0833333, -0.916667,
        -2.00000, 0.00000, 1.00000};
    double[][] aa = NRUtil.buildMatrix(3,3, a);
    LUdcmp lud = new LUdcmp(aa);
    double[][] inv = lud.inverse();
    System.out.println(NRUtil.toString(inv));
  }
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.