MatCreateVecsFFTW#
Get vector(s) compatible with the matrix, i.e. with the parallel layout determined by MATFFTW
Synopsis#
#include "petscmat.h"
#include "petscvec.h"
PetscErrorCode MatCreateVecsFFTW(Mat A, Vec *x, Vec *y, Vec *z)
Collective
Input Parameter#
A - the matrix
Output Parameters#
x - (optional) input vector of forward FFTW
y - (optional) output vector of forward FFTW
z - (optional) output vector of backward FFTW
Options Database Key#
-mat_fftw_plannerflags - set FFTW planner flags
Notes#
The parallel layout of output of forward FFTW is always same as the input of the backward FFTW. But parallel layout of the input vector of forward FFTW might not be same as the output of backward FFTW.
We need to provide enough space while doing parallel real transform. We need to pad extra zeros at the end of last dimension. For this reason the one needs to invoke the routine fftw_mpi_local_size_transposed routines. Remember one has to change the last dimension from n to n/2+1 while invoking this routine. The number of zeros to be padded depends on if the last dimension is even or odd. If the last dimension is even need to pad two zeros if it is odd only one zero is needed.
Lastly one needs some scratch space at the end of data set in each process. alloc_local figures out how much space is needed, i.e. it figures out the data+scratch space for each processor and returns that.
Developer Note#
How come MatCreateVecs()
doesn’t produce the correctly padded vectors automatically?
See Also#
Matrices, Mat
, MATFFTW
, MatCreateFFT()
, MatCreateVecs()
Level#
advanced
Location#
Implementations#
MatCreateVecsFFTW_FFTW in src/mat/impls/fft/fftw/fftw.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages