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

initial svds support based on eigs #9425

Merged
merged 9 commits into from
Jan 11, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
renamed to SVDOperator
  • Loading branch information
jaak-s committed Dec 21, 2014
commit 6e912178afe045f8613f11db13777d5559e200a6
10 changes: 5 additions & 5 deletions base/linalg/arnoldi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,16 @@ end

## svds

type SvdX <: AbstractArray{Float64, 2}
type SVDOperator <: AbstractArray{Float64, 2}
X
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd like to parametrize this type on the input element and matrix type (and use capital letters), i.e. something like

type SVDOperator{T,S}
data::S
end

Copy link
Member

Choose a reason for hiding this comment

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

I addition, we'll have to support more than Float64 and the type should reflect that. The type can probably not be subtype of AbstractMatrix either, as the input might not be a subtype of AbstractMatrix.

end

*(s::SvdX, v::Vector{Float64}) = s.X' * (s.X * v)
size(s::SvdX) = size(s.X, 2), size(s.X, 2)
issym(s::SvdX) = true
*(s::SVDOperator, v::Vector{Float64}) = s.X' * (s.X * v)
size(s::SVDOperator) = size(s.X, 2), size(s.X, 2)
issym(s::SVDOperator) = true

function svds(X; ritzvec::Bool = true, args...)
ex = eigs(SvdX(X), I; ritzvec = ritzvec, args...)
ex = eigs(SVDOperator(X), I; ritzvec = ritzvec, args...)
if ! ritzvec
return sqrt(ex[1]), ex[2], ex[3], ex[4], ex[5]
end
Expand Down