Package com.nr.sp

Examples of com.nr.sp.Daubs


   

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

    Daubs ds4 = new Daubs(4);
    sbeps=2e-15;
    for (i=0;i<N;i++) {
      for (j=0;j<N;j++) a[j]=0.0;
      a[i]=1.0/sqrt(N/2.0);
      wt1(a,-1,ds4);
//      for (j=0;j<N;j++) System.out.printf(setw(8) << a[j] << " ";
//      System.out.printf(endl;
      sum=0;
      for (j=0;j<N;j++) sum += a[j];
//      System.out.printf(sum);
      if (i < 2) localflag = abs(sum-1.0) > sbeps;
      else localflag = abs(sum) > sbeps;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Daubs(4): Sum of wavelet coefficients had unexpected value");
       
      }

      wt1(a,+1,ds4);
//      for (j=0;j<N;j++) System.out.printf(setw(8) << a[j] << " ";
//      System.out.printf(endl;
      for (j=0;j<N;j++) {
        if (j == i) localflag = abs(a[j]-1.0/sqrt(N/2.0)) > sbeps;
        else localflag = abs(a[j]) > sbeps;
        globalflag = globalflag || localflag;
        if (localflag) {
          fail("*** Daubs(4): Round-trip test did not return to original data");
         
        }
      }
    }

    Daubs ds12=new Daubs(12);
    sbeps=1.e-11;
    for (i=0;i<N;i++) {
      for (j=0;j<N;j++) a[j]=0.0;
      a[i]=1.0/sqrt(N/2.0);
      wt1(a,-1,ds12);
//      for (j=0;j<N;j++) System.out.printf(setw(8) << a[j] << " ";
//      System.out.printf(endl;
      sum=0;
      for (j=0;j<N;j++) sum += a[j];
//      System.out.printf(sum);
      if (i < 2) localflag = abs(sum-1.0) > sbeps;
      else localflag = abs(sum) > sbeps;
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Daubs(12): Sum of wavelet coefficients had unexpected value");
       
      }

      wt1(a,+1,ds12);
//      for (j=0;j<N;j++) System.out.printf(setw(8) << a[j] << " ";
//      System.out.printf(endl;
      for (j=0;j<N;j++) {
        if (j == i) localflag = abs(a[j]-1.0/sqrt(N/2.0)) > sbeps;
        else localflag = abs(a[j]) > sbeps;
        globalflag = globalflag || localflag;
        if (localflag) {
          fail("*** Daubs(12): Round-trip test did not return to original data");
         
        }
      }
    }

    Daubs ds20=new Daubs(20);
    sbeps=1.e-11;
    for (i=0;i<N;i++) {
      for (j=0;j<N;j++) a[j]=0.0;
      a[i]=1.0/sqrt(N/2.0);
      wt1(a,-1,ds20);
View Full Code Here

TOP

Related Classes of com.nr.sp.Daubs

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.