torchcurves.functional.rational#
- torchcurves.functional.rational(x, scale=1, out_min=-1, out_max=1)#
Normalize values using the “Legendre Rational Functions” [1] normalization method.
The normalization is performed with the formula
\[x_{\mathrm{norm}} = \frac{x}{\sqrt{\mathrm{scale}^2 + x^2}},\]where scale is a scaling factor.
- Parameters:
x (
Union[Tensor,Sequence[Union[int,float]]]) – Input tensor to be normalized.scale (
float) – Scale factor for normalization. (default=1)out_min (
float) – Lower bound of the output interval (default=-1)out_max (
float) – Upper bound of the output interval (default=1)
- Return type:
Tensor- Returns:
Normalized tensor.
References
[1] Wang, Z.Q. and Guo, B.Y., 2004. Modified Legendre rational spectral method for the whole line. Journal of Computational Mathematics, pp.457-474.