array_matrix/vector/conj.rs
1use num_complex::Complex;
2use num_traits::Float;
3
4use crate::Vector;
5
6pub trait VConj: Vector
7where
8 Self::Output: Vector
9{
10 type Output;
11
12 /// Returns the complex-conjugate vector-array
13 ///
14 /// u*
15 ///
16 /// # Examples
17 ///
18 /// ```rust
19 /// let u = [Complex::new(1.0, 1.0), Complex::new(2.0, -1.0)];
20 /// let u_ = [u[0].conj(), u[1].conj()];
21 /// assert_eq!(u, u_);
22 /// ```
23 fn conj(&self) -> Self::Output;
24}
25
26impl<F: Float, const L: usize> VConj for [Complex<F>; L]
27where
28 Self: Vector
29{
30 type Output = Self;
31 fn conj(&self) -> Self::Output
32 {
33 self.map(|x| x.conj())
34 }
35}