File tree Expand file tree Collapse file tree 3 files changed +8
-27
lines changed Expand file tree Collapse file tree 3 files changed +8
-27
lines changed Original file line number Diff line number Diff line change 3636}
3737
3838/// Generate random unitary matrix using QR decomposition
39+ ///
40+ /// Be sure that this it **NOT** a uniform distribution. Use it only for test purpose.
3941pub fn random_unitary < A > ( n : usize ) -> Array2 < A >
4042where
4143 A : Scalar + RandNormal ,
4648}
4749
4850/// Generate random regular matrix
51+ ///
52+ /// Be sure that this it **NOT** a uniform distribution. Use it only for test purpose.
4953pub fn random_regular < A > ( n : usize ) -> Array2 < A >
5054where
5155 A : Scalar + RandNormal ,
5862 q. dot ( & r)
5963}
6064
61- /// Generate random regular matrix
62- pub fn random_regular_t < A > ( n : usize ) -> Array2 < A >
63- where
64- A : Scalar + RandNormal ,
65- {
66- let a: Array2 < A > = random ( ( n, n) . f ( ) ) ;
67- let ( q, mut r) = a. qr_into ( ) . unwrap ( ) ;
68- for i in 0 ..n {
69- r[ ( i, i) ] = A :: from_f64 ( 1.0 ) + AssociatedReal :: inject ( r[ ( i, i) ] . abs ( ) ) ;
70- }
71- q. dot ( & r) . t ( ) . to_owned ( )
72- }
73-
7465/// Random Hermite matrix
7566pub fn random_hermite < A , S > ( n : usize ) -> ArrayBase < S , Ix2 >
7667where
Original file line number Diff line number Diff line change @@ -138,10 +138,10 @@ fn det() {
138138 det_impl ( random_regular :: < f32 > ( rows) , 1e-4 ) ;
139139 det_impl ( random_regular :: < c64 > ( rows) , 1e-9 ) ;
140140 det_impl ( random_regular :: < c32 > ( rows) , 1e-4 ) ;
141- det_impl ( random_regular_t :: < f64 > ( rows) , 1e-9 ) ;
142- det_impl ( random_regular_t :: < f32 > ( rows) , 1e-4 ) ;
143- det_impl ( random_regular_t :: < c64 > ( rows) , 1e-9 ) ;
144- det_impl ( random_regular_t :: < c32 > ( rows) , 1e-4 ) ;
141+ det_impl ( random_regular :: < f64 > ( rows) . t ( ) . to_owned ( ) , 1e-9 ) ;
142+ det_impl ( random_regular :: < f32 > ( rows) . t ( ) . to_owned ( ) , 1e-4 ) ;
143+ det_impl ( random_regular :: < c64 > ( rows) . t ( ) . to_owned ( ) , 1e-9 ) ;
144+ det_impl ( random_regular :: < c32 > ( rows) . t ( ) . to_owned ( ) , 1e-4 ) ;
145145 }
146146}
147147
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments