-
Notifications
You must be signed in to change notification settings - Fork 10
Add cholesky overload for tracer matrices
#322
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,31 @@ function LinearAlgebra.eigen( | |
| return LinearAlgebra.Eigen(values, vectors) | ||
| end | ||
|
|
||
| ## Cholesky | ||
| # A generic `cholesky` compares matrix entries (pivoting / positive-definiteness), which on tracers | ||
| # return a tracer rather than a `Bool`. Like `eigen`, return a conservative all-depends factor. | ||
| function LinearAlgebra.cholesky( | ||
| A::AbstractMatrix{T}, | ||
| ::LinearAlgebra.NoPivot = LinearAlgebra.NoPivot(); | ||
| check::Bool = true, | ||
| ) where {T <: AbstractTracer} | ||
| LinearAlgebra.checksquare(A) | ||
| n = size(A, 1) | ||
| t = second_order_or(A) | ||
| return LinearAlgebra.Cholesky(Fill(t, n, n), 'U', 0) | ||
| end | ||
| function LinearAlgebra.cholesky( | ||
| A::AbstractMatrix{T}, | ||
| ::LinearAlgebra.RowMaximum; | ||
| tol::Real = 0.0, | ||
| check::Bool = true, | ||
| ) where {T <: AbstractTracer} | ||
| LinearAlgebra.checksquare(A) | ||
| n = size(A, 1) | ||
| t = second_order_or(A) | ||
| return LinearAlgebra.CholeskyPivoted(Fill(t, n, n), 'U', 1:n, n, tol, 0) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For future reference (either here or a comment in the code):
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first two arguments and the last argument are the same as for |
||
| end | ||
|
|
||
| ## Inverse | ||
| function Base.inv(A::StridedMatrix{T}) where {T <: AbstractTracer} | ||
| LinearAlgebra.checksquare(A) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference (either here or a comment in the code):
What are the extra arguments to
Cholesky?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first argument is the upper or lower-triangular factor, the second argument indicates whether it's the upper ('U') or lower ('L') triangular factor, and the third argument is the BLAS info code (0 indicates success).