{"id":32191905,"url":"https://github.com/generateme/fastmath","last_synced_at":"2025-10-22T01:53:29.681Z","repository":{"id":45863481,"uuid":"124250478","full_name":"generateme/fastmath","owner":"generateme","description":"Fast primitive based math library","archived":false,"fork":false,"pushed_at":"2025-10-17T12:32:28.000Z","size":116286,"stargazers_count":266,"open_issues_count":14,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-18T15:43:57.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/generateme.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-07T14:48:45.000Z","updated_at":"2025-10-18T12:18:12.000Z","dependencies_parsed_at":"2023-10-14T23:28:45.099Z","dependency_job_id":"7a8e0e3e-9e42-47cb-8e4a-8232d7b3a700","html_url":"https://github.com/generateme/fastmath","commit_stats":{"total_commits":240,"total_committers":6,"mean_commits":40.0,"dds":0.2958333333333333,"last_synced_commit":"b558c0c4e30af61fe0e85626ac2a11897ea9ac49"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/generateme/fastmath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generateme%2Ffastmath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generateme%2Ffastmath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generateme%2Ffastmath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generateme%2Ffastmath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/generateme","download_url":"https://codeload.github.com/generateme/fastmath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/generateme%2Ffastmath/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280052570,"owners_count":26264212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-20T02:00:06.978Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-22T01:53:28.516Z","updated_at":"2025-10-22T01:53:29.676Z","avatar_url":"https://github.com/generateme.png","language":"Clojure","funding_links":[],"categories":["Clojure"],"sub_categories":["[Tools](#tools-1)"],"readme":"[![Clojars Project](https://img.shields.io/clojars/v/generateme/fastmath.svg)](https://clojars.org/generateme/fastmath)\n\n# fastmath\n\nA Clojure math library.\n\n## Documentation\n\n### 3.0.0-alpha (WIP)\n\n[Fastmath book](https://generateme.github.io/fastmath/clay/)\n\n### 2.4.0\n\n[Codox documentation](https://generateme.github.io/fastmath/index.html)\n\n### Clerk notebooks\n\n[Index](https://generateme.github.io/fastmath/notebooks/)\n\n* [fastmath.core](https://generateme.github.io/fastmath/notebooks/notebooks/core/)\n* [fastmath.random](https://generateme.github.io/fastmath/notebooks/notebooks/random/)\n* [fastmath.stats](https://generateme.github.io/fastmath/notebooks/notebooks/stats/)\n    * [fastmath.stats.bootstrap](https://generateme.github.io/fastmath/notebooks/notebooks/bootstrap/)\n* [fastmath.calculus](https://generateme.github.io/fastmath/notebooks/notebooks/calculus/)\n* [fastmath.complex](https://generateme.github.io/fastmath/notebooks/notebooks/complex_quaternion/index.html#complex-numbers)\n* [fastmath.quaternion](https://generateme.github.io/fastmath/notebooks/notebooks/complex_quaternion/index.html#quaternions)\n\n## Installation\n\n```clojure\n[generateme/fastmath \"2.4.0\"]\n```\n### Alpha\n\n```clojure\n[generateme/fastmath \"3.0.0-alpha1\"]\n```\n\nSource code in the `3.x` branch.\n\n### 2.3.0 GPL warning\n\n**Important Note**\n\nFastmath `2.3.0` depends on SMILE 3.0.x which is GPL. That means that Fastmath 2.3.0 also should be treated as GPL. Version `2.4.x` fixes it and brings back SMILE LGPL 2.x dependency.\n\n### MKL\n\n**Important Note**\n\nFastmath relies on [SMILE](https://haifengl.github.io/) 2.6.0 which relies on BLAS/LAPACK via MKL and/or OpenBlas. MKL (preferred) and OpenBlas are included as dependencies in `fastmath`. This leads to addional 1GB of jar files. I can't assure that all functionalities will work on OpenBlas (see: [#15](https://github.com/generateme/fastmath/issues/15#issuecomment-1090323385)) but 99% should. If you need `fastmath` to be lighter, please exclude MKL from your path.\n\n#### lein / project.clj\n\n```clojure\n[generateme/fastmath \"2.4.0\" :exclusions [com.github.haifengl/smile-mkl]]\n```\n\n#### deps.edn\n\n```clojure\n{:deps {generateme/fastmath {:mvn/version \"2.4.0\"\n                             :exclusions [com.github.haifengl/smile-mkl]}}}\n```\n\nIf you don't need certain interpolation or clustering methods you can exclude OpenBlas as well (be warned that other things can break):\n\n```clojure\n:exclusions [com.github.haifengl/smile-mkl org.bytedeco/openblas]\n```\n\n#### MKL Exception\n\nWhen MKL is not available `fastmath` (SMILE actually, [here](https://github.com/haifengl/smile/blob/master/base/src/main/java/smile/math/blas/BLAS.java#L58) and [here](https://github.com/haifengl/smile/blob/master/base/src/main/java/smile/math/blas/LAPACK.java#L60)) will throw two exceptions with full stack traces about lack of MKL. You can safely ignore them.\n\n```\n[main] DEBUG smile.math.blas.LAPACK - Failed to create MKL instance:\njava.lang.ClassNotFoundException: smile.math.blas.mkl.MKL\n[...]\n\n[main] DEBUG smile.math.blas.BLAS - Failed to create MKL instance:\njava.lang.ClassNotFoundException: smile.math.blas.mkl.MKL\n[...]\n```\n\n## Contribution\n\n**NOTE** Currently we work on the 3.x branch only. PRs to master branch will not be accepted.\n\nWe accept PRs!\n\n* when fixing a bug/typo/docstring - just push a PR\n* if you want to add a new function or have an idea - please consult it before starting a work\n* if you want to enhance a documentation - please read [this wiki page](https://github.com/generateme/fastmath/wiki/Documenting-Fastmath-in-Clay)\n\n## Content\n\n### [PrimitiveMath](https://github.com/ztellman/primitive-math)\n\nCode adopted from Zach Tellmans' library.\n\n```\n[* + - / \u003e \u003c \u003e= \u003c= == 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 \u003c\u003c \u003e\u003e \u003e\u003e\u003e not==]\n```\n\n### Math functions\n\n* Trigonometric functions\n* Power: log, ln, logb, exp, pow, sqrt\n* Rounding functions: round, floor, ceil, trunc, frac, approx + other\n* Normalizations: norm  wrap, constrain\n* Interpolations: lerp, cos-interpolation, smooth-interpolation, quad-interpolation, smoothstep\n* Special functions: erf, beta, gamma + other\n* Distance: dist, hypot\n* Sign: sgn, signum, abs\n* Other: gcd, lcm\n\nMost of them backed by [Jafama FastMath 2.3.1](https://github.com/jeffhain/jafama) or [Apache Commons Math 3.6.1](http://commons.apache.org/proper/commons-math/index.html)\n\n### Vector operations protocol and implementations\n\n* 2d (`Vec2`), 3d (`Vec3`) and 4d (`Vec4`) vector types.\n* ArrayVector for fixed length long vectors (fixed sized double-array)\n* Clojure vector, double array, Number (as 1d vector)\n\n### Matrix operations protocol and implementations\n\n* 2d (`Mat2x2`), 3d (`Mat3x3`) and 4d (`Mat4x4`) matrix types.\n\nWith typical basic matrix operations\n\n### Complex and Quaternion number functions\n\n* primitive operations: mult, div, add, sub\n* abs, arg, conjugate, reciprocal, neg\n* atan, asin, acos, csc, sec, tanh, tan, sinh, sin, cosh, cos\n* log, exp, pow\n* sqrt, sq, sqrt1z\n\n### Integration, differentiations and solvers\n\n* Integration: VEGAS/VEGAS+ Monte Carlo, h-adaptive Cubature, h-adaptive Gauss-Kronrod (QuadGK), Simpson, Romberg, Trapezoid, Gauss-Legendre, Midpoint\n* Derivatives - any degree and order of accuracy\n* Gradient and Hessian for multivariate functions\n* Solvers (root finding): brent, bisection, illinois, muller, muller2, pegasus, regula-falsi, ridders, secant\n\n### Random numbers\n\n* Collection of random number generators\n* Random generator functions for each primitive type (drand - double, lrand - long, frand - float, irand - int)\n* Additional RNG functions: brand - true/false, grand - gaussian distributed double\n* Random sequences: from distribution, halton, sobol, R2, sphere, uniform\n\n### Distributions\n\n* Collection of distributions (60+)\n\n### Noise\n\n* 4 noise types: value, gradient, simplex, discrete\n* 3 noise blends: fbm, ridgedmulti, billow\n* Ready to use fbm functions: noise (perlin), vnoise (value noise), simplex\n* Warp noise\n\n### Statistics\n\n* Descriptive statistics: size, min, max, mode, mean, median, percentiles, kurtosis, skewness, IQR, LAV, UAV and other\n* Correlations\n* t-test\n* ACF/PACF\n* histogram\n* Bootstrap\n* Confidence intervals\n\n#### Bootstrap\n\nBootstrap functions and confidence intervals\n\n### Interpolations\n\n1d, 2d interpolations\n\n### Easings\n\nSeveral easing functions (in, out, in-out)\n\n### Transforms\n\n* Wavelets: 1d, 2d (haar, biorthogonal, symlet, coiflet, daubechies, legendre)\n* 1d Fast Sine, Cosine and Hadamard\n\n### Vector fields\n\nGreat collection (100+) of R^2-\u003eR^2 functions.\n\n### Gaussian Processes\n\nGaussian Processes\n\n### Clustering\n\nVarious clustering algorithms including K-Means++, DBSCAN, CLARANS, DENCLUE, MEC, Spectral, Deterministic Annealing\n\n### Optimization\n\nL-BFGS-B, Gradient, Nelder-Mead, Simplex, Powell, BOBYQA, CMAES, BayesianOptimizer, Linear optimizer\n\n### Grids\n\nHexagonal, squared, triangular, rhomboidal grid functions\n\n### Kernels\n\nCollection of various kernels (density, RBF, correlation)\n\n### Signal\n\n* Signal (audio) processing filters and oscillators\n* Smoothing filters: Savitzky-Golay, moving average, kernel smoothing\n\n### EFloat\n\nFloating point operations with error bounds\n\n### Other\n\nPlenty of constant values\n\nAlmost all functions optimized to work with `double` and `long` primitives\n\n## Supporting libraries\n\n* [Apache Commons Math 3.6.1](http://commons.apache.org/proper/commons-math/index.html) - Apache 2.0 Licence\n* [SMILE 2.5.0](http://haifengl.github.io/smile/) - Apache 2.0 Licence\n* [Jafama FastMath 2.3.1](https://github.com/jeffhain/jafama) - Apache 2.0 Licence\n* [PrimitiveMath](https://github.com/ztellman/primitive-math) - MIT Licence\n* [JWave](https://github.com/cscheiblich/JWave/) - MIT Licence\n* [SSJ](https://github.com/umontreal-simul/ssj) - Apache 2.0 Licence\n\n## Alternatives\n\nSince this library is only JVM version, you can check following Clojure/ClojureScript libraries as replacement\n\n* [PrimitiveMath](https://github.com/ztellman/primitive-math) - for primitive operators\n* [Kixi stats](https://github.com/MastodonC/kixi.stats) - for pure clj(s) statistics/distributions (tends to be 2-10x slower)\n* [thi.ng](http://thi.ng/) - for vectors, general math, noise, complex numbers, transforms (fourier)\n* [vectorz-clj](https://github.com/mikera/vectorz-clj) - fast vector operations\n* [Incanter](https://github.com/incanter/incanter) - statistics/distributions/probability\n\n## Java\n\nJava classes are compiled for java 1.8\n\n## How To Help\n\nIf you see place of improvement, I'm accepting PRs.\n\n## Licence\n\n* The Unlicence - up to 1.5.2\n* MIT License - from 1.5.3 (with te exception of 2.3.0 which should be treated as GPL)\n\nCopyright (c) 2024 generateme\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerateme%2Ffastmath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgenerateme%2Ffastmath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgenerateme%2Ffastmath/lists"}