Fast and primitive based math library.
NOTE
Due to significant change in SMILE 2.x API I decided to remove ML namespaces: regression and classification. Possible scenarios are: separate library with ML elements or further development of Clojure bindings in SMILE directly.
[generateme/fastmath "2.1.3"]
Documentation with examples
Based on SMILE 1.5.3 and including: regression and classification.
[generateme/fastmath "1.5.3"]
Documentation with examples
Code adopted from Zach Tellmans' library.
[* + - / > < >= <= == rem quot mod bit-or bit-and bit-xor bit-not bit-shift-left bit-shift-right unsigned-bit-shift-right inc dec zero? neg? pos? min max even? odd? bool-and bool-or bool-xor bool-not << >> >>> not==]
- Trigonometric functions
- Power: log, ln, logb, exp, pow, sqrt
- Rounding functions: round, floor, ceil, trunc, frac, approx + other
- Normalizations: norm wrap, constrain
- Interpolations: lerp, cos-interpolation, smooth-interpolation, quad-interpolation, smoothstep
- Special functions: erf, beta, gamma + other
- Distance: dist, hypot
- Sign: sgn, signum, abs
- Other: gcd
Most of them backed by Jafama FastMath 2.3.1 or Apache Commons Math 3.6.1
- 2d (
Vec2
), 3d (Vec3
) and 4d (Vec4
) vector types. - ArrayVector for fixed length long vectors (fixed sized double-array)
- Clojure vector, double array, Number (as 1d vector)
With following groups of functions:
- Basic linear operations: add, mult, div, sub, dot, cross, hadamard product
- mag, magsq, heading, angle-between, limit, normalize
- rotations (2d,3d)
- translations (2d, 3d)
- various distances
- centroid, interpolations
- and other
- primitive operations: mult, div, add, sub
- abs, arg, conjugate, reciprocal, neg
- atan, asin, acos, csc, sec, tanh, tan, sinh, sin, cosh, cos
- log, exp, pow
- sqrt, sq, sqrt1z
- Collection of random number generators
- Random generator functions for each primitive type (drand - double, lrand - long, frand - float, irand - int)
- Additional RNG functions: brand - true/false, grand - gaussian distributed double
- Random sequences: from distribution, halton, sobol, R2, sphere, uniform
- Collection of distributions (60+)
- 4 noise types: value, gradient, simplex, discrete
- 3 noise blends: fbm, ridgedmulti, billow
- Ready to use fbm functions: noise (perlin), vnoise (value noise), simplex
- Warp noise
- Descriptive statistics: size, min, max, mode, mean, median, percentiles, kurtosis, skewness, IQR, LAV, UAV and other
- Correlations
- t-test
- ACF/PACF
- histogram
- Bootstrap
- Confidence intervals
1d, 2d interpolations
Several easing functions (in, out, in-out)
- Wavelets: 1d, 2d (haar, biorthogonal, symlet, coiflet, daubechies, legendre)
- 1d Fast Sine, Cosine and Hadamard
Great collection (100+) of R^2->R^2 functions.
Gaussian Processes
Various clustering algorithms including K-Means++, DBSCAN, CLARANS, DENCLUE, MEC, Spectral, Deterministic Annealing
L-BFGS-B, Gradient, Nelder-Mead, Simplex, Powell, BOBYQA, CMAES, BayesianOptimizer
Hexagonal, squared, triangular, rhomboidal grid functions
Collection of various kernels (density, RBF, correlation)
- Signal (audio) processing filters and oscillators
- Smoothing filters: Savitzky-Golay, moving average, kernel smoothing
Plenty of constant values
Almost all functions optimized to work with double
and long
primitives
Since this library is only JVM version, you can check following Clojure/ClojureScript libraries as replacement
- PrimitiveMath - for primitive operators
- Kixi stats - for pure clj(s) statistics/distributions (tends to be 2-10x slower)
- thi.ng - for vectors, general math, noise, complex numbers, transforms (fourier)
- vectorz-clj - fast vector operations
- Incanter - statistics/distributions/probability
Java classes are compiled for java 1.8
If you see place of improvement, I'm accepting PRs.
- The Unlicence - up to 1.5.2
- MIT License - from 1.5.3
Copyright (c) 2020 generateme