Bump sprs to 0.10

This commit is contained in:
Magnus Ulimoen 2021-03-18 23:27:03 +01:00
parent 550b43b4cd
commit be984fbdac
6 changed files with 14 additions and 12 deletions

View File

@ -9,7 +9,7 @@ edition = "2018"
sbp = { path = "../sbp", features = ["sparse"] } sbp = { path = "../sbp", features = ["sparse"] }
ndarray = "0.14.0" ndarray = "0.14.0"
plotters = { version = "0.3.0", default-features = false, features = ["bitmap_gif", "bitmap_backend", "line_series"] } plotters = { version = "0.3.0", default-features = false, features = ["bitmap_gif", "bitmap_backend", "line_series"] }
sprs = { version = "0.9.0", default-features = false } sprs = { version = "0.10.0", default-features = false }
[dev-dependencies] [dev-dependencies]
arpack = { git = "https://github.com/mulimoen/arpack-rs", branch = "main" } arpack = { git = "https://github.com/mulimoen/arpack-rs", branch = "main" }

View File

@ -204,10 +204,11 @@ fn dual_dirichlet_sparse(v: ArrayView1<Float>, v0: Float, vn: Float) {
let rhs = move |fut: &mut Array1<Float>, prev: &Array1<Float>, _t: Float| { let rhs = move |fut: &mut Array1<Float>, prev: &Array1<Float>, _t: Float| {
fut.fill(0.0); fut.fill(0.0);
let prev = prev.as_slice().unwrap(); let prev = prev.as_slice().unwrap();
{
let fut = fut.as_slice_mut().unwrap(); let fut = fut.as_slice_mut().unwrap();
sprs::prod::mul_acc_mat_vec_csr(system.view(), prev, fut); sprs::prod::mul_acc_mat_vec_csr(system.view(), prev, fut);
}
let fut = fut.as_slice_mut().unwrap();
sprs::prod::mul_acc_mat_vec_csr(bc.view(), &[v0, vn][..], fut); sprs::prod::mul_acc_mat_vec_csr(bc.view(), &[v0, vn][..], fut);
}; };

View File

@ -10,7 +10,7 @@ sparse = ["sbp/sparse", "sprs"]
[dependencies] [dependencies]
ndarray = "0.14.0" ndarray = "0.14.0"
sbp = { path = "../sbp" } sbp = { path = "../sbp" }
sprs = { version = "0.9.0", optional = true, default-features = false } sprs = { version = "0.10.0", optional = true, default-features = false }
[dev-dependencies] [dev-dependencies]
criterion = "0.3.2" criterion = "0.3.2"

View File

@ -236,11 +236,11 @@ pub fn rhs_matrix(op: &dyn SbpOperator2d, grid: &super::Grid) -> Implicit {
/// RHS with some additional dissipation from the upwind operator /// RHS with some additional dissipation from the upwind operator
pub fn rhs_matrix_with_upwind_dissipation( pub fn rhs_matrix_with_upwind_dissipation(
op: &dyn UpwindOperator2d, op: impl UpwindOperator2d + SbpOperator2d,
grid: &super::Grid, grid: &super::Grid,
) -> sprs::CsMat<Float> { ) -> sprs::CsMat<Float> {
let rhs = rhs_matrix(op.as_sbp(), grid).rhs; let rhs = rhs_matrix(&op, grid).rhs;
let metrics = grid.metrics(op.as_sbp()).unwrap(); let metrics = grid.metrics(&op).unwrap();
let nx = grid.nx(); let nx = grid.nx();
let ny = grid.ny(); let ny = grid.ny();
@ -262,14 +262,14 @@ pub fn rhs_matrix_with_upwind_dissipation(
}; };
let diss_x = { let diss_x = {
let diss_x = UpwindOperator2d::op_xi(op).diss_matrix(nx); let diss_x = UpwindOperator2d::op_xi(&op).diss_matrix(nx);
let diss_x = kronecker_product(eye(ny).view(), diss_x.view()); let diss_x = kronecker_product(eye(ny).view(), diss_x.view());
let met = diss(metrics.detj_dxi_dx(), metrics.detj_dxi_dy()); let met = diss(metrics.detj_dxi_dx(), metrics.detj_dxi_dy());
&met * &kronecker_product(eye(3).view(), diss_x.view()) &met * &kronecker_product(eye(3).view(), diss_x.view())
}; };
let diss_y = { let diss_y = {
let diss_y = UpwindOperator2d::op_eta(op).diss_matrix(ny); let diss_y = UpwindOperator2d::op_eta(&op).diss_matrix(ny);
let diss_y = kronecker_product(diss_y.view(), eye(nx).view()); let diss_y = kronecker_product(diss_y.view(), eye(nx).view());
let met = diss(metrics.detj_deta_dx(), metrics.detj_deta_dy()); let met = diss(metrics.detj_deta_dx(), metrics.detj_deta_dy());
&met * &kronecker_product(eye(3).view(), diss_y.view()) &met * &kronecker_product(eye(3).view(), diss_y.view())

View File

@ -9,7 +9,7 @@ ndarray = { version = "0.14.0", features = ["approx"] }
approx = "0.4.0" approx = "0.4.0"
packed_simd = { version = "0.3.3", package = "packed_simd_2" } packed_simd = { version = "0.3.3", package = "packed_simd_2" }
rayon = { version = "1.3.0", optional = true } rayon = { version = "1.3.0", optional = true }
sprs = { version = "0.9.0", optional = true, default-features = false } sprs = { version = "0.10.0", optional = true, default-features = false }
serde = { version = "1.0.115", optional = true, default-features = false, features = ["derive"] } serde = { version = "1.0.115", optional = true, default-features = false, features = ["derive"] }
num-traits = "0.2.14" num-traits = "0.2.14"

View File

@ -111,12 +111,13 @@ impl super::SbpOperator1d2 for SBP4 {
// d_x => -d_x when reversed // d_x => -d_x when reversed
d1.iter_mut().for_each(|v| *v *= -1.0); d1.iter_mut().for_each(|v| *v *= -1.0);
// Indices are now in reverse order // Indices are now in reverse order
sprs::CsMat::new( sprs::CsMat::new_from_unsorted(
(1, n), (1, n),
vec![0, d1.len()], vec![0, d1.len()],
(0..n).rev().take(d1.len()).collect(), (0..n).rev().take(d1.len()).collect(),
d1, d1,
) )
.unwrap()
} }
} }
} }