-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Implement svdx(Number, Number) #22195
Conversation
base/linalg/svd.jl
Outdated
@@ -231,6 +232,10 @@ function svdfact(A::StridedMatrix{TA}, B::StridedMatrix{TB}) where {TA,TB} | |||
S = promote_type(Float32, typeof(one(TA)/norm(one(TA))),TB) | |||
return svdfact!(copy_oftype(A, S), copy_oftype(B, S)) | |||
end | |||
# This method can be heavily optimized but it is probably not cirtical |
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.
critical
@@ -30,6 +30,10 @@ end | |||
convert(::Type{Factorization{T}}, F::Factorization{T}) where {T} = F | |||
inv(F::Factorization{T}) where {T} = A_ldiv_B!(F, eye(T, size(F,1))) | |||
|
|||
Base.hash(F::Factorization, h::UInt) = mapreduce(f -> hash(getfield(F, f)), hash, h, fieldnames(F)) | |||
Base.:(==)( F::T, G::T) where {T<:Factorization} = all(f -> getfield(F, f) == getfield(G, f), fieldnames(F)) |
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.
Guessing the extra spaces are for alignment? :)
base/linalg/svd.jl
Outdated
# This method can be heavily optimized but it is probably not critical | ||
# and might introduce bugs or inconsistencies relative to the 1x1 matrix | ||
# version | ||
svdfact(x::Number, y::Number) = svdfact(fill(x,1,1), fill(y,1,1)) |
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.
Missing spaces between function arguments? (Spaces exist in the similar method definition below.)
test/linalg/svd.jl
Outdated
@test svdfact(x,y) == svdfact(fill(x,1,1), fill(y,1,1)) | ||
@test svdvals(x,y) == first(svdvals(fill(x,1,1), fill(y,1,1))) | ||
@test svd(x,y) == first.(svd(fill(x,1,1), fill(y,1,1))) | ||
end |
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.
We should choose a convention for spaces separating function arguments and use it consistently :).
Make svd(x::Number) return numbers Implement hash, isequal, and == for Factorizations
How many of the other factorizations do we do this for? |
In theory, we do all of them, see #1871, but some of them are broken, e.g. |
By popular demand. Also
Make
svd(x::Number)
return numbersImplement
hash
,isequal
, and==
forFactorization
scc @alanedelman