Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inverse crash #102

Merged
merged 9 commits into from
Dec 4, 2024
Merged
9 changes: 4 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- uses: actions/checkout@v3
with:
submodules: 'true'
submodules: "true"

- name: Install Clang
run: sudo apt-get install -y libclang-dev
Expand All @@ -51,9 +51,9 @@ jobs:
cargo clippy --examples -- -D warnings

- name: Run unit tests (debug)
run: cargo test --features "mpi,strict"
run: RUST_MIN_STACK=8388608 cargo test --features "mpi,strict"
- name: Run tests (release)
run: cargo test --examples --release --features "mpi,strict"
run: RUST_MIN_STACK=8388608 cargo test --examples --release --features "mpi,strict"
- name: Run examples
run: |
python3 find_examples.py --features "strict"
Expand Down Expand Up @@ -81,5 +81,4 @@ jobs:
run: cargo install cargo-upgrades
- uses: actions/checkout@v3
- name: Check that dependencies are up to date
run:
cargo upgrades
run: cargo upgrades
16 changes: 16 additions & 0 deletions tests/large_matrix.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use rlst::rlst_dynamic_array2;

#[test]
fn inverse_100() {
let size = 100;

let mut mat = rlst_dynamic_array2!(f64, [size, size]);

for index in 0..size {
mat[[index, index]] = 1.0;
}

mat.view_mut()
.into_inverse_alloc()
.expect("Inverse could not be computed.");
}
4 changes: 2 additions & 2 deletions tests/linalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ macro_rules! impl_inverse_tests {

#[test]
fn [<test_inverse_$scalar>]() {
let n = 4;
let n = 100;

let mut a = rlst_dynamic_array2!($scalar, [n, n]);
let mut b = rlst_dynamic_array2!($scalar, [n, n]);
Expand All @@ -35,7 +35,7 @@ macro_rules! impl_inverse_tests {

impl_inverse_tests!(f64, 1E-12);
impl_inverse_tests!(f32, 5E-6);
impl_inverse_tests!(c32, 5E-6);
impl_inverse_tests!(c32, 5E-5);
impl_inverse_tests!(c64, 1E-12);

macro_rules! impl_lu_tests {
Expand Down
Loading