26    public static class fftwComplex{
 
   28        public int s = 0, 
w = 0, 
h = 0;
 
   32            native = alloc_complex(size);
 
 
   38            dat.fill(complex[0], complex[1]);
 
 
   46            native = alloc_complex(
w * 
h);
 
 
   51            double[][] fo = nilptr;
 
   60            fo = 
new double[2][len];
 
   61            extract_complex_double2(native, 0, len, 0, fo[0], fo[1]);
 
 
   66        public void fill(
double [] rd, 
double []
id){
 
   75                fill_complex_double2(native, 0, len, 0, rd, 
id);
 
   77                fill_complex_double(native, 0, len, 0, rd);
 
 
   82        public void fill(
double [][] rd, 
double [][] 
id){
 
   83            int row = rd[0].length;
 
   86                for (
int i = 0; i < rd.length; i++){
 
   87                    fill_complex_double2(native, i*row, s, 0, rd[i], 
id[i]);
 
   90                for (
int i = 0; i < rd.length; i++){
 
   91                    fill_complex_double(native, i*row, s, 0, rd[i]);
 
 
 
  104    public static fftwComplex 
fft2d(fftwComplex in){
 
  105        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
 
  115    public static fftwComplex 
ifft2d(fftwComplex in){
 
  116        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
 
  126    public static fftwComplex 
fft2d(
double [][] rd, 
double [][] 
id){
 
  127        if (
id != nilptr && 
id.length != rd.length){
 
  132        fftwComplex in = 
new fftwComplex(rd.length, rd[0].length);
 
  135        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
 
  146    public static fftwComplex 
ifft2d(
double [][] rd, 
double [][] 
id){
 
  147        if (
id != nilptr && 
id.length != rd.length){
 
  152        fftwComplex in = 
new fftwComplex(rd.length, rd[0].length);
 
  155        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
 
  166    public static double[][] 
fft2(
int n0, 
int n1, 
double [] rd, 
double [] 
id){
 
  167        if (rd.length != (n0 * n1)){
 
  172        if (
id != nilptr && 
id.length != rd.length){
 
  177        fftwComplex in = 
new fftwComplex(n0, n1);
 
  180        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
  190        return out.extract();
 
 
  193    public static double[][] 
ifft2(
int n0, 
int n1,
double [] rd, 
double [] 
id){
 
  194        if (rd.length != (n0 * n1)){
 
  199        if (
id != nilptr && 
id.length != rd.length){
 
  204        fftwComplex in = 
new fftwComplex(n0, n1);
 
  207        fftwComplex out = 
new fftwComplex(in.w, in.h);
 
  215        return out.extract();
 
 
  218    public static double[][] 
fft(
double [] rd, 
double [] 
id){        
 
  219        if (
id != nilptr && 
id.length != rd.length){
 
  224        fftwComplex in = 
new fftwComplex(rd.length);
 
  227        fftwComplex out = 
new fftwComplex(rd.length);
 
  235        return out.extract();
 
 
  238    public static double[][] 
ifft(
double [] rd, 
double [] 
id){
 
  239        if (
id != nilptr && 
id.length != rd.length){
 
  244        fftwComplex in = 
new fftwComplex(rd.length);
 
  247        fftwComplex out = 
new fftwComplex(rd.length);
 
  255        return out.extract();
 
 
  258    public static double[][] 
fftr2c(
double [] rd, 
double [] 
id){        
 
  259        if (
id != nilptr && 
id.length != rd.length){
 
  264        fftwComplex in = 
new fftwComplex(rd.length);
 
  267        fftwComplex out = 
new fftwComplex(rd.length);
 
  275        return out.extract();
 
 
  278    public static double[][] 
ifftc2r(
double [] rd, 
double [] 
id){
 
  279        if (
id != nilptr && 
id.length != rd.length){
 
  284        fftwComplex in = 
new fftwComplex(rd.length);
 
  287        fftwComplex out = 
new fftwComplex(rd.length);
 
  295        return out.extract();
 
 
  299        Pointer cdecl alloc_complex(
int size);
 
 
 static  fftwComplex from_complex(double[][] complex)
void fill(double [][] rd, double [][] id)
fftwComplex(int width, int height)
void fill(double [] rd, double []id)
 static  fftwComplex fft2d(double [][] rd, double [][] id)
 static  double [][] ifft(double [] rd, double [] id)
Pointer cdecl create_fftw_plan_dft_3d(int n0, int n1, int n2, Pointer in, Pointer out, int sign, int flag)
 static  double [][] ifftc2r(double [] rd, double [] id)
void cdecl extract_complex_double(Pointer p,int offset, int size, int eoffset, ObjectPtr rnp)
 static  fftwComplex ifft2d(fftwComplex in)
Pointer cdecl create_fftw_plan_c2r_3d(int n0, int n1, int n2, Pointer in, ObjectPtr out, int sign, int flag)
void cdecl extract_complex_double2(Pointer p,int offset, int size, int eoffset, ObjectPtr rnp, ObjectPtr inp)
 static  double [][] fftr2c(double [] rd, double [] id)
void cdecl free_plan(Pointer p)
 static  double [][] ifft2(int n0, int n1,double [] rd, double [] id)
double cdecl get_complex_double(Pointer p, int index, bool bi)
void cdecl execute_fftw(Pointer p)
 static  fftwComplex ifft2d(double [][] rd, double [][] id)
Pointer cdecl create_fftw_plan_c2r_2d(int n0, int n1, Pointer in, ObjectPtr out, int sign, int flag)
 static  fftwComplex fft2d(fftwComplex in)
Pointer cdecl create_fftw_plan_r2c_2d(int n0, int n1, ObjectPtr in, Pointer out, int sign, int flag)
void cdecl free_complex(Pointer p)
void cdecl fill_complex_double(Pointer p,int offset, int size, int eoffset, ObjectPtr rnp)
Pointer cdecl create_fftw_plan_c2r_1d(int n, Pointer in, ObjectPtr out, int sign, int flag)
 static  double [][] fft2(int n0, int n1, double [] rd, double [] id)
 static  double [][] fft(double [] rd, double [] id)
Pointer cdecl create_fftw_plan_r2c_1d(int n, ObjectPtr in, Pointer out, int sign, int flag)
Pointer cdecl create_fftw_plan_dft_2d(int n0, int n1, Pointer in, Pointer out, int sign, int flag)
void cdecl fill_complex_double2(Pointer p,int offset, int size, int eoffset, ObjectPtr rnp, ObjectPtr inp)
Pointer cdecl create_fftw_plan_r2c_3d(int n0, int n1, int n2, ObjectPtr in, Pointer out, int sign, int flag)
Pointer cdecl create_fftw_plan_dft_1d(int n, Pointer in, Pointer out, int sign, int flag)