Added no_space parameter for units

This commit is contained in:
2023-06-13 09:13:24 -07:00
parent 088853014e
commit a6bcbd5f66
4 changed files with 53 additions and 10 deletions

View File

@ -86,6 +86,12 @@ impl Unit {
pub fn get_val_mut(&mut self) -> &mut HashMap<FreeUnit, Scalar> { &mut self.val }
pub fn unitless(&self) -> bool { self.get_val().len() == 0 }
pub fn no_space(&self) -> bool {
if self.get_val().len() == 1 {
return self.get_val().keys().next().unwrap().whole.no_space();
} else { return false; }
}
pub fn from_array(a: &[(FreeUnit, Scalar)]) -> Unit {
let mut n = Unit::new();
for (u, p) in a.iter() {