Open makingthematrix opened 6 years ago
A simple wrapper over floats, with assertions:
There should be a "normalization" method which, given a vector of floats, returns a vector of coeffs where the sum of all coeffs is Coeff(1.0).
Also, utility methods for Coeff(0.0) and Coeff(1.0).
I decided to use a more flexible Coeff struct, working on f64 in the range of <0.0, 1.0>, instead of integers.
Coeff
f64
When all is done, it would be nice to take a look at newtype_derive and shorten the code.
newtype_derive
A simple wrapper over floats, with assertions:
There should be a "normalization" method which, given a vector of floats, returns a vector of coeffs where the sum of all coeffs is Coeff(1.0).
Also, utility methods for Coeff(0.0) and Coeff(1.0).