aboutsummaryrefslogtreecommitdiff
path: root/libmu/src/maths/vector.rs
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2024-09-20 09:25:19 +0200
committerhachem <im@hachem.wtf>2024-09-20 09:25:19 +0200
commita84b6394209e37620e45155a25b3755b38ba8515 (patch)
tree4839f145111fda4086311d8ff1417f698ca30212 /libmu/src/maths/vector.rs
parentaffb34897a4761197df78bdccdb2da599ceb537a (diff)
basic quantum gate setup and quantum registers
Diffstat (limited to 'libmu/src/maths/vector.rs')
-rw-r--r--libmu/src/maths/vector.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/libmu/src/maths/vector.rs b/libmu/src/maths/vector.rs
index c97b415..0c13e4c 100644
--- a/libmu/src/maths/vector.rs
+++ b/libmu/src/maths/vector.rs
@@ -362,14 +362,13 @@ impl<T: Float + fmt::Display> fmt::Display for RowVector<T> {
impl<T: Float + fmt::Display> fmt::Display for ColumnVector<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- write!(
- f,
- "[{}]",
- self.0
- .iter()
- .map(|x| x.to_string())
- .collect::<Vec<String>>()
- .join(", ")
- )
+ write!(f, "[")?;
+ for (i, x) in self.0.iter().enumerate() {
+ if i > 0 {
+ write!(f, ",\n ")?;
+ }
+ write!(f, "{}", x)?;
+ }
+ write!(f, "]")
}
}