LiiBRA.jl icon indicating copy to clipboard operation
LiiBRA.jl copied to clipboard

Lazy Hankel?

Open vpuri3 opened this issue 1 year ago • 0 comments

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.

vpuri3 avatar Nov 08 '22 17:11 vpuri3