|
|
|
(UNDER CONSTRUCTION)
|
|
This library provides a set of functions for computation derivatives using spectral methods. The lib depends on [FFTW](http://www.fftw.org/) library. The library is compatible with W-SLDA Toolkit however, it can be used as standalone lib. It is written in [C99 standard](https://en.wikipedia.org/wiki/C99).
|
|
This library provides a set of functions for computation derivatives using spectral methods. The lib depends on [FFTW](http://www.fftw.org/) library. The library is compatible with W-SLDA Toolkit however, it can be used as standalone lib. It is written in [C99 standard](https://en.wikipedia.org/wiki/C99).
|
|
# Name convention
|
|
# Name convention
|
|
Generic name of a function is `wderiv_operation_Nd_t`, where:
|
|
Generic name of a function is `wderiv_operation_Nd_t`, where:
|
... | @@ -24,17 +25,79 @@ Generic name of a function is `wderiv_operation_Nd_t`, where: |
... | @@ -24,17 +25,79 @@ Generic name of a function is `wderiv_operation_Nd_t`, where: |
|
* `t`:
|
|
* `t`:
|
|
* `r` for real problems
|
|
* `r` for real problems
|
|
* `c` for complex problems
|
|
* `c` for complex problems
|
|
# Sample declarations
|
|
# Function Documentation
|
|
|
|
## 3D derivatives:
|
|
|
|
### Basic 3D derivative function:
|
|
```c
|
|
```c
|
|
/**
|
|
int wderiv_derivative_3d_r(int direction, int n, double *f, double *deriv)
|
|
* Function computes first derivative with respect to x (df/dx)
|
|
```
|
|
* of 3D real function f(x,y,z)
|
|
Function computes n-th derivative with respect to `direction` of 3D real function $`f(x,y,z)`$: $`\frac{\partial^n f}{\partial t^n}`$.
|
|
* @param f pointer to function, array of size [nx*ny*nz] (INPUT)
|
|
* `direction` - predefined integer corresponding to direction of derivative: `WDERIV_DX` or `WDERIV_DY` or `WDERIV_DZ`
|
|
* @param dfdx pointer to function, array of size [nx*ny*nz] (OUTPUT)
|
|
* `f` - pointer to input function which is array of size [nx\*ny\*nz]
|
|
* NOTE: dfdx can be the same pointer as f, then result overwrites input
|
|
* `deriv` - pointer to output derivative function which is array of size [nx\*ny\*nz]
|
|
* @return error code
|
|
* `return` - error code
|
|
* */
|
|
|
|
int wderiv_dfdx_3d_r(double *f, double *dfdx);
|
|
`deriv` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
### First 3D derivative functions:
|
|
|
|
```c
|
|
|
|
int wderiv_dfdx_3d_r(double *f, double *dfdx)
|
|
|
|
```
|
|
|
|
Function computes first derivative with respect to $`x`$ of 3D real function $`f(x,y,z)`$: $`\frac{\partial f}{\partial x}`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx\*ny\*nz]
|
|
|
|
* `dfdx` - pointer to output derivative function which is array of size [nx\*ny\*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`dfdx` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
|
|
|
|
```c
|
|
|
|
int wderiv_dfdy_3d_r(double *f, double *dfdy)
|
|
|
|
```
|
|
|
|
Function computes first derivative with respect to $`y`$ of 3D real function $`f(x,y,z)`$: $`\frac{\partial f}{\partial y}`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx*ny*nz]
|
|
|
|
* `dfdy` - pointer to output derivative function which is array of size [nx*ny*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`dfdy` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
|
|
|
|
```c
|
|
|
|
int wderiv_dfdz_3d_r(double *f, double *dfdz)
|
|
|
|
```
|
|
|
|
Function computes first derivative with respect to $`z`$ of 3D real function $`f(x,y,z)`$: $`\frac{\partial f}{\partial x}`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx*ny*nz]
|
|
|
|
* `dfdz` - pointer to output derivative function which is array of size [nx*ny*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`dfdz` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
### Second 3D derivative functions:
|
|
|
|
```c
|
|
|
|
int wderiv_d2fdx2_3d_r(double *f, double *d2fdx2)
|
|
|
|
```
|
|
|
|
Function computes second derivative with respect to $`x`$ of 3D real function $`f(x,y,z)`$: $`\frac{\partial^2 f}{\partial x^2}`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx\*ny\*nz]
|
|
|
|
* `d2fdx2` - pointer to output derivative function which is array of size [nx\*ny\*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`d2fdx2` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
|
|
|
|
```c
|
|
|
|
int wderiv_d2fdy2_3d_r(double *f, double *d2fdy2)
|
|
|
|
```
|
|
|
|
Function computes second derivative with respect to $`y`$ of 3D real function $`f(x,y,z)`$: $`\frac{\partial^2 f}{\partial y^2}`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx\*ny\*nz]
|
|
|
|
* `d2fdy2` - pointer to output derivative function which is array of size [nx\*ny\*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`d2fdy2` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
|
|
|
|
```c
|
|
|
|
int wderiv_d2fdz2_3d_r(double *f, double *d2fdz2)
|
|
|
|
```
|
|
|
|
Function computes second derivative with respect to $`z`$ of 3D real function $`f(x,y,z)`$: $`(\frac{d^2f}{dz^2})`$.
|
|
|
|
* `f` - pointer to input function which is array of size [nx*ny*nz]
|
|
|
|
* `d2fdz2` - pointer to output derivative function which is array of size [nx*ny*nz]
|
|
|
|
* `return` - error code
|
|
|
|
|
|
|
|
`d2fdz2` can be the same pointer as `f`, then result overwrites input.
|
|
|
|
|
|
/**
|
|
/**
|
|
* Function computes gradient
|
|
* Function computes gradient
|
... | | ... | |