LiiBRA.jl
LiiBRA.jl copied to clipboard
Lazy Hankel?
Hi Brady, saw your talk today.
I see you are forming the full Hankel matrix, and that is your major time sink. I think you should be able to form a lazy representation to the Hankel matrix as follows:
# https://en.wikipedia.org/wiki/Hankel_matrix
struct HankelMatrix{T,Ta} <: AbstractMatrix{T}
a::Ta # array of elements [a1, ..., aN]
end
# overload Base: size
# overload LinearAlgebra: *, \, mul!, ldiv!, lmul!, rmul!, adjoint, transpose, conj
# ref https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array
function Base.getindex(H::HankelMatrix, idx)
correct_index = # integer computation
return H.a[correct_index]
end
function Base.setindex!(newval, H::HankelMatrix, idx)
H.a[correct_index] = newval
end
And then you would be able to pass this to any SVD algorithm in Julia.