A library for quickly applying symbolic expressions to NumPy arrays
APACHE-2.0 License
A library for quickly applying symbolic expressions to NumPy arrays
By enabling callers to front-load sample data, developers can move the runtime cost of Numba's JIT to the application's initial loading (or an earlier build) and also avoid exec
during runtime, which is otherwise needed when lambdifying symbolic expressions
Inspired in part by this Stack Overflow Question Using numba.autojit on a lambdify'd sympy expression
via pip https://pypi.org/project/expressive/
pip install expressive
refer to tests for examples for now
generally follow a workflow like
expr = Expressive("a + log(b)")
expr.build(sample_data)
expr(full_data)
The data
should be provided as dict of NumPy arrays
sample_data = { # types are used to compile a fast version for full data
"a": numpy.array([1,2,3,4], dtype="int64"),
"b": numpy.array([4,3,2,1], dtype="int64"),
}
full_data = {
"a": numpy.array(range(1_000_000), dtype="int64"),
"b": numpy.array(range(1_000_000), dtype="int64"),
}
Only docker
and docker compose
(v2) are require, which are used to host/generate the test environment
Then just directly run the test script from the root of the repository, it will build the docker test environment and run itself inside it automatically
sudo apt install docker.io docker-compose-v2
./test/runtests.sh
The development process is currently private (though most fruits are available here!), largely due to this being my first public project with the potential for other users than myself, and so the potential for more public gaffes is far greater
Please refer to CONTRIBUTING.md and LICENSE.txt and feel free to provide feedback, bug reports, etc. via Issues, subject to the former
warn()
.shape
to .ndim
numpy.array(range())
to numpy.arange()
.build()
call)Expressive
instances