kryst 3.2.1

Krylov subspace and preconditioned iterative solvers for dense and sparse linear systems, with shared and distributed memory parallelism.
//! KSP/PC context types and factories.
//!
//! Most users configure solvers through [`KspContext`], which owns the solver type,
//! preconditioner choice, operator bindings, and the `setup -> solve` lifecycle.
//! Preconditioner construction helpers live in [`pc_context`].
//!
//! ## Lifecycle (summary)
//! 1. `set_type` / `set_pc_type` / `set_from_options`
//! 2. `set_operators(Amat, Pmat)`
//! 3. `setup()` (idempotent; reuses cached structure/values when possible)
//! 4. `solve(b, x)`
//!
//! ## Example
//! ```rust,no_run
//! use kryst::prelude::*;
//! use std::sync::Arc;
//!
//! struct IdentityOp(usize);
//! impl LinOp for IdentityOp {
//!     type S = S;
//!
//!     fn dims(&self) -> (usize, usize) {
//!         (self.0, self.0)
//!     }
//!
//!     fn matvec(&self, x: &[S], y: &mut [S]) {
//!         y.copy_from_slice(x);
//!     }
//!
//!     fn as_any(&self) -> &dyn std::any::Any {
//!         self
//!     }
//! }
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let op: Arc<dyn LinOp<S = S>> = Arc::new(IdentityOp(4));
//! let b = vec![S::from_real(1.0); 4];
//! let mut x = vec![S::zero(); 4];
//!
//! let mut ksp = KspContext::new();
//! ksp.set_type(SolverType::Gmres)?;
//! ksp.set_pc_type(PcType::None, None)?;
//! ksp.set_operators(op, None);
//! let _stats = ksp.solve(&b, &mut x)?;
//! # Ok(()) }
//! ```

pub mod ksp_context;
pub use ksp_context::{KspContext, MonitorPolicy};
pub mod pc_context;
pub use pc_context::{DeferredPcInfo, NoOpPreconditioner, PcFactory, PcType, SparsityPattern};