Skip to content

Add a LinearSolve algorithm that wraps lstsq — the LinearSolve extension cannot solve rank-deficient/inconsistent A #10

@ChrisRackauckas-Claude

Description

@ChrisRackauckas-Claude

WHAT: ext/SparseWithDenseRowColMatricesLinearSolveExt.jl has zero references to lstsq/LeastSquares/pinv. Both existing algs (SWDRCFactorizationAlg, SWDRCQRFactorizationAlg) map a singular A to ReturnCode.Infeasible (lines 104-106, 166-168), so there is no way to get the min-norm A⁺b through the LinearSolve interface despite the full lstsq machinery existing. WHY IT MATTERS: LinearSolve is the standard SciML entry point and the natural home for the cached factorization; users in a LinearSolve pipeline cannot reach lstsq at all. FIX: Add SWDRCLeastSquaresAlg (mirroring the QR alg): init_cacheval builds a SparseWithDenseRowColLeastSquares (dense-COD fallback when structured doesn't apply), solve! does ldiv!(cache.u, F, cache.b), and once the LS refactor! lands its _refresh! reuses symbolic analysis across cache.A updates. Expose a public SparseWithDenseRowColLeastSquaresFactorization(; alg=:auto, tolC=...) in src/factorize.jl. Add a test/test_linearsolve.jl block (currently only LU+QR algs tested). Best done after or alongside the LS refactor! issue. EFFORT: M.


Priority: high. Filed from an automated next-steps audit of the QR/lstsq work (see PR #6).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions