Skip to content

Unsupported keyword arguments for LinearMaps.WrappedMap #238

@VHarisop

Description

@VHarisop

I have the following code snippet that tries to calculate the gradient of the following expression:

$$ x \mapsto \langle \mathbf{vec}(x x^{\mathsf{T}}), c \rangle = \langle x \otimes x, c \rangle, $$

where $\otimes$ denotes the Kronecker product and $c$ is an appropriately-sized vector. I was using the following snippet of code:

import LinearAlgebra: kron
import LinearMaps: LinearMap
import Zygote: gradient, Params

function kronprod(x::AbstractVector{Float64}, c::AbstractVector{Float64})
  x_map = LinearMap(x)
  return sum(kron(x_map, x_map)' * c)
end

x = rand(16);
c = rand(16 * 16);

g = gradient(Params([x])) do
  kronprod(x, c)
end

@show g

Upon executing it, I receive the following error message:

ERROR: LoadError: MethodError: no method matching (LinearMaps.WrappedMap{Float64})(::Vector{Float64}; issymmetric::Bool, ishermitian::Bool, isposdef::Bool)
This error has been manually thrown, explicitly, so the method may exist but be intentionally marked as unimplemented.

Closest candidates are:
  (LinearMaps.WrappedMap{T})(::AbstractVector; issym, isherm, ispd) where T got unsupported keyword arguments "issymmetric", "ishermitian", "isposdef"
   @ LinearMaps ~/.julia/packages/LinearMaps/GRDXH/src/wrappedmap.jl:13
  (LinearMaps.WrappedMap{T})(::Union{AbstractMatrix{T}, LinearAlgebra.AbstractQ{T}, LinearMap{T}} where T; issymmetric, ishermitian, isposdef) where T
   @ LinearMaps ~/.julia/packages/LinearMaps/GRDXH/src/wrappedmap.jl:7

The first candidate method includes keyword arguments issym, isherm, ispd instead of issymmetric, ishermitian, etc. A quick search reveals that they are only used in WrappedMap. Is this intentional?

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