# 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 on Mat


## 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





## 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
 `MATFFTW`, `MatCreateFFT()`, `MatCreateVecs()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/fft/fftw/fftw.c.html#MatCreateVecsFFTW">src/mat/impls/fft/fftw/fftw.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/impls/fft/fftw/fftw.c.html#MatCreateVecsFFTW_FFTW">MatCreateVecsFFTW_FFTW in src/mat/impls/fft/fftw/fftw.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/impls/fft/fftw/fftw.c)


[Index of all Mat routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
