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

Linop diagonal #820

Merged
merged 6 commits into from
May 10, 2023
Merged

Conversation

timweiland
Copy link
Collaborator

In a Nutshell

Add LinearOperator.diagonal().

Detailed Description

... which computes the diagonal of the linear operator. Default implementation uses np.diagonal, and subclasses may use more efficient implementations, e.g. for Kronecker linear operators.

"Future work"

  • Figure out a good way to compute the diagonal of a kronecker product when the second factor is not square
  • Implement diagonal of a covariance linear operator (shouldn't be too hard since it gets both inputs as arguments, but then you would possibly have to reshape and call the covariance function so that it only computes the diagonal)

... which computes the diagonal of the linear operator. Default
implementation uses `np.diagonal`, and subclasses may use more efficient
implementations, e.g. for Kronecker linear operators.
@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@555485f). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #820   +/-   ##
=======================================
  Coverage        ?   91.17%           
=======================================
  Files           ?      218           
  Lines           ?     8241           
  Branches        ?     1068           
=======================================
  Hits            ?     7514           
  Misses          ?      499           
  Partials        ?      228           
Impacted Files Coverage Δ
src/probnum/linops/_arithmetic_fallbacks.py 86.84% <ø> (ø)
src/probnum/linops/_block.py 96.05% <100.00%> (ø)
src/probnum/linops/_kronecker.py 92.70% <100.00%> (ø)
src/probnum/linops/_linear_operator.py 87.52% <100.00%> (ø)
src/probnum/linops/_scaling.py 87.28% <100.00%> (ø)

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.

🙏🏻

@timweiland timweiland merged commit 65f5604 into probabilistic-numerics:main May 10, 2023
@timweiland timweiland deleted the linop_diagonal branch May 10, 2023 10:22
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.

2 participants