Fork me on GitHub

Usage

Numerics Dependency

Specify Numerics in the list of Dependencies in your pom.xml

<dependencies>
  <dependency>
    <groupId>edu.uiowa.eng.ffx</groupId>
    <artifactId>ffx-numerics</artifactId>
    <version>${project.version}</version>
    <type>jar</type>
  </dependency>
</dependencies>

Erf Example

Shown below is an example of using the ffx.numerics Erf class.

import static ffx.numerics.special.Erf.erf;
...
double x = 2.0;
double erfx = erf(x);

FFT Example

Shown below is an example of using the ffx.numerics.fft package Complex class.

import java.util.Random;
import ffx.numerics.fft.Complex;
...
int n = 256;
double data[] = new double[n * 2];
Random r = new Random();
for (int i = 0; i < n; i++) {
    double d = r.nextDouble();
    data[i * 2] = d;
}
int offset = 0;
int stride = 2;
Complex complex = new Complex(n);
complex.fft(data, offset, stride);
complex.inverse(data, offset, stride);