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

Unable to invert Toeplitz matrices #70

Open
ParadaCarleton opened this issue Sep 7, 2022 · 2 comments
Open

Unable to invert Toeplitz matrices #70

ParadaCarleton opened this issue Sep 7, 2022 · 2 comments

Comments

@ParadaCarleton
Copy link

julia> using FFTW

julia> using ToeplitzMatrices

julia> y = SymmetricToeplitz([1, 2, 3])
3×3 SymmetricToeplitz{Int64}:
 1  2  3
 2  1  2
 3  2  1

julia> inv(y)
ERROR: MethodError: no method matching ldiv!(::ToeplitzMatrices.ToeplitzFactorization{Float64, SymmetricToeplitz{Float64}, ComplexF64, FFTW.cFFTWPlan{ComplexF64, -1, true, 1, UnitRange{Int64}}}, ::Matrix{Float64})
Closest candidates are:
  ldiv!(::Any, ::ChainRulesCore.AbstractThunk) at ~/.julia/packages/ChainRulesCore/ctmSK/src/tangent_types/thunks.jl:90
  ldiv!(::LinearAlgebra.SymTridiagonal, ::AbstractVecOrMat; shift) at /usr/share/julia/stdlib/v1.8/LinearAlgebra/src/tridiag.jl:280
  ldiv!(::LinearAlgebra.Diagonal, ::AbstractVecOrMat) at /usr/share/julia/stdlib/v1.8/LinearAlgebra/src/diagonal.jl:425
  ...
Stacktrace:
 [1] inv(A::SymmetricToeplitz{Int64})
   @ LinearAlgebra /usr/share/julia/stdlib/v1.8/LinearAlgebra/src/generic.jl:1039
 [2] top-level scope
   @ REPL[6]:1

This is pretty weird; inversion should be able to fall back on the generic algorithm, even if the Toeplitz-specific algorithms haven't been implemented yet.

@bonStats
Copy link

bonStats commented Feb 7, 2023

I'm not a developer of this package but since cholesky() is implemented you can do this inv(cholesky(y)).
Perhaps that should be the fallback for SymmetricToeplitz, though there might be more considerations happening from #64 (comment)

@dlfivefifty
Copy link
Member

Only would work for positive definite… we’d want an LDLt factorisation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants