From b74a476ecec4df44dadb597f1ffd5b5d6f0579c3 Mon Sep 17 00:00:00 2001 From: Srinath Kailasa Date: Mon, 18 Dec 2023 12:41:12 +0000 Subject: [PATCH] Fix new rlst for tree --- tree/Cargo.toml | 3 ++- tree/src/implementations/helpers.rs | 17 +++++++++++------ tree/src/implementations/impl_domain.rs | 4 ++-- tree/src/implementations/impl_morton.rs | 6 +++--- tree/src/implementations/impl_single_node.rs | 2 +- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tree/Cargo.toml b/tree/Cargo.toml index ea9084c9..d0efda33 100644 --- a/tree/Cargo.toml +++ b/tree/Cargo.toml @@ -21,7 +21,8 @@ memoffset = "0.6" rand = "0.8.*" hyksort = { path = "../hyksort", optional = true } bempp-traits = { path = "../traits" } -rlst = { git = "https://github.com/linalg-rs/rlst.git" , branch = "legacy"} +rlst-dense = { git = "https://github.com/linalg-rs/rlst.git" } + num = "0.4" [features] diff --git a/tree/src/implementations/helpers.rs b/tree/src/implementations/helpers.rs index a05e17cc..f4513f00 100644 --- a/tree/src/implementations/helpers.rs +++ b/tree/src/implementations/helpers.rs @@ -6,17 +6,22 @@ use num::Float; use rand::prelude::*; use rand::SeedableRng; -use rlst::dense::{base_matrix::BaseMatrix, rlst_dynamic_mat, Dynamic, Matrix, VectorContainer}; +// use rlst::dense::{base_matrix::BaseMatrix, rlst_dynamic_mat, Dynamic, Matrix, VectorContainer}; +use rlst_dense::{ + array::Array, base_array::BaseArray, data_container::VectorContainer, rlst_dynamic_array2, +}; + /// Alias for an rlst container for point data. -pub type PointsMat = Matrix, Dynamic>, Dynamic>; +pub type PointsMat = Array, 2>, 2>; + /// Points fixture for testing, uniformly samples in each axis from min to max. /// /// # Arguments /// * `npoints` - The number of points to sample. -/// # `min` - The minumum coordinate value along each axis. -/// # `max` - The maximum coordinate value along each axis. +/// * `min` - The minumum coordinate value along each axis. +/// * `max` - The maximum coordinate value along each axis. pub fn points_fixture( npoints: usize, min: Option, @@ -32,7 +37,7 @@ pub fn points_fixture Domain { #[cfg(test)] mod test { use bempp_traits::types::Scalar; - use rlst::dense::{RawAccess, Shape}; + use rlst_dense::traits::{RawAccess, Shape}; use crate::implementations::helpers::{points_fixture, points_fixture_col, PointsMat}; @@ -80,7 +80,7 @@ mod test { assert!(domain.diameter.iter().all(|&x| x == domain.diameter[0])); // Test that all local points are contained within the local domain - let npoints = points.shape().0; + let npoints = points.shape()[0]; for i in 0..npoints { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; diff --git a/tree/src/implementations/impl_morton.rs b/tree/src/implementations/impl_morton.rs index 4f2a1f78..d56af27a 100644 --- a/tree/src/implementations/impl_morton.rs +++ b/tree/src/implementations/impl_morton.rs @@ -1005,7 +1005,7 @@ impl MortonKeyInterface for MortonKey { #[cfg(test)] mod test { use itertools::Itertools; - use rlst::dense::{RawAccess, Shape}; + use rlst_dense::traits::{RawAccess, Shape}; use std::vec; use crate::implementations::helpers::points_fixture; @@ -1187,7 +1187,7 @@ mod test { let mut keys: Vec = Vec::new(); - for i in 0..points.shape().0 { + for i in 0..points.shape()[0] { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; keys.push(MortonKey::from_point(&point, &domain, DEEPEST_LEVEL)); @@ -1471,7 +1471,7 @@ mod test { let mut keys = Vec::new(); - for i in 0..points.shape().0 { + for i in 0..points.shape()[0] { let point = [points[[i, 0]], points[[i, 1]], points[[i, 2]]]; keys.push(MortonKey::from_point(&point, &domain, DEEPEST_LEVEL)) } diff --git a/tree/src/implementations/impl_single_node.rs b/tree/src/implementations/impl_single_node.rs index 07533013..62003b76 100644 --- a/tree/src/implementations/impl_single_node.rs +++ b/tree/src/implementations/impl_single_node.rs @@ -664,7 +664,7 @@ where #[cfg(test)] mod test { - use rlst::dense::RawAccess; + use rlst_dense::traits::RawAccess; use crate::implementations::helpers::{points_fixture, points_fixture_col};