Package com.nr.min

Examples of com.nr.min.Amoeba


    Func_Amoeba Func_Amoeba= new Func_Amoeba();
    Bessj1_Amoeba Bessj1_Amoeba = new Bessj1_Amoeba();

    // Test Amoeba
    System.out.println("Testing Amoeba, interface1");
    Amoeba amb1=new Amoeba(tol);
    for (i=0;i<N;i++) {
      point[0]=point[1]=(2*i);
      min=amb1.minimize(point,del,Func_Amoeba);
      sbeps=sqrt(tol);
      localflag = localflag || (abs(-Bessj1_Amoeba.funk(min[0])) > sbeps)
          || (abs(2*min[1]) > sbeps);
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Amoeba, interface1: Gradient not zero at one of the identified minima");
     
    }

    System.out.println("Testing Amoeba, interface2");
    Amoeba amb2 = new Amoeba(tol);
    double[] dels=new double[M];
    dels[0]=del;
    dels[1]=0.5*del;
    for (i=0;i<N;i++) {
      point[0]=point[1]=(2*i);
      min=amb2.minimize(point,dels,Func_Amoeba);
      sbeps=sqrt(tol);
      localflag = localflag || (abs(-Bessj1_Amoeba.funk(min[0])) > sbeps)
          || (abs(2*min[1]) > sbeps);
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Amoeba, interface2: Gradient not zero at one of the identified minima");
     
    }

    System.out.println("Testing Amoeba, interface3");
    Amoeba amb3 = new Amoeba(tol);
    double[][] pp = new double[3][2];
    for (i=0;i<N;i++) {
      pp[0][0]=(2*i);
      pp[0][1]=(2*i);
      pp[1][0]=pp[0][0]+del;
      pp[1][1]=pp[0][1];
      pp[2][0]=pp[0][0];
      pp[2][1]=pp[0][1]+0.5*del;
      min=amb3.minimize(pp,Func_Amoeba);
      localflag = localflag || (abs(-Bessj1_Amoeba.funk(min[0])) > sbeps)
          || (abs(2*min[1]) > sbeps);
    }
    globalflag = globalflag || localflag;
    if (localflag) {
View Full Code Here

TOP

Related Classes of com.nr.min.Amoeba

Copyright © 2018 www.massapicom. 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.