The refactoring details of this update got lost to automatic changelog generation... See the new examples for the updated usage. I realized that while I was constraining amplitudes by free parameters, the amplitudes would still be calculated each time they show up in a sum. This is inefficient, since we can just calculate all possible amplitudes once, cache the results, and then walk the execution tree using the cache. That's what this update does. As such, it refactors the `manager` and `amplitude` modules, moving a lot of the functionality of `Manager` to the new `Model` struct. There is a lot to do still, but now model construction from amplitudes can have an arbitrary number nesting sums and products, as well as unary operations like `real`, `imag`, and `norm_sqr`. These alone give all the functionality of the previous system, but it allows for some other nice things, like not having to specify `part` in the `Zlm` amplitude (just take the real or imaginary part using the provided method!).
All of this drastically cuts down on boilerplate code, and it's also much, much faster. I have been lazy making benchmarks, but in my testing this change gave me an ~18.5x speedup (3.7s to 200ms for some particularly complicated amplitude I made).
There is further potential to speed things up even more. We could, for instance, add an optional method to the `Node` trait which gives the gradient rather than the plain function evaluation. As long it's done properly for the individual amplitudes, it seems like it shouldn't be difficult to propagate it to the root `AmpOp` via the chain rule. This will probably be a focus for the next version. Most of the next version will be centered around testing and plotting results, as this really needs to be done. Currently, some of the activate/deactivate mechanics seem to have weird side-effects, and they might not work as intended.
Bug Fixes
- make add_submodule public
Other
- <csr-id-f39aab03b7160ba3817614170d67bfcfdb22642b/> reorganize crate structure
Commit Statistics
- 2 commits contributed to the release over the course of 1 calendar day.
- 8 days passed between releases.
- 2 commits were understood as [conventional](https://www.conventionalcommits.org).
- 0 issues like '(ID)' were seen in commit messages
Commit Details
<csr-read-only-do-not-edit/>
<details><summary>view details</summary>
* **Uncategorized**
- Reorganize crate structure (f39aab0)
- Make add_submodule public (b71f07c)
</details>