@@ -48,3 +48,37 @@ impl<'a, A, S, Se> Eigh<ArrayBase<Se, Ix1>, &'a mut ArrayBase<S, Ix2>> for &'a m
48
48
pub trait EigValsh < EigVal > {
49
49
fn eigvalsh ( self , UPLO ) -> Result < EigVal > ;
50
50
}
51
+
52
+ impl < A , S , Se > EigValsh < ArrayBase < Se , Ix1 > > for ArrayBase < S , Ix2 >
53
+ where A : LapackScalar ,
54
+ S : DataMut < Elem = A > ,
55
+ Se : DataOwned < Elem = A :: Real >
56
+ {
57
+ fn eigvalsh ( mut self , uplo : UPLO ) -> Result < ArrayBase < Se , Ix1 > > {
58
+ let s = A :: eigh ( false , self . square_layout ( ) ?, uplo, self . as_allocated_mut ( ) ?) ?;
59
+ Ok ( ArrayBase :: from_vec ( s) )
60
+ }
61
+ }
62
+
63
+ impl < ' a , A , S , Se > EigValsh < ArrayBase < Se , Ix1 > > for & ' a ArrayBase < S , Ix2 >
64
+ where A : LapackScalar + Copy ,
65
+ S : Data < Elem = A > ,
66
+ Se : DataOwned < Elem = A :: Real >
67
+ {
68
+ fn eigvalsh ( self , uplo : UPLO ) -> Result < ArrayBase < Se , Ix1 > > {
69
+ let mut a = self . to_owned ( ) ;
70
+ let s = A :: eigh ( false , a. square_layout ( ) ?, uplo, a. as_allocated_mut ( ) ?) ?;
71
+ Ok ( ArrayBase :: from_vec ( s) )
72
+ }
73
+ }
74
+
75
+ impl < ' a , A , S , Se > EigValsh < ArrayBase < Se , Ix1 > > for & ' a mut ArrayBase < S , Ix2 >
76
+ where A : LapackScalar ,
77
+ S : DataMut < Elem = A > ,
78
+ Se : DataOwned < Elem = A :: Real >
79
+ {
80
+ fn eigvalsh ( mut self , uplo : UPLO ) -> Result < ArrayBase < Se , Ix1 > > {
81
+ let s = A :: eigh ( true , self . square_layout ( ) ?, uplo, self . as_allocated_mut ( ) ?) ?;
82
+ Ok ( ArrayBase :: from_vec ( s) )
83
+ }
84
+ }
0 commit comments