All Downloads are FREE. Search and download functionalities are using the official Maven repository.

JSci.maths.wavelet.haar.FastHaar Maven / Gradle / Ivy

Go to download

JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software. It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ... Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).

The newest version!
package JSci.maths.wavelet.haar;

import JSci.maths.wavelet.FWT;

public class FastHaar extends FWT {

  public FastHaar() {
  }

  static final float[] scale = {(float)(1.0/Math.sqrt(2)),(float)(1.0/Math.sqrt(2))};
  static final float[] wavelet = {-scale[1],scale[0]};

  private static void transform (float[] v,int last) {
    float[] ans=new float[last];
    int half=last/2;
    try {
      for(int k=0;/*k2;last/=2) {
      transform(v,last);
    }
    if(last!=2)
      System.err.println("Careful! this should be a power of 2 : "+v.length);
  }

  public void invTransform(float[] v) {
    int last;
    for (last=2;2*last<=v.length;last*=2) {
      invTransform(v,last);
    }
    if(last!=v.length)
      System.err.println("Careful! this should be a power of 2 : "+v.length);

  }

  /****************************************
  * Standard (Haar) transform
  *****************************************/
  private static void invTransform (float[] v, int last) {
    int ResultingLength=2*last;
    float[] ans=new float[ResultingLength];
    try {
      for(int k=0;/*k




© 2015 - 2024 Weber Informatics LLC | Privacy Policy