Skip to content

Implement Normal, a solver applying an inner solver to the normal equations#159

Merged
patrick-kidger merged 1 commit intopatrick-kidger:devfrom
adconner:push-yrqkxpnnulwu
Dec 5, 2025
Merged

Implement Normal, a solver applying an inner solver to the normal equations#159
patrick-kidger merged 1 commit intopatrick-kidger:devfrom
adconner:push-yrqkxpnnulwu

Conversation

@adconner
Copy link
Contributor

@adconner adconner commented Jun 9, 2025

This fixes #157 by implementing what we discussed there, a wrapper which takes any solver and applies it to the normal equations.

I've stacked this change atop #158 as the implementation is significantly cleaner taken with the change there.

This currently includes the breaking change of removing lx.NormalCG(...) in favor of lx.Normal(lx.CG(...)), so perhaps a simple definition should be made for backward compatibility. It was not clear how I should handle that from the standpoint of the documentation, as the following suffices

def NormalCG(rtol: float,
        atol: float,
        norm: Callable[[PyTree], Scalar] = max_norm,
        stabilise_every: int | None = 10,
        max_steps: int | None = None):
    return Normal(CG(rtol,atol,norm,stabilise_every,max_steps))

but now the name NormalCG is a function, not a class, and its not clear if it be documented along with the other solvers. Would you want to add the above as an alternative, possibly deprecated interface? And if so should it be documented, and if so how?

@patrick-kidger
Copy link
Owner

Looks like the test failures are from #172 and unrelated, so merging!

@patrick-kidger patrick-kidger merged commit 8d96e7c into patrick-kidger:dev Dec 5, 2025
0 of 2 checks passed
@patrick-kidger patrick-kidger mentioned this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: NormalCG jvp can do CG on singular systems

2 participants