Skip to content

Commit d7beae9

Browse files
committed
Check Lapack error properly
1 parent d5dcfd1 commit d7beae9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: algorithms/linfa-clustering/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ features = ["std", "derive"]
3030
[dependencies]
3131
ndarray = { version = "0.14", features = ["rayon", "approx"]}
3232
ndarray-linalg = "0.13"
33+
lax = "0.1"
3334
ndarray-rand = "0.13"
3435
ndarray-stats = "0.4"
3536
num-traits = "0.2"

Diff for: algorithms/linfa-clustering/src/gaussian_mixture/algorithm.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ mod tests {
463463
use super::*;
464464
use crate::generate_blobs;
465465
use approx::{abs_diff_eq, assert_abs_diff_eq};
466+
use lax::error::Error;
466467
use ndarray::{array, concatenate, ArrayView1, ArrayView2, Axis};
467468
use ndarray_linalg::error::LinalgError;
468469
use ndarray_linalg::error::Result as LAResult;
@@ -568,7 +569,8 @@ mod tests {
568569
assert!(
569570
match gmm.expect_err("should generate an error with reg_covar being nul") {
570571
GmmError::LinalgError(e) => match e {
571-
LinalgError::Lapack(_) => true,
572+
LinalgError::Lapack(Error::LapackComputationalFailure { return_code: 2 }) =>
573+
true,
572574
_ => panic!("should be a lapack error 2"),
573575
},
574576
_ => panic!("should be a linear algebra error"),
@@ -596,7 +598,8 @@ mod tests {
596598
assert!(
597599
match gmm.expect_err("should generate an error with reg_covar being nul") {
598600
GmmError::LinalgError(e) => match e {
599-
LinalgError::Lapack(_) => true,
601+
LinalgError::Lapack(Error::LapackComputationalFailure { return_code: 1 }) =>
602+
true,
600603
_ => panic!("should be a lapack error 1"),
601604
},
602605
_ => panic!("should be a linear algebra error"),

0 commit comments

Comments
 (0)