pub trait KLinOp: Send + Sync {
type Scalar: KrystScalar;
// Required methods
fn dims(&self) -> (usize, usize);
fn matvec_s(
&self,
x: &[Self::Scalar],
y: &mut [Self::Scalar],
scratch: &mut BridgeScratch,
);
// Provided methods
fn supports_t_matvec_s(&self) -> bool { ... }
fn t_matvec_s(
&self,
_x: &[Self::Scalar],
_y: &mut [Self::Scalar],
_scratch: &mut BridgeScratch,
) { ... }
}Expand description
Internal, scalar-generic linear operator for solvers.
Forward-looking notes:
- Additional operator kinds (transpose/adjoint, batched calls) can be added later without breaking object safety.
- When the public API becomes scalar generic, this trait can be re-exported directly.
Required Associated Types§
type Scalar: KrystScalar
Required Methods§
Sourcefn matvec_s(
&self,
x: &[Self::Scalar],
y: &mut [Self::Scalar],
scratch: &mut BridgeScratch,
)
fn matvec_s( &self, x: &[Self::Scalar], y: &mut [Self::Scalar], scratch: &mut BridgeScratch, )
Perform y <- A x.
scratch allows adapters to reuse temporary buffers when bridging
between scalar types. Native-S implementations may ignore it.
Provided Methods§
Sourcefn supports_t_matvec_s(&self) -> bool
fn supports_t_matvec_s(&self) -> bool
Whether the operator exposes a transpose/adjoint matvec.
Sourcefn t_matvec_s(
&self,
_x: &[Self::Scalar],
_y: &mut [Self::Scalar],
_scratch: &mut BridgeScratch,
)
fn t_matvec_s( &self, _x: &[Self::Scalar], _y: &mut [Self::Scalar], _scratch: &mut BridgeScratch, )
Perform y <- A^T x (or A^H x in complex builds).
Default implementation panics unless overridden by operators that
advertise transpose support via supports_t_matvec_s.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl KLinOp for GenericCsrOp<Complex64>
Available on crate features backend-faer and complex only.
impl KLinOp for GenericCsrOp<Complex64>
Available on crate features
backend-faer and complex only.