Skip to content

Commit 8e7dea5

Browse files
committed
Fix random_{unitary,regular}
1 parent 7e497cc commit 8e7dea5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/generate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ where
3939
/// Be sure that this it **NOT** a uniform distribution. Use it only for test purpose.
4040
pub fn random_unitary<A>(n: usize) -> Array2<A>
4141
where
42-
A: Scalar + RandNormal,
42+
A: Scalar + Lapack,
43+
Standard: Distribution<A>,
4344
{
4445
let a: Array2<A> = random((n, n));
4546
let (q, _r) = a.qr_into().unwrap();
@@ -51,12 +52,13 @@ where
5152
/// Be sure that this it **NOT** a uniform distribution. Use it only for test purpose.
5253
pub fn random_regular<A>(n: usize) -> Array2<A>
5354
where
54-
A: Scalar + RandNormal,
55+
A: Scalar + Lapack,
56+
Standard: Distribution<A>,
5557
{
5658
let a: Array2<A> = random((n, n));
5759
let (q, mut r) = a.qr_into().unwrap();
5860
for i in 0..n {
59-
r[(i, i)] = A::from_f64(1.0) + AssociatedReal::inject(r[(i, i)].abs());
61+
r[(i, i)] = A::one() + A::from_real(r[(i, i)].abs());
6062
}
6163
q.dot(&r)
6264
}

0 commit comments

Comments
 (0)