aboutsummaryrefslogtreecommitdiff
path: root/libmu/src
diff options
context:
space:
mode:
Diffstat (limited to 'libmu/src')
-rw-r--r--libmu/src/maths/complex.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/libmu/src/maths/complex.rs b/libmu/src/maths/complex.rs
index 931b030..ccae000 100644
--- a/libmu/src/maths/complex.rs
+++ b/libmu/src/maths/complex.rs
@@ -1,6 +1,13 @@
use crate::numeric_types::Float;
use core::{fmt, ops};
+#[macro_export]
+macro_rules! complex {
+ ($real:expr, $imaginary:expr) => {
+ $crate::Complex::new($real, $imaginary)
+ };
+}
+
#[derive(Copy, Clone, PartialOrd, PartialEq)]
pub struct Complex<T: Float> {
pub real: T,
@@ -29,7 +36,10 @@ impl<T: Float> Complex<T> {
}
pub fn get_conjugate(&self) -> Complex<T> {
- Complex::new(self.real, -self.imaginary)
+ Complex {
+ real: self.real,
+ imaginary: -self.imaginary,
+ }
}
pub fn conjugate(&mut self) {