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

Define dot between UniformScaling and Matrix #831

Closed
lkapelevich opened this issue Mar 28, 2021 · 1 comment · Fixed by JuliaLang/julia#40250
Closed

Define dot between UniformScaling and Matrix #831

lkapelevich opened this issue Mar 28, 2021 · 1 comment · Fixed by JuliaLang/julia#40250

Comments

@lkapelevich
Copy link
Contributor

julia> using LinearAlgebra; U = UniformScaling(2); A = ones(2,2); dot(U, A)
ERROR: MethodError: no method matching iterate(::UniformScaling{Int64})
Closest candidates are:
  iterate(::Union{LinRange, StepRangeLen}) at range.jl:737
  iterate(::Union{LinRange, StepRangeLen}, ::Int64) at range.jl:737
  iterate(::T) where T<:Union{Base.KeySet{var"#s78", var"#s77"} where {var"#s78", var"#s77"<:Dict}, Base.ValueIterator{var"#s76"} where var"#s76"<:Dict} at dict.jl:693
  ...
Stacktrace:
 [1] dot(x::UniformScaling{Int64}, y::Matrix{Float64})
   @ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\LinearAlgebra\src\generic.jl:876
 [2] top-level scope
   @ REPL[13]:1

I guess it would make sense for this use U.λ * tr(A)

@Keno
Copy link
Member

Keno commented Mar 28, 2021

I guess it would make sense for this use U.λ * tr(A)

That seems right given our usual generic definition for arrays (https://github.com/JuliaLang/julia/blob/ae3a3cc570a7c48603becb3a28edf1cc465884ce/stdlib/LinearAlgebra/src/generic.jl#L906) and our treatment of UnifromScaling as an indefinite-dimension array. Submit a PR?

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