From 7e5435d5db93b12a4f87b680c55e4654082e049a Mon Sep 17 00:00:00 2001 From: sarah Date: Sun, 29 Sep 2024 22:31:38 +0200 Subject: [PATCH] update dynstack --- src/linalg/cholesky/piv_llt/mod.rs | 2 +- src/linop/bicgstab.rs | 4 +-- src/linop/conjugate_gradient.rs | 4 +-- src/linop/linop_impl/csc_matmut.rs | 8 ++--- src/linop/linop_impl/csc_matown.rs | 8 ++--- src/linop/linop_impl/csc_matref.rs | 8 ++--- src/linop/linop_impl/csr_matmut.rs | 8 ++--- src/linop/linop_impl/csr_matown.rs | 8 ++--- src/linop/linop_impl/csr_matref.rs | 8 ++--- src/linop/linop_impl/diagmut.rs | 16 ++++----- src/linop/linop_impl/diagown.rs | 16 ++++----- src/linop/linop_impl/diagref.rs | 16 ++++----- src/linop/linop_impl/matmut.rs | 8 ++--- src/linop/linop_impl/matown.rs | 8 ++--- src/linop/linop_impl/matref.rs | 8 ++--- src/linop/lsmr.rs | 6 ++-- src/linop/mod.rs | 53 ++++++++++++++++-------------- 17 files changed, 97 insertions(+), 92 deletions(-) diff --git a/src/linalg/cholesky/piv_llt/mod.rs b/src/linalg/cholesky/piv_llt/mod.rs index 6249a338..c039d656 100644 --- a/src/linalg/cholesky/piv_llt/mod.rs +++ b/src/linalg/cholesky/piv_llt/mod.rs @@ -48,7 +48,7 @@ pub mod compute { perm: &'out mut [I], perm_inv: &'out mut [I], parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, params: PivLltParams, ) -> Result<(PivLltInfo, PermRef<'out, I>), CholeskyError> { assert!(a.nrows() == a.ncols()); diff --git a/src/linop/bicgstab.rs b/src/linop/bicgstab.rs index bd1e02b6..ce658e4b 100644 --- a/src/linop/bicgstab.rs +++ b/src/linop/bicgstab.rs @@ -138,7 +138,7 @@ pub fn bicgstab( params: BicgParams, callback: impl FnMut(MatRef<'_, E>), parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) -> Result, BicgError> { #[track_caller] fn implementation( @@ -150,7 +150,7 @@ pub fn bicgstab( params: BicgParams, callback: &mut dyn FnMut(MatRef<'_, E>), parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) -> Result, BicgError> { let mut x = out; let A = mat; diff --git a/src/linop/conjugate_gradient.rs b/src/linop/conjugate_gradient.rs index 3ee2617f..785a48ee 100644 --- a/src/linop/conjugate_gradient.rs +++ b/src/linop/conjugate_gradient.rs @@ -133,7 +133,7 @@ pub fn conjugate_gradient( params: CgParams, callback: impl FnMut(MatRef<'_, E>), parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) -> Result, CgError> { #[track_caller] fn implementation( @@ -145,7 +145,7 @@ pub fn conjugate_gradient( params: CgParams, callback: &mut dyn FnMut(MatRef<'_, E>), parallelism: Parallelism, - mut stack: PodStack<'_>, + mut stack: &mut PodStack, ) -> Result, CgError> { assert!(A.nrows() == A.ncols()); diff --git a/src/linop/linop_impl/csc_matmut.rs b/src/linop/linop_impl/csc_matmut.rs index bac2f094..0b731ce0 100644 --- a/src/linop/linop_impl/csc_matmut.rs +++ b/src/linop/linop_impl/csc_matmut.rs @@ -33,7 +33,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -45,7 +45,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -70,7 +70,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -82,7 +82,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } diff --git a/src/linop/linop_impl/csc_matown.rs b/src/linop/linop_impl/csc_matown.rs index 9e141a61..7d4650ae 100644 --- a/src/linop/linop_impl/csc_matown.rs +++ b/src/linop/linop_impl/csc_matown.rs @@ -33,7 +33,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -45,7 +45,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -70,7 +70,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -82,7 +82,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } diff --git a/src/linop/linop_impl/csc_matref.rs b/src/linop/linop_impl/csc_matref.rs index 37b0e45b..d78b5181 100644 --- a/src/linop/linop_impl/csc_matref.rs +++ b/src/linop/linop_impl/csc_matref.rs @@ -34,7 +34,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; crate::sparse::linalg::matmul::sparse_dense_matmul( @@ -54,7 +54,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.conjugate(); @@ -89,7 +89,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.transpose(); @@ -110,7 +110,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.adjoint(); diff --git a/src/linop/linop_impl/csr_matmut.rs b/src/linop/linop_impl/csr_matmut.rs index f14c23cf..dcea39a3 100644 --- a/src/linop/linop_impl/csr_matmut.rs +++ b/src/linop/linop_impl/csr_matmut.rs @@ -33,7 +33,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -45,7 +45,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -70,7 +70,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -82,7 +82,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } diff --git a/src/linop/linop_impl/csr_matown.rs b/src/linop/linop_impl/csr_matown.rs index beb672d3..399852f0 100644 --- a/src/linop/linop_impl/csr_matown.rs +++ b/src/linop/linop_impl/csr_matown.rs @@ -33,7 +33,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -45,7 +45,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -70,7 +70,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -82,7 +82,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } diff --git a/src/linop/linop_impl/csr_matref.rs b/src/linop/linop_impl/csr_matref.rs index e2014dd4..9f256a40 100644 --- a/src/linop/linop_impl/csr_matref.rs +++ b/src/linop/linop_impl/csr_matref.rs @@ -34,7 +34,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; crate::sparse::linalg::matmul::dense_sparse_matmul( @@ -54,7 +54,7 @@ impl> LinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.conjugate(); @@ -89,7 +89,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.transpose(); @@ -110,7 +110,7 @@ impl> BiLinOp out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.adjoint(); diff --git a/src/linop/linop_impl/diagmut.rs b/src/linop/linop_impl/diagmut.rs index 34d52e16..33ae6480 100644 --- a/src/linop/linop_impl/diagmut.rs +++ b/src/linop/linop_impl/diagmut.rs @@ -30,7 +30,7 @@ impl> LinOp for DiagMut<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -40,7 +40,7 @@ impl> LinOp for DiagMut<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -61,7 +61,7 @@ impl> BiLinOp for DiagMut<'_ out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -71,7 +71,7 @@ impl> BiLinOp for DiagMut<'_ out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } @@ -86,7 +86,7 @@ impl> Precond for DiagMut<'_ self.as_ref().apply_in_place_req(rhs_ncols, parallelism) } - fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: PodStack<'_>) { + fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: &mut PodStack) { self.as_ref().apply_in_place(rhs, parallelism, stack) } @@ -94,7 +94,7 @@ impl> Precond for DiagMut<'_ &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply_in_place(rhs, parallelism, stack) } @@ -113,7 +113,7 @@ impl> BiPrecond for DiagMut< &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref() .transpose_apply_in_place(rhs, parallelism, stack) @@ -123,7 +123,7 @@ impl> BiPrecond for DiagMut< &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref() .adjoint_apply_in_place(rhs, parallelism, stack) diff --git a/src/linop/linop_impl/diagown.rs b/src/linop/linop_impl/diagown.rs index d4451253..3c3424b3 100644 --- a/src/linop/linop_impl/diagown.rs +++ b/src/linop/linop_impl/diagown.rs @@ -30,7 +30,7 @@ impl> LinOp for Diag out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().apply(out, rhs, parallelism, stack) } @@ -40,7 +40,7 @@ impl> LinOp for Diag out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply(out, rhs, parallelism, stack) } @@ -61,7 +61,7 @@ impl> BiLinOp for Diag, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().transpose_apply(out, rhs, parallelism, stack) } @@ -71,7 +71,7 @@ impl> BiLinOp for Diag, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().adjoint_apply(out, rhs, parallelism, stack) } @@ -86,7 +86,7 @@ impl> Precond for Diag, parallelism: Parallelism, stack: PodStack<'_>) { + fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: &mut PodStack) { self.as_ref().apply_in_place(rhs, parallelism, stack) } @@ -94,7 +94,7 @@ impl> Precond for Diag, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref().conj_apply_in_place(rhs, parallelism, stack) } @@ -113,7 +113,7 @@ impl> BiPrecond for Diag, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref() .transpose_apply_in_place(rhs, parallelism, stack) @@ -123,7 +123,7 @@ impl> BiPrecond for Diag, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.as_ref() .adjoint_apply_in_place(rhs, parallelism, stack) diff --git a/src/linop/linop_impl/diagref.rs b/src/linop/linop_impl/diagref.rs index 87d4cac0..cdd343ca 100644 --- a/src/linop/linop_impl/diagref.rs +++ b/src/linop/linop_impl/diagref.rs @@ -33,7 +33,7 @@ impl> LinOp for DiagRef<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { let k = rhs.ncols(); _ = parallelism; @@ -51,7 +51,7 @@ impl> LinOp for DiagRef<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.column_vector() .conjugate() @@ -75,7 +75,7 @@ impl> BiLinOp for DiagRef<'_ out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.apply(out, rhs, parallelism, stack); } @@ -85,7 +85,7 @@ impl> BiLinOp for DiagRef<'_ out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.conj_apply(out, rhs, parallelism, stack); } @@ -102,7 +102,7 @@ impl> Precond for DiagRef<'_ Ok(StackReq::empty()) } - fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: PodStack<'_>) { + fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: &mut PodStack) { _ = parallelism; _ = stack; let mut rhs = rhs; @@ -118,7 +118,7 @@ impl> Precond for DiagRef<'_ &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.column_vector() .conjugate() @@ -139,7 +139,7 @@ impl> BiPrecond for DiagRef< &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.apply_in_place(rhs, parallelism, stack) } @@ -148,7 +148,7 @@ impl> BiPrecond for DiagRef< &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { self.conj_apply_in_place(rhs, parallelism, stack) } diff --git a/src/linop/linop_impl/matmut.rs b/src/linop/linop_impl/matmut.rs index b4f3d306..0de54eb2 100644 --- a/src/linop/linop_impl/matmut.rs +++ b/src/linop/linop_impl/matmut.rs @@ -32,7 +32,7 @@ impl> LinOp for MatMut<'_, V out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.rb(); @@ -46,7 +46,7 @@ impl> LinOp for MatMut<'_, V out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.rb().conjugate(); @@ -72,7 +72,7 @@ impl> BiLinOp for MatMut<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.rb().transpose(); @@ -86,7 +86,7 @@ impl> BiLinOp for MatMut<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.rb().adjoint(); diff --git a/src/linop/linop_impl/matown.rs b/src/linop/linop_impl/matown.rs index 27e87808..f2580f52 100644 --- a/src/linop/linop_impl/matown.rs +++ b/src/linop/linop_impl/matown.rs @@ -31,7 +31,7 @@ impl> LinOp for Mat { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.as_ref(); @@ -45,7 +45,7 @@ impl> LinOp for Mat { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.as_ref().conjugate(); @@ -71,7 +71,7 @@ impl> BiLinOp for Mat out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.as_ref().transpose(); @@ -85,7 +85,7 @@ impl> BiLinOp for Mat out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.as_ref().adjoint(); diff --git a/src/linop/linop_impl/matref.rs b/src/linop/linop_impl/matref.rs index d45dc8e6..1e06c0b3 100644 --- a/src/linop/linop_impl/matref.rs +++ b/src/linop/linop_impl/matref.rs @@ -31,7 +31,7 @@ impl> LinOp for MatRef<'_, V out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; crate::linalg::matmul::matmul(out, *self, rhs, None, E::faer_one(), parallelism); @@ -44,7 +44,7 @@ impl> LinOp for MatRef<'_, V out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.conjugate(); @@ -70,7 +70,7 @@ impl> BiLinOp for MatRef<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.transpose(); @@ -84,7 +84,7 @@ impl> BiLinOp for MatRef<'_, out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { _ = stack; let this = self.adjoint(); diff --git a/src/linop/lsmr.rs b/src/linop/lsmr.rs index 8335b889..a10ce3fb 100644 --- a/src/linop/lsmr.rs +++ b/src/linop/lsmr.rs @@ -348,7 +348,7 @@ pub fn lsmr( params: LsmrParams, callback: impl FnMut(MatRef<'_, E>), parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) -> Result, LsmrError> { #[track_caller] fn implementation( @@ -359,14 +359,14 @@ pub fn lsmr( params: LsmrParams, callback: &mut dyn FnMut(MatRef<'_, E>), par: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) -> Result, LsmrError> { fn thin_qr( mut Q: MatMut<'_, E>, mut R: MatMut<'_, E>, mut mat: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { let k = R.nrows(); let bs = qr::no_pivoting::compute::recommended_blocksize::(mat.nrows(), mat.ncols()); diff --git a/src/linop/mod.rs b/src/linop/mod.rs index 727e8b6a..9f2cef1a 100644 --- a/src/linop/mod.rs +++ b/src/linop/mod.rs @@ -58,7 +58,7 @@ impl LinOp for IdentityPrecond { out: MatMut<'_, E>, rhs: MatRef<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { { out }.copy_from(rhs); } @@ -69,7 +69,7 @@ impl LinOp for IdentityPrecond { out: MatMut<'_, E>, rhs: MatRef<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { { out }.copy_from(rhs); } @@ -91,7 +91,7 @@ impl BiLinOp for IdentityPrecond { out: MatMut<'_, E>, rhs: MatRef<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { { out }.copy_from(rhs); } @@ -102,7 +102,7 @@ impl BiLinOp for IdentityPrecond { out: MatMut<'_, E>, rhs: MatRef<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { { out }.copy_from(rhs); } @@ -116,14 +116,19 @@ impl Precond for IdentityPrecond { Ok(StackReq::empty()) } - fn apply_in_place(&self, _rhs: MatMut<'_, E>, _parallelism: Parallelism, _stack: PodStack<'_>) { + fn apply_in_place( + &self, + _rhs: MatMut<'_, E>, + _parallelism: Parallelism, + _stack: &mut PodStack, + ) { } fn conj_apply_in_place( &self, _rhs: MatMut<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { } } @@ -140,7 +145,7 @@ impl BiPrecond for IdentityPrecond { &self, _rhs: MatMut<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { } @@ -148,7 +153,7 @@ impl BiPrecond for IdentityPrecond { &self, _rhs: MatMut<'_, E>, _parallelism: Parallelism, - _stack: PodStack<'_>, + _stack: &mut PodStack, ) { } } @@ -174,7 +179,7 @@ pub trait LinOp: Sync + core::fmt::Debug { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ); /// Applies the conjugate of `self` to `rhs`, and stores the result in `out`. @@ -183,7 +188,7 @@ pub trait LinOp: Sync + core::fmt::Debug { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ); } @@ -203,7 +208,7 @@ pub trait BiLinOp: LinOp { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ); /// Applies the adjoint of `self` to `rhs`, and stores the result in `out`. @@ -212,7 +217,7 @@ pub trait BiLinOp: LinOp { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ); } @@ -232,7 +237,7 @@ pub trait Precond: LinOp { /// Applies `self` to `rhs`, and stores the result in `rhs`. #[track_caller] - fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: PodStack<'_>) { + fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: &mut PodStack) { let (mut tmp, stack) = temp_mat_uninit::(self.nrows(), rhs.ncols(), stack); self.apply(tmp.rb_mut(), rhs.rb(), parallelism, stack); { rhs }.copy_from(&tmp); @@ -244,7 +249,7 @@ pub trait Precond: LinOp { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { let (mut tmp, stack) = temp_mat_uninit::(self.nrows(), rhs.ncols(), stack); self.conj_apply(tmp.rb_mut(), rhs.rb(), parallelism, stack); @@ -273,7 +278,7 @@ pub trait BiPrecond: Precond + BiLinOp { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { let (mut tmp, stack) = temp_mat_uninit::(self.nrows(), rhs.ncols(), stack); self.transpose_apply(tmp.rb_mut(), rhs.rb(), parallelism, stack); @@ -286,7 +291,7 @@ pub trait BiPrecond: Precond + BiLinOp { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { let (mut tmp, stack) = temp_mat_uninit::(self.nrows(), rhs.ncols(), stack); self.adjoint_apply(tmp.rb_mut(), rhs.rb(), parallelism, stack); @@ -321,7 +326,7 @@ impl> LinOp for &T { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).apply(out, rhs, parallelism, stack) } @@ -333,7 +338,7 @@ impl> LinOp for &T { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).conj_apply(out, rhs, parallelism, stack) } @@ -357,7 +362,7 @@ impl> BiLinOp for &T { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).transpose_apply(out, rhs, parallelism, stack) } @@ -369,7 +374,7 @@ impl> BiLinOp for &T { out: MatMut<'_, E>, rhs: MatRef<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).adjoint_apply(out, rhs, parallelism, stack) } @@ -384,7 +389,7 @@ impl> Precond for &T { (**self).apply_in_place_req(rhs_ncols, parallelism) } - fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: PodStack<'_>) { + fn apply_in_place(&self, rhs: MatMut<'_, E>, parallelism: Parallelism, stack: &mut PodStack) { (**self).apply_in_place(rhs, parallelism, stack); } @@ -392,7 +397,7 @@ impl> Precond for &T { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).conj_apply_in_place(rhs, parallelism, stack); } @@ -411,7 +416,7 @@ impl> BiPrecond for &T { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).transpose_apply_in_place(rhs, parallelism, stack); } @@ -420,7 +425,7 @@ impl> BiPrecond for &T { &self, rhs: MatMut<'_, E>, parallelism: Parallelism, - stack: PodStack<'_>, + stack: &mut PodStack, ) { (**self).adjoint_apply_in_place(rhs, parallelism, stack); }