Applying 1d-FFT over each row in PETSc-matrix

150 views Asked by At

I have a PETSc-matrix, and would like to apply a 1d-FFT on each row of that matrix, preferably while keeping the possibility having the matrix distributed over several nodes. Based on the documentation and examples (such as here: https://www.mcs.anl.gov/petsc/petsc-current/src/mat/tests/ex143.c.html) I have to create an FFT-object ("FFT-matrix") and use this object then to create/initialize the vectors used for the FFT itself:

MatCreateFFT(PETSC_COMM_WORLD,DIM,dim,MATFFTW,&A);//Create FFT object
MatCreateVecsFFTW(A,&x,&y,&z); //Initialize Vectors
MatMult(A,x,y); //Apply FFT

Nevertheless, as far as I can see this only will execute a 1d-FFT over a vector, and not a 1d-FFT over each row in my matrix. Of course, I can just iterate over the rows in my matrix and copy them into the vector (and retrieve the result afterwards), but that would slow the process down quite a bit. Or do I have to resort to FFTW without using the interface from PETSc (as described in the same example as above) if I would like to execute the process described above?

1

There are 1 answers

0
Matt Knepley On

You should be able to call MatDenseGetColumnVec and then feed that to your FFT.