diff options
Diffstat (limited to 'libpsi-core/src')
| -rw-r--r-- | libpsi-core/src/maths/matrix.rs | 2 | ||||
| -rw-r--r-- | libpsi-core/src/maths/vector.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libpsi-core/src/maths/matrix.rs b/libpsi-core/src/maths/matrix.rs index bc91edd..74857d1 100644 --- a/libpsi-core/src/maths/matrix.rs +++ b/libpsi-core/src/maths/matrix.rs @@ -174,7 +174,7 @@ impl<T: Float + fmt::Display> fmt::Display for Matrix<T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let max_width = (0..self.rows) .flat_map(|i| (0..self.cols).map(move |j| self.get(i, j))) - .map(|x| format!("{:.2}", x).split('.').next().unwrap().len()) // Length of integer part + .map(|x| format!("{:.2}", x).split('.').next().unwrap().len()); .max() .unwrap_or(0); diff --git a/libpsi-core/src/maths/vector.rs b/libpsi-core/src/maths/vector.rs index f424e4e..cb25ecd 100644 --- a/libpsi-core/src/maths/vector.rs +++ b/libpsi-core/src/maths/vector.rs @@ -259,12 +259,12 @@ impl<T: Float + fmt::Display> fmt::Display for ColumnVector<T> { let max_width = self .0 .iter() - .map(|x| format!("{:.2}", x).split('.').next().unwrap().len()) // Length of integer part + .map(|x| format!("{:.2}", x).split('.').next().unwrap().len()) .max() .unwrap_or(0); for (i, x) in self.0.iter().enumerate() { - let formatted_x = format!("{:>width$.2}", x, width = max_width + 3); // +3 for ".00" + let formatted_x = format!("{:>width$.2}", x, width = max_width + 3); if i == 0 { write!(f, "┌{}┐\n", formatted_x)?; |
