Skip to content

Commit

Permalink
IMPL: C64 type (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Axect committed Jan 17, 2021
1 parent 97fcd46 commit a1fb540
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/fuga/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub use crate::structure::{
vector::*,
dataframe::*,
ad::*,
complex::C64,
};

pub use crate::util::{api::*, low_level::*, non_macro::*, print::*, useful::*, wrapper::*};
Expand Down
1 change: 1 addition & 0 deletions src/prelude/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ pub use crate::structure::{
polynomial::*,
vector::*,
dataframe::*,
complex::C64,
};

pub use simpler::{solve, SimplerLinearAlgebra};
Expand Down
8 changes: 8 additions & 0 deletions src/structure/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ use crate::traits::fp::FPVector;
use crate::traits::math::{Vector, Normed, Norm, InnerProduct};
use crate::traits::sugar::VecOps;

pub type C64 = Complex<f64>;

impl Vector for Complex<f64> {
type Scalar = Self;

Expand Down Expand Up @@ -121,4 +123,10 @@ impl Normed for Vec<Complex<f64>> {
}
}

impl InnerProduct for Vec<Complex<f64>> {
fn dot(&self, rhs: &Self) -> Self::Scalar {
self.zip_with(|x, y| x.conj() * y, rhs).sum()
}
}

impl VecOps for Vec<Complex<f64>> {}

0 comments on commit a1fb540

Please sign in to comment.