--- a/src/measures/discrete.rs Mon Jan 06 11:32:57 2025 -0500 +++ b/src/measures/discrete.rs Thu Jan 23 23:35:28 2025 +0100 @@ -326,6 +326,18 @@ pub fn set_masses_dvector(&mut self, x : &DVector<F::MixedType>) { self.set_masses(x.iter().map(|&α| F::from_nalgebra_mixed(α))); } + + /// Extracts the masses of the spikes as a [`Vec`]. + pub fn masses_vec(&self) -> Vec<F::MixedType> { + self.iter_masses() + .map(|α| α.to_nalgebra_mixed()) + .collect() + } + + /// Sets the masses of the spikes from the values of a [`Vec`]. + pub fn set_masses_vec(&mut self, x : &Vec<F::MixedType>) { + self.set_masses(x.iter().map(|&α| F::from_nalgebra_mixed(α))); + } } // impl<Domain, F :Num> Index<usize> for DiscreteMeasure<Domain, F> {