pub struct DirectLagrangeSolver {
pub n: usize,
/* private fields */
}Expand description
Direct Lagrangian solver over an (N+1)x(N+1) augmented CSC system.
Mirrors Python solve_direct_lagrange: the augmented matrix is
[[K, c], [c^T, 0]] assembled by assemble_torsion_lagrange, solved with
RHS [f, 0]; the multiplier magnitude must satisfy
|uN| / max|u| <= 1e-7.
Fields§
§n: usizeSize of the leading K block.
Implementations§
Source§impl DirectLagrangeSolver
impl DirectLagrangeSolver
Sourcepub fn assemble_torsion_lagrange(k: &SparseMatrix, c: &[f64]) -> CscMatrix
pub fn assemble_torsion_lagrange(k: &SparseMatrix, c: &[f64]) -> CscMatrix
Assemble the augmented Lagrangian matrix exactly as Python
Section.assemble_torsion does: [[K, c], [c^T, 0]] in CSC format.
Sourcepub fn new(k: &SparseMatrix, c: &[f64]) -> Result<Self, FemError>
pub fn new(k: &SparseMatrix, c: &[f64]) -> Result<Self, FemError>
Factor using the default backend: the skyline LDL^T, which is self-contained and robust.
PARDISO is powerful but demands a fully provisioned MKL runtime;
select it explicitly via DirectLagrangeSolver::with_kernel when
the environment is known to be complete.
Sourcepub fn with_kernel(
kernel: LagrangeKernel,
k: &SparseMatrix,
c: &[f64],
opts: SolverOptions,
) -> Result<Self, FemError>
pub fn with_kernel( kernel: LagrangeKernel, k: &SparseMatrix, c: &[f64], opts: SolverOptions, ) -> Result<Self, FemError>
Factor with an explicit kernel and options.
Sourcepub fn solve(&self, f: &[f64]) -> Result<Vec<f64>, FemError>
pub fn solve(&self, f: &[f64]) -> Result<Vec<f64>, FemError>
Solve [K c; c^T 0] [u; lam] = [f; 0] and return u.
Sourcepub fn solve_full(&self, f: &[f64]) -> Result<(Vec<f64>, f64), FemError>
pub fn solve_full(&self, f: &[f64]) -> Result<(Vec<f64>, f64), FemError>
Solve returning (u, lambda).
Sourcepub fn multiplier_error(&self, f: &[f64], u: &[f64]) -> f64
pub fn multiplier_error(&self, f: &[f64], u: &[f64]) -> f64
Multiplier error metric |lam| / max|u| (Python’s u[-1]/max|u|).