Metadata-Version: 2.3
Name: rombus
Version: 1.2.1
Summary: Reduced order modeling for the masses
License: MIT-expat
Author: Gregory Poole
Author-email: gbpoole@gmail.com
Requires-Python: >=3.11
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Provides-Extra: dev
Provides-Extra: docs
Provides-Extra: mpi
Requires-Dist: Sphinx (>=6.1.3,<7.0.0) ; extra == "docs"
Requires-Dist: black (>=22.10.0,<23.0.0) ; extra == "dev"
Requires-Dist: click (>=8.1.3,<9.0.0)
Requires-Dist: h5py (>=3.8.0,<4.0.0)
Requires-Dist: matplotlib (>=3.6.2,<4.0.0)
Requires-Dist: mpi4py (>3.1.4,<4.0.0) ; extra == "mpi"
Requires-Dist: mypy (>=1.1.1,<2.0.0) ; extra == "dev"
Requires-Dist: myst-parser (>=1.0.0,<2.0.0) ; extra == "docs"
Requires-Dist: pre-commit (>=3.0.4,<4.0.0) ; extra == "dev"
Requires-Dist: pytest (>=7.0,<8.0.0) ; extra == "dev"
Requires-Dist: pytest-cov (>=4.1.0) ; extra == "dev"
Requires-Dist: rich (>=13.3.3,<14.0.0)
Requires-Dist: ruff (>=0.0.243,<1.0.0) ; extra == "dev"
Requires-Dist: scipy (==1.9.3)
Requires-Dist: six (>=1.16.0,<2.0.0)
Requires-Dist: sphinx-click (>=4.4.0,<5.0.0) ; extra == "docs"
Requires-Dist: sphinx-copybutton (>=0.5.1,<1.0.0) ; extra == "docs"
Requires-Dist: sphinx-rtd-theme (==1.2.0) ; extra == "docs"
Description-Content-Type: text/markdown

Rombus: Helps you qucikly and easily compute slow and complex models
====================================================================

Rombus is a tool for building reduced order models (ROMs): matrix representations of arbitrary
models which can be rapidly and easily computed for arbitrary parameter sets.

Building a ROM with Rombus is easy.  All you need to do is install it like so:
``` console
$ pip install rombus
```
define your model like this (in this trivial case, a file named `my_model.py` specifying a simple second-order polynomial):
``` python
from numpy import ndarray, polyval, linspace
from rombus.model import RombusModel
from typing import NamedTuple


class Model(RombusModel):
    """Class for creating a ROM for the function y(x)=a2*x^2+a1*x+a0"""

    coordinate.set("x", 0.0, 10.0, 11, label="$x$")

    ordinate.set("y", label="$y(x)$")

    params.add("a0", -10, 10)
    params.add("a1", -10, 10)
    params.add("a2", -10, 10)

    def compute(self, p: NamedTuple, x: ndarray) -> ndarray:
        """Compute the model for a given parameter set."""
        return polyval([p.a2, p.a1, p.a0], x)
```
and specify a set of points (in this case, the file `my_model_samples.py`) to build your ROM from:
```
-10, -10,-10
-10,  10,-10
-10, -10, 10
-10,  10, 10
 10, -10,-10
 10,  10,-10
 10, -10, 10
 10,  10, 10
```
You build your ROM like this:
``` console
$ rombus build my_model:Model my_model_samples.csv
```
This produces an _HDF5_ file named `my_model.hdf5`.  You can then use your new ROM in your Python projects like this:
``` python
from rombus.rom import ReducedOrderModel

ROM = ReducedOrderModel.from_file('my_model.hdf5')
sample = ROM.model.sample({"a0":0,"a1":0,"a2":1})
model_ROM = ROM.evaluate(sample)
for x, y in zip(ROM.model.domain,model_ROM):
    print(f"{x:5.2f} {y:6.2f}")
```
which generates the output:
```
 0.00   0.00
 1.00   1.00
 2.00   4.00
 3.00   9.00
 4.00  16.00
 5.00  25.00
 6.00  36.00
 7.00  49.00
 8.00  64.00
 9.00  81.00
10.00 100.00
```

