Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLS Refactor] ProbabilisticLinearSolverState, LinearSystemBelief and LinearSolverPolicy #460

Merged

Conversation

JonathanWenger
Copy link
Contributor

@JonathanWenger JonathanWenger commented Jul 7, 2021

In a Nutshell

First components for the new compositional structure of the ProbabilisticLinearSolver. Will be followed up with more PRs adding the remaining components.

Detailed Description

This PR begins the refactoring of the probabilistic linear solver into a compositional pattern and adds the following component classes:

  • LinearSystemBelief
  • ProbabilisticLinearSolverState
  • LinearSolverPolicy, incl. sub-classes implementing a random and deterministic policy

It also restructures the probnum.linalg API reference into a more understandable hierarchy in line with the module and semantic structure.

Note that this PR leaves the original implementation intact until all components of the new solver are included.

Related Issues

First part of #51 and supersedes part of #283.

@JonathanWenger JonathanWenger changed the title [PLS Refactor] LinearSolverState, LinearSystemBelief and LinearSolverPolicy [PLS Refactor] LinearSolverState, LinearSystemBelief and ProbabilisticLinearSolverPolicy Jul 13, 2021
@JonathanWenger JonathanWenger changed the title [PLS Refactor] LinearSolverState, LinearSystemBelief and ProbabilisticLinearSolverPolicy [PLS Refactor] ProbabilisticLinearSolverState, LinearSystemBelief and LinearSolverPolicy Jul 13, 2021
@JonathanWenger JonathanWenger mentioned this pull request Jul 13, 2021
Copy link
Collaborator

@marvinpfoertner marvinpfoertner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice :)

@property
def residuals(self) -> Tuple[np.ndarray, ...]:
r"""Residuals :math:`\{Ax_i - b\}_i`."""
return tuple(self._residuals)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be nasty for an outside user, since it is not really transparent when the residuals are None and when they are np.ndarray.
I think it's fine for now though.

@@ -194,6 +194,26 @@ class LinearSystem:
# For testing and benchmarking
solution: Optional[Union[np.ndarray, randvars.RandomVariable]] = None

@classmethod
def from_matrix(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer the random_linear_system, but don't feel obliged to change things if this causes inconvenience.

@JonathanWenger JonathanWenger merged commit 95df418 into probabilistic-numerics:main Jul 18, 2021
@JonathanWenger JonathanWenger deleted the linsolve-policy branch July 18, 2021 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linalg Issues related to linear algebra refactoring Refactoring of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants