Skip to content

Commit

Permalink
s/random_hpd/random_hpd_using/g
Browse files Browse the repository at this point in the history
  • Loading branch information
termoshtt committed Sep 16, 2022
1 parent 203172d commit d6bde0c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions ndarray-linalg/tests/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ macro_rules! cholesky {
paste::item! {
#[test]
fn [<cholesky_ $elem>]() {
let a_orig: Array2<$elem> = random_hpd(3);
let a_orig: Array2<$elem> = random_hpd_using(3);
println!("a = \n{:?}", a_orig);

let upper = a_orig.cholesky(UPLO::Upper).unwrap();
Expand Down Expand Up @@ -79,7 +79,7 @@ macro_rules! cholesky_into_lower_upper {
paste::item! {
#[test]
fn [<cholesky_into_lower_upper_ $elem>]() {
let a: Array2<$elem> = random_hpd(3);
let a: Array2<$elem> = random_hpd_using(3);
println!("a = \n{:?}", a);
let upper = a.cholesky(UPLO::Upper).unwrap();
let fac_upper = a.factorizec(UPLO::Upper).unwrap();
Expand All @@ -106,7 +106,7 @@ macro_rules! cholesky_into_inverse {
paste::item! {
#[test]
fn [<cholesky_inverse_ $elem>]() {
let a: Array2<$elem> = random_hpd(3);
let a: Array2<$elem> = random_hpd_using(3);
println!("a = \n{:?}", a);
let inv = a.invc().unwrap();
assert_close_l2!(&a.dot(&inv), &Array2::eye(3), $rtol);
Expand Down Expand Up @@ -134,7 +134,7 @@ macro_rules! cholesky_det {
paste::item! {
#[test]
fn [<cholesky_det_ $elem>]() {
let a: Array2<$elem> = random_hpd(3);
let a: Array2<$elem> = random_hpd_using(3);
println!("a = \n{:?}", a);
let ln_det = a
.eigvalsh(UPLO::Upper)
Expand Down Expand Up @@ -168,7 +168,7 @@ macro_rules! cholesky_solve {
paste::item! {
#[test]
fn [<cholesky_solve_ $elem>]() {
let a: Array2<$elem> = random_hpd(3);
let a: Array2<$elem> = random_hpd_using(3);
let x: Array1<$elem> = random_using(3);
let b = a.dot(&x);
println!("a = \n{:?}", a);
Expand Down
8 changes: 4 additions & 4 deletions ndarray-linalg/tests/eigh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fn fixed_t_lower() {

#[test]
fn ssqrt() {
let a: Array2<f64> = random_hpd(3);
let a: Array2<f64> = random_hpd_using(3);
let ans = a.clone();
let s = a.ssqrt(UPLO::Upper).unwrap();
println!("a = {:?}", &ans);
Expand All @@ -92,7 +92,7 @@ fn ssqrt() {

#[test]
fn ssqrt_t() {
let a: Array2<f64> = random_hpd(3).reversed_axes();
let a: Array2<f64> = random_hpd_using(3).reversed_axes();
let ans = a.clone();
let s = a.ssqrt(UPLO::Upper).unwrap();
println!("a = {:?}", &ans);
Expand All @@ -105,7 +105,7 @@ fn ssqrt_t() {

#[test]
fn ssqrt_lower() {
let a: Array2<f64> = random_hpd(3);
let a: Array2<f64> = random_hpd_using(3);
let ans = a.clone();
let s = a.ssqrt(UPLO::Lower).unwrap();
println!("a = {:?}", &ans);
Expand All @@ -118,7 +118,7 @@ fn ssqrt_lower() {

#[test]
fn ssqrt_t_lower() {
let a: Array2<f64> = random_hpd(3).reversed_axes();
let a: Array2<f64> = random_hpd_using(3).reversed_axes();
let ans = a.clone();
let s = a.ssqrt(UPLO::Lower).unwrap();
println!("a = {:?}", &ans);
Expand Down
4 changes: 2 additions & 2 deletions ndarray-linalg/tests/solve.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ndarray::prelude::*;
use ndarray_linalg::{
assert_aclose, assert_close_l2, c32, c64, random_using, random_hpd, solve::*, OperationNorm, Scalar,
assert_aclose, assert_close_l2, c32, c64, random_using, random_hpd_using, solve::*, OperationNorm, Scalar,
};

macro_rules! test_solve {
Expand Down Expand Up @@ -223,7 +223,7 @@ fn solve_h_random_complex() {
fn rcond() {
macro_rules! rcond {
($elem:ty, $rows:expr, $atol:expr) => {
let a: Array2<$elem> = random_hpd($rows);
let a: Array2<$elem> = random_hpd_using($rows);
let rcond = 1. / (a.opnorm_one().unwrap() * a.inv().unwrap().opnorm_one().unwrap());
assert_aclose!(a.rcond().unwrap(), rcond, $atol);
assert_aclose!(a.rcond_into().unwrap(), rcond, $atol);
Expand Down
12 changes: 6 additions & 6 deletions ndarray-linalg/tests/solveh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ use ndarray_linalg::*;
#[should_panic]
#[test]
fn solveh_shape_mismatch() {
let a: Array2<f64> = random_hpd(3);
let a: Array2<f64> = random_hpd_using(3);
let b: Array1<f64> = random_using(2);
let _ = a.solveh_into(b);
}

#[should_panic]
#[test]
fn factorizeh_solveh_shape_mismatch() {
let a: Array2<f64> = random_hpd(3);
let a: Array2<f64> = random_hpd_using(3);
let b: Array1<f64> = random_using(2);
let f = a.factorizeh_into().unwrap();
let _ = f.solveh_into(b);
}

#[test]
fn solveh_random() {
let a: Array2<f64> = random_hpd(3);
let a: Array2<f64> = random_hpd_using(3);
let x: Array1<f64> = random_using(3);
let b = a.dot(&x);
let y = a.solveh_into(b).unwrap();
Expand All @@ -35,23 +35,23 @@ fn solveh_random() {
#[should_panic]
#[test]
fn solveh_t_shape_mismatch() {
let a: Array2<f64> = random_hpd(3).reversed_axes();
let a: Array2<f64> = random_hpd_using(3).reversed_axes();
let b: Array1<f64> = random_using(2);
let _ = a.solveh_into(b);
}

#[should_panic]
#[test]
fn factorizeh_solveh_t_shape_mismatch() {
let a: Array2<f64> = random_hpd(3).reversed_axes();
let a: Array2<f64> = random_hpd_using(3).reversed_axes();
let b: Array1<f64> = random_using(2);
let f = a.factorizeh_into().unwrap();
let _ = f.solveh_into(b);
}

#[test]
fn solveh_random_t() {
let a: Array2<f64> = random_hpd(3).reversed_axes();
let a: Array2<f64> = random_hpd_using(3).reversed_axes();
let x: Array1<f64> = random_using(3);
let b = a.dot(&x);
let y = a.solveh_into(b).unwrap();
Expand Down

0 comments on commit d6bde0c

Please sign in to comment.