tenzr::scipy::special¶
Functions¶
| Name | |
|---|---|
| TENZR_APIArray | Erf(const Array & x) |
| TENZR_APIArray | Erfc(const Array & x) |
| TENZR_APIArray | Gamma(const Array & x) |
| TENZR_APIArray | Gammaln(const Array & x) |
| TENZR_APIArray | Logit(const Array & x) |
| TENZR_APIArray | Expit(const Array & x) |
| TENZR_APIArray | Logsumexp(const Array & x, std::optional< std::vector< int64_t > > axis =std::nullopt, bool keepdims =false) |
| TENZR_APIArray | softmax(const Array & x, int64_t axis =-1) |
Detailed Description¶
High-level scientific and numerical computing ecosystem (tenzr::scipy / tsp). Modeled after SciPy / JAX SciPy: - tenzr::scipy::special: special functions (erf, erfc, logit, expit, logsumexp, softmax, gamma, gammaln) - tenzr::scipy::linalg: linear algebra routines (det, inv, solve, cholesky) - tenzr::scipy::optimize: gradient optimizers (minimize_cg, minimize_bfgs) leveraging autodiff
Functions Documentation¶
function Erf¶
Parameters:
- x The input array.
- x Input array.
Return:
- The error function values.
- erf(x).
Computes the Gauss error function elementwise. Elementwise error function via the Abramowitz & Stegun 7.1.26 approximation.
function Erfc¶
Parameters:
- x The input array.
- x Input array.
Return:
- The complementary error function values.
- 1 - erf(x).
Computes the complementary error function elementwise. Elementwise complementary error function.
function Gamma¶
Parameters:
- x The input array.
- x Input array.
Return:
- The gamma function values.
- gamma(x).
Computes the gamma function elementwise. Elementwise gamma function.
function Gammaln¶
Parameters:
- x The input array.
- x Input array.
Return:
- The log-gamma values.
- lgamma(x).
Computes the natural log of the absolute gamma function elementwise. Elementwise log-gamma via a Stirling/Ramanujan asymptotic expansion.
function Logit¶
Parameters:
- x The input array with values in (0, 1).
- x Input array with values in (0, 1).
Return:
- The log-odds values.
- log(x / (1 - x)).
Computes the logit function elementwise. Elementwise inverse logistic function.
function Expit¶
Parameters:
- x The input array.
- x Input array.
Return:
- The sigmoid values.
- 1 / (1 + exp(-x)).
Computes the logistic sigmoid function elementwise. Elementwise logistic sigmoid.
function Logsumexp¶
TENZR_APIArray Logsumexp(
const Array & x,
std::optional< std::vector< int64_t > > axis =std::nullopt,
bool keepdims =false
)
Parameters:
- x The input array.
- axis Axes to reduce, or all axes when unset.
- keepdims Whether to retain reduced dimensions as size 1.
- x Input array.
- axis Optional reduction axes.
- keepdims Whether reduced axes are retained.
Return:
- The reduced result.
- log(sum(exp(x))).
Computes the log-sum-exp reduction with numerical stabilization. Numerically stable log of the sum of exponentials.
function softmax¶
Parameters:
- x The input array.
- axis The axis to normalize over.
- x Input array.
- axis Reduction axis.
Return:
- The softmax probabilities.
- Softmax-normalized array.
Computes a numerically stable softmax along axis. Numerically stable softmax along axis.