Package com.nr.la

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


    for (i=0;i<n;i++)
      ytemp[i] += k5[i];
    derivs.derivs(xph,ytemp,dydxnew);
    for (i=0;i<n;i++)
      k6[i]=dydxnew[i]+(c61*k1[i]+c62*k2[i]+c63*k3[i]+c64*k4[i]+c65*k5[i])/h;
    alu.solve(k6,yerr);
    for (i=0;i<n;i++)
      yout[i]=ytemp[i]+yerr[i];
  }
 
  public void prepare_dense(final double h,final double[] dydxnew) {
View Full Code Here


    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]);
    }
  }
View Full Code Here

        omk[i][j]=((i == j) ? 1 : 0)-ak(t[i],t[j])*w[j];
      }
      f[i]=g(t[i]);
    }
    LUdcmp alu = new LUdcmp(omk);
    alu.solve(f,f);
  }

  public double fredin(final double x) {
    double sum=0.0;
    for (int i=0;i<n;i++) sum += ak(x,t[i])*w[i]*f[i];
 
View Full Code Here

            a[k][l] = -0.5 * h * ak(k, l, t[i], t[i]);
        }
        b[k] = sum;
      }
      LUdcmp alu = new LUdcmp(a);
      alu.solve(b, b);
      for (int k = 0; k < m; k++)
        f[k][i] = b[k];
    }
  }
}
View Full Code Here

      for (imj = -mm;imj<=mm;imj+=2) a[(ipj+imj)/2][(ipj-imj)/2]=sum;
    }
    LUdcmp alud = new LUdcmp(a);
    for (j=0;j<m+1;j++) b[j]=0.0;
    b[ld]=1.0;
    alud.solve(b,b);
    for (kk=0;kk<np;kk++) c[kk]=0.0;
    for (k = -nl;k<=nr;k++) {
      sum=b[0];
      fac=1.0;
      for (mm=1;mm<=m;mm++) sum += b[mm]*(fac *= k);
View Full Code Here

    // Test ludcmp
    System.out.println("Testing ludcmp");
    LUdcmp alu = new LUdcmp(a);
    double[][] x = new double[b.length][b[0].length];
    alu.solve(b,x);
    sbeps=5.e-15;
    double maxel = maxel(matsub(matmul(a,x),b));
    localflag = maxel > sbeps;
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

    // 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");
View Full Code Here

    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

      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

      }
      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

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.