Skip to content

Fix multiplying dual vector with symmetric/hermitian of banded matrix #40

@KlausC

Description

@KlausC

It is not possible to multiply a dual vector with a Symmetric{BandedMatrix}:

julia> n = 3; rand(n)' * Symmetric(BandedMatrix(0=>ones(n), 1=>ones(n-1)))
ERROR: MethodError: *(::Adjoint{Float64,Array{Float64,1}}, ::Symmetric{Float64,BandedMatrix{Float64,Array{Float64,2},Base.OneTo{Int64}}}) is ambiguous. Candidates:
  *(x::Adjoint{T,var"#s826"} where var"#s826"<:(AbstractArray{T,1} where T) where T, A::AbstractArray{T,2} where T) in LinearAlgebra at /home/crusius/julia-1.5.1/share/julia/stdlib/v1.5/LinearAlgebra/src/matmul.jl:133
  *(A::AbstractArray{T,2} where T, B::Symmetric{var"#s622",var"#s623"} where var"#s623"<:(ArrayLayouts.LayoutArray{T,2} where T) where var"#s622") in ArrayLayouts at /home/crusius/.julia/dev/ArrayLayouts/src/ArrayLayouts.jl:149
Possible fix, define
  *(::Adjoint{T,var"#s826"} where var"#s826"<:(AbstractArray{T,1} where T) where T, ::Symmetric{var"#s622",var"#s623"} where var"#s623"<:(ArrayLayouts.LayoutArray{T,2} where T) where var"#s622")
Stacktrace:
 [1] top-level scope at REPL[15]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions