Skip to content

Unsupported keyword arguments for LinearMaps.WrappedMap #238

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

Closed
VHarisop opened this issue Feb 21, 2025 · 3 comments · Fixed by #239
Closed

Unsupported keyword arguments for LinearMaps.WrappedMap #238

VHarisop opened this issue Feb 21, 2025 · 3 comments · Fixed by #239

Comments

@VHarisop
Copy link

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?

@dkarrasch
Copy link
Member

No intention, just nonsense. The fix should be released in max 2 hours. Thanks for reporting!

@VHarisop
Copy link
Author

Thank you for the quick fix!

@dkarrasch
Copy link
Member

It's released now.

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

Successfully merging a pull request may close this issue.

2 participants