TDMS
Time Domain Maxwell Solver
|
Functions to calculate the numerical derivatives. More...
#include <fftw3.h>
Go to the source code of this file.
Functions | |
void | complex_mult_vec (fftw_complex *a, fftw_complex *b, fftw_complex *c, int len) |
Multiply two arrays of complex numbers element-wise. | |
void | init_diff_shift_op (double delta, fftw_complex *Dk, int N) |
Initialise the coefficients required to simultaneously perform differentiation and shifting by amount delta, using a forward and backward FFT. | |
void | first_derivative (fftw_complex *in_pb_pf, fftw_complex *out_pb_pf, fftw_complex *Dk, int N, fftw_plan pf, fftw_plan pb) |
Calculate the first derivative of a sampled function. | |
Functions to calculate the numerical derivatives.
This code is the main dependency on FFTW3.
void complex_mult_vec | ( | fftw_complex * | a, |
fftw_complex * | b, | ||
fftw_complex * | c, | ||
int | len | ||
) |
Multiply two arrays of complex numbers element-wise.
Performs element-wise complex multiplication of the array a with the array b. a and b must be must be of equal length. Stores the result in c. Internally used by first_derivative.
[in] | a | Array of complex numbers to multiply with those in b. |
[in] | b | Array of complex numbers to multiply with those in a. |
[out] | c | The results of the element-wise multiplications a .* b. |
[in] | len | The length of the arrays. |
void first_derivative | ( | fftw_complex * | in_pb_pf, |
fftw_complex * | out_pb_pf, | ||
fftw_complex * | Dk, | ||
int | N, | ||
fftw_plan | pf, | ||
fftw_plan | pb | ||
) |
Calculate the first derivative of a sampled function.
[in] | in_pb_pf | The buffer containing the data to be differentiated. |
[out] | out_pb_pf | The buffer which will contain the computed derivative. |
[in,out] | Dk | Buffer to write the coefficients for performing differentiation and shifting in Fourier space. |
[in] | N | Number of elements in buffers. |
[in] | pf | The plan for forward FFT. |
[in] | pb | The plan for backward FFT. |
void init_diff_shift_op | ( | double | delta, |
fftw_complex * | Dk, | ||
int | N | ||
) |
Initialise the coefficients required to simultaneously perform differentiation and shifting by amount delta, using a forward and backward FFT.
[in] | delta | The fraction of the spatial step. |
[out] | Dk | Buffer to write the coefficients to. |
[in] | N | The number of elements in Dk. |