Elara Math
Elara Math is a Rust-native math library, developed as part of Project Elara's suite of open-source software libraries. It contains support for:
- Tensors: N-dimensional arrays with built-in support for automatic differentiation)* (supported)
- Basic vectorized opertions and linear algebra with tensors (supported)
- Numerical solvers for integrals & differential equations (partially supported**, work-in-progress)
- Basic machine learning tools for building feedforward fully-connected neural networks, with two APIs: one PyTorch-style, one TensorFlow-style (supported)
*: GPU tensors are not available yet, but GPU acceleration is planned to be added in the future
**: Numerical integration is supported out-of-the-box. However, the numerical differential equation solver has been (temporarily) moved to a separate library, elara-array, which is currently being developed in parallel.
elara-mathis public domain software like the rest of Project Elara, meaning it is essentially unlicensed software, so you can use it for basically any project you want, however you want, with or without attribution.
Shoutouts: Acknowledgements
It is intended to both contain a set of ready-to-use solvers and vectorized math on NumPy-style N-dimensional arrays, as well as a flexible user-friendly API that can be used to make more specialized/advanced libraries for computational tasks.
As an example, here is a working tiny neural network using elara-math and its companion library elara-log (elara-log is automatically installed when you install elara-math), ported from this excellent Python demo:
use *;
use *;
const EPOCHS: usize = 10000;
const LR: f64 = 1e-5;
For more examples, including basic usage of tensors, using automatic differentiation, and building more complex neural networks, please feel free to see the examples folder.
Usage
To use elara-math for your own project, simply add it to your project with Cargo:
Then in your code, just import the library:
use *; // this is required
use *; // load prelude
The library's prelude is designed for user-friendliness and contains a variety of modules pre-loaded. For those who want finer-grained control, you can individually import the modules you need.
Developing
To develop elara-math, first clone the repository:
Then, copy over the pre-commit githook:
&&
You should then be all set to start making changes!