Skip to main content

Module fallback

Module fallback 

Source
Expand description

Fallback implementations when SciRS2 is not available

These are used (via the #[cfg(not(feature = "scirs2"))] call sites in reconstruction/linear_inversion.rs and friends) only when the crate is built with --no-default-features (i.e. without scirs2-linalg). Every matrix operation below is a real, dimension-correct (if numerically naive) implementation rather than a fixed-size placeholder, so a no-scirs2 build computes with the actual input shape instead of silently substituting a hardcoded 2x2 result. The handful of decompositions that are genuinely impractical to hand-roll correctly (full eigenvalue decomposition, SVD) honestly return Err instead.

Modules§

distributions
Distribution types and functions
graph
Graph analysis fallback functions

Structs§

KSTestResult
Kolmogorov-Smirnov test result structure
OptimizeResult
Fallback optimization result
SWTestResult
Shapiro-Wilk test result structure
TTestResult
T-test result structure

Enums§

Alternative
Alternative hypothesis type

Functions§

cholesky
Real Cholesky decomposition (lower-triangular L such that L L^T = matrix). Works for any square NxN symmetric positive-definite matrix (not just 2x2); returns an honest error if the matrix is not positive-definite.
corrcoef
Real 2x2 Pearson correlation matrix for two equal-length samples x/y (a pairwise correlation matrix for two variables is always 2x2, so unlike inv/qr/etc. the size here was never the issue – the value was; this now computes the actual correlation instead of a fixed identity matrix).
det
Real matrix determinant via LU decomposition with partial pivoting. Works for any square NxN matrix (not just 2x2).
eig
Full eigenvalue decomposition is not implemented in this no-SciRS2 fallback (a numerically stable general eigensolver – e.g. the shifted-QR algorithm with deflation – is well beyond a “naive” reimplementation); honestly report the limitation rather than return a fixed, wrong-sized identity-like result.
inv
Real matrix inversion via Gauss-Jordan elimination with partial pivoting. Works for any square NxN matrix (not just 2x2); returns an honest error for non-square or singular/near-singular input.
ks_2samp
Fallback Kolmogorov-Smirnov 2-sample test
matrix_norm
Fallback matrix norm calculation: the Frobenius norm, computed from the actual matrix entries (not a fixed constant). Only the Frobenius norm is supported here – spectral/nuclear norms would require SVD, which this no-scirs2 fallback does not implement.
mean
Fallback statistical mean calculation
minimize
Fallback optimization function
pearsonr
Fallback Pearson correlation calculation
qr
Real QR decomposition via modified Gram-Schmidt orthogonalization. Works for any MxN matrix (not just 2x2).
shapiro_wilk
Fallback Shapiro-Wilk test
spearmanr
Fallback Spearman correlation calculation
std
Fallback standard deviation calculation
svd
Singular value decomposition is not implemented in this no-SciRS2 fallback (a numerically stable general SVD – e.g. Golub-Kahan bidiagonalization followed by an implicit-shift QR sweep – is well beyond a “naive” reimplementation); honestly report the limitation rather than return a fixed, wrong-sized identity-like result.
trace
Real matrix trace: sum of the diagonal entries (dimension-correct for any min(rows, cols)-length diagonal, not just 2x2).
ttest_1samp
Fallback t-test (one sample)
ttest_ind
Fallback t-test (independent samples)
var
Fallback variance calculation