one-indexed-vec
A scientific computing library with 1-based indexing — matching mathematical notation.
Overview
one-indexed-vec provides [Vec1<T>], a Vec-like container whose first
element lives at index 1. This matches the indexing conventions of
mathematics, Fortran, MATLAB, Julia, and most scientific literature — no
more off-by-one bugs when translating formulas to code.
Beyond the container, the library ships a growing collection of scientific algorithms organized by discipline:
| Module | Feature | Contents |
|---|---|---|
vec1_core |
always | The 1-based container, Index1, basic numeric ops |
math |
math |
Sequences, series, Fourier analysis, orthogonal polynomials, FFT |
numerical |
numerical |
Integration, ODEs, root finding, optimization, sliding windows |
linear |
linear |
Matrices, LU/QR/Cholesky, eigenvalues, linear solvers |
signal |
signal |
FIR/IIR filters, window functions, correlation |
stats |
stats |
Descriptive statistics, regression, distributions |
physics |
physics |
Quantum mechanics, thermodynamics, optics |
chemistry |
chemistry |
Atomic data, kinetics, thermodynamics |
Installation
[]
= "0.2"
[]
= { = "0.2", = false, = ["std", "numerical"] }
{Vec1, vec1};
= vec1![1.0, 2.0, 3.0, 4.0, 5.0];
// 1-based indexing
v[1], 1.0);
v[5], 5.0);
// Basic numeric operations
v.sum(), 15.0);
v.mean(), 3.0);
// Prefix sum
= v.prefix_sum();
ps[3], 6.0);
Enable std; without it the crate is no_std
Sequences, series, orthogonal polynomials, FFT
Numeric algorithms, integration, ODEs, root finding
Matrices, decompositions, eigenvalues
Filters, window functions, correlation
regression, distributions
thermodynamics, optics
Atomic data, kinetics, thermodynamics
Serialize / deserialize Vec1
directory contains one runnable example per scientific
arithmetic, geometric, Fibonacci, linspace
Fourier series reconstruction of a square wave
Fast Fourier Transform, comparison with DFT
trapezoidal rule, Simpson's rule, Gauss-Legendre
Gaussian elimination, LU decomposition, Cholesky
moving average, FIR filters, window functions
descriptive statistics, linear regression, Pearson r
infinite square well, hydrogen levels, harmonic oscillator
first-order decay, Arrhenius, pH, Beer-Lambert
As of 0.2.0
#![allow(deprecated)]
VecIndexFromOne;
= VecIndexFromOne::from(vec![1, 2, 3]);
v[1], 1);
ops are
grouped by discipline. The ops module is an empty
libm], so all
[]
= { = "0.2", = false, = ["math", "numerical"] }
v[1] is the first element.
v.get(0) returns None; v[0] panics with a clear message.
formulas map directly to code.
math, numerical, linear, signal, stats, physics, chemistry.
pay only for what you use.
all algorithms work without std.
N-dimensional arrays
Linear algebra
Complex numbers
Version 2.0 (LICENSE-APACHE)
LICENSE-MIT)
any contribution intentionally
as defined in the Apache-2.0
shall be dual-licensed as above, without any additional terms or