File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 11use crate :: types:: * ;
22use ndarray:: * ;
33
4- pub trait Inner < S : Data > {
5- /// Inner product `(self.conjugate, rhs)`
6- fn inner ( & self , rhs : & ArrayBase < S , Ix1 > ) -> S :: Elem ;
4+ /// Inner Product
5+ ///
6+ /// Differenct from `Dot` trait, this take complex conjugate of `self` elements
7+ ///
8+ pub trait InnerProduct {
9+ type Elem : Scalar ;
10+
11+ /// Inner product `(self.conjugate, rhs)
12+ fn inner < S > ( & self , rhs : & ArrayBase < S , Ix1 > ) -> Self :: Elem
13+ where
14+ S : Data < Elem = Self :: Elem > ;
715}
816
9- impl < A , S1 , S2 > Inner < S1 > for ArrayBase < S2 , Ix1 >
17+ impl < A , S > InnerProduct for ArrayBase < S , Ix1 >
1018where
1119 A : Scalar ,
12- S1 : Data < Elem = A > ,
13- S2 : Data < Elem = A > ,
20+ S : Data < Elem = A > ,
1421{
15- fn inner ( & self , rhs : & ArrayBase < S1 , Ix1 > ) -> A {
22+ type Elem = A ;
23+ fn inner < St : Data < Elem = A > > ( & self , rhs : & ArrayBase < St , Ix1 > ) -> A {
1624 Zip :: from ( self )
1725 . and ( rhs)
1826 . fold_while ( A :: zero ( ) , |acc, s, r| FoldWhile :: Continue ( acc + s. conj ( ) * * r) )
You can’t perform that action at this time.
0 commit comments