RBF Factory¶
Factory class for radial basis functions
- class RBFFactory(fname)[source]
Bases:
object
Factory class that spawns the radial basis functions.
- Example
>>> from pygem import RBFFactory >>> import numpy as np >>> x = np.linspace(0, 1) >>> for fname in RBFFactory.bases: >>> y = RBFFactory(fname)(x)
- static gaussian_spline(X, r=1)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = e^{-\frac{\boldsymbol{x}^2}{r^2}}
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
- Returns
result: the result of the formula above.
- Return type
- static multi_quadratic_biharmonic_spline(X, r=1)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = \sqrt{\boldsymbol{x}^2 + r^2}
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
- Returns
result: the result of the formula above.
- Return type
- static inv_multi_quadratic_biharmonic_spline(X, r=1)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = (\boldsymbol{x}^2 + r^2 )^{-\frac{1}{2}}
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
- Returns
result: the result of the formula above.
- Return type
- static thin_plate_spline(X, r=1, k=2)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = \left(\frac{\boldsymbol{x}}{r}\right)^k \ln\frac{\boldsymbol{x}}{r} With k=2 the function is "radius free", that means independent of radius value.
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
k (float) – the parameter k in the formula above.
- Returns
result: the result of the formula above.
- Return type
- static beckert_wendland_c2_basis(X, r=1)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = \left( 1 - \frac{\boldsymbol{x}}{r}\right)^4 + \left( 4 \frac{ \boldsymbol{x} }{r} + 1 \right)
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
- Returns
result: the result of the formula above.
- Return type
- static polyharmonic_spline(X, r=1, k=2)[source]
It implements the following formula:
\varphi(\boldsymbol{x}) = \begin{cases} \frac{\boldsymbol{x}}{r}^k \quad & \text{if}~k = 1,3,5,...\\ \frac{\boldsymbol{x}}{r}^{k-1} \ln(\frac{\boldsymbol{x}}{r}^ {\frac{\boldsymbol{x}}{r}}) \quad & \text{if}~\frac{\boldsymbol{x}}{r} < 1, ~k = 2,4,6,...\\ \frac{\boldsymbol{x}}{r}^k \ln(\frac{\boldsymbol{x}}{r}) \quad & \text{if}~\frac{\boldsymbol{x}}{r} \ge 1, ~k = 2,4,6,...\\ \end{cases}
- Parameters
X (numpy.ndarray) – the norm x in the formula above.
r (float) – the parameter r in the formula above.
- Returns
result: the result of the formula above.
- Return type