
#include "fft/fft-default.h"
#include "bits/bit2pow.h" // ld()
#include "fxttypes.h"  // ulong


void
row_ffts(double *fr, double *fi, ulong nr, ulong nc, int is)
//
// nr x nc matrix (nr rows of length nc)
//
{
    ulong ldc = ld(nc);
    double *pr = fr,  *pi = fi;
    for (ulong k=0; k<nr; ++k)
    {
        fft(pr, pi, ldc, is);  // note: cache problem !

        pr += nc;
        pi += nc;
    }
}
// -------------------------


void
row_weighted_ffts(double *fr, double *fi, ulong nr, ulong nc, int is)
//
// nr x nc matrix (nr rows of length nc)
//
{
    ulong ldc = ld(nc);
    double *pr = fr,  *pi = fi;
    for (ulong k=0; k<nr; ++k)
    {
        fourier_shift(pr, pi, nc, 1.0*is*k/nr);  // note: cache problem !
        fft(pr, pi, ldc, is);  // note: cache problem !

        pr += nc;
        pi += nc;
    }
}
// -------------------------


void
row_ffts(Complex *f, ulong nr, ulong nc, int is)
//
// nr x nc matrix (nr rows of length nc)
//
{
    ulong ldc = ld(nc);
    Complex *p = f;
    for (ulong k=0; k<nr; ++k)
    {
        fft(p, ldc, is);
        p += nc;
    }
}
// -------------------------


void
row_weighted_ffts(Complex *f, ulong nr, ulong nc, int is)
//
// nr x nc matrix (nr rows of length nc)
//
{
    ulong ldc = ld(nc);
    Complex *p = f;
    for (ulong k=0; k<nr; ++k)
    {
        fourier_shift(p, nc, 1.0*is*k/nr);
        fft(p, ldc, is);
        p += nc;
    }
}
// -------------------------

