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

type piracy of diagm #472

Closed
stevengj opened this issue Sep 29, 2021 · 2 comments · Fixed by #475
Closed

type piracy of diagm #472

stevengj opened this issue Sep 29, 2021 · 2 comments · Fixed by #475
Assignees
Labels
bug Something isn't working LinearOperators For issues relating to defining linear operators on AbstractDifferentials

Comments

@stevengj
Copy link

This method is type piracy:

function LinearAlgebra.diagm(m, n, kv::Pair{<:Integer,<:AbstractThunk}...)
return diagm(m, n, (k => unthunk(v) for (k, v) in kv)...)
end

In particular, it is inadvertently adding a fallback diagm(m::Any, n::Any) definition. e.g. this leads to odd error messages as in this discourse thread.

@stevengj
Copy link
Author

I think you only want this method when at least one argument has an AbstractThunk, i.e.

function LinearAlgebra.diagm(m, n, kv::Pair{<:Integer,<:AbstractThunk}, kvs::Pair{<:Integer,<:AbstractThunk}...) 
     return diagm(m, n, (k => unthunk(v) for (k, v) in (kv, kvs...))...) 
 end 

@oxinabox oxinabox self-assigned this Sep 29, 2021
@oxinabox oxinabox added bug Something isn't working LinearOperators For issues relating to defining linear operators on AbstractDifferentials labels Sep 29, 2021
@oxinabox
Copy link
Member

Correct, I will fix this presently.
A motivating case of JuliaLang/julia#42222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LinearOperators For issues relating to defining linear operators on AbstractDifferentials
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants