The prop_assert* macros clean-up the assertion output by eliminating the extra panics while it’s reducing inputs.
Signed-off-by: Stephen Waits <steve@waits.net>
- Use array-init for the lowest level vector operations. Makes them nicer and less bug-prone, with zero performance impact.
- Remove unnecessary/unused ::new() functions on Vector and HeightVector.
- Update README with new dependency.
- Fix typo in README.
Signed-off-by: Stephen Waits <steve@waits.net>
- eliminated `f64` feature because Cargo doesn’t understand mutually exclusive features. So, we default to `f64`, and leave the `f32` feature there if people want to change to that.
- integrated tarpaulin for coverage
- added tests to get to 100% coverage
- fixed NetworkCoordinate Div impl safety checks (now acts like Add and Sub)
- update README to explain cargo feature change
- cleanup build script with the new simpler features model
Signed-off-by: Stephen Waits <steve@waits.net>
Realized about a 10x speedup.
- add benches/million-updates.rs
- optimization: use rand instead of nanorand (because of thread_rng() initialization being muchf aster)
- update README
Signed-off-by: Stephen Waits <steve@waits.net>
This just adds a few type aliases for convenience, and slightly better ergonomics for the most common usage (2D or 3D).
Signed-off-by: Stephen Waits <steve@waits.net>
Goal: To make the serialization format more sensible instead of it being a reflection of our internal (ie private) data model.
- mostly handled with #[serde()] macros (renaming, flattening)
- renamed NetworkCoordinate::position to heightvec which is a better name, even if not seen in the published interface
- changed HeightVector from a tuple struct to a named struct so we can control serde on a field-by-field basis
- updated README, tests, and doc tests to match
Signed-off-by: Stephen Waits <steve@waits.net>
Made `HeightVector` numerically safe; while `Vector` remains numerically unsafe (i.e. it can divide by 0, NaN, Inf, etc).
When HeightVector runs into a problem, it just re-randomizes itself. Since the algorithm converges relatively quickly, this seems to work fine.
Also fixed a bug so that now height will always start as a positive number (and stay that way, else get re-randomized).
Added safety to `NetworkCoordinate` which now checks that its error didn’t pull a `HeightVector` into a negative height; in which case it also re-randomizes.
Clarified the `random` construction, tweaked the DEFAULT_ERROR constant, and updated tests accordingly.
Signed-off-by: Stephen Waits <steve@waits.net>