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

similar_array_type with SubArray #316

Closed
odow opened this issue Jan 10, 2025 · 1 comment · Fixed by #317
Closed

similar_array_type with SubArray #316

odow opened this issue Jan 10, 2025 · 1 comment · Fixed by #317

Comments

@odow
Copy link
Member

odow commented Jan 10, 2025

See https://discourse.julialang.org/t/inner-product-grammar-is-neater-than-sum-index-in-jump-modeling-but-triggers-warning/124528/20

@odow
Copy link
Member Author

odow commented Jan 13, 2025

julia> import MutableArithmetics as MA

julia> Y = view([1.0;;;], :, :, 1)
1×1 view(::Array{Float64, 3}, :, :, 1) with eltype Float64:
 1.0

julia> ret = [1.0;;]
1×1 Matrix{Float64}:
 1.0

julia> ret = MA.operate!!(MA.add_mul, ret, 1.0, Y)
ERROR: MethodError: no method matching similar_array_type(::Type{SubArray{Float64, 2, Array{…}, Tuple{…}, true}}, ::Type{Float64})

Closest candidates are:
  similar_array_type(::Type{BitArray{N}}, ::Type{S}) where {S, N}
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/implementations/LinearAlgebra.jl:215
  similar_array_type(::Type{Array{T, N}}, ::Type{S}) where {S, T, N}
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/implementations/LinearAlgebra.jl:213
  similar_array_type(::Type{LinearAlgebra.Symmetric{T, MT}}, ::Type{S}) where {S, T, MT}
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/implementations/LinearAlgebra.jl:198
  ...

Stacktrace:
 [1] promote_operation(op::typeof(*), ::Type{Float64}, A::Type{SubArray{Float64, 2, Array{…}, Tuple{…}, true}})
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/implementations/LinearAlgebra.jl:231
 [2] promote_operation_fallback(op::typeof(MutableArithmetics.add_mul), ::Type{…}, ::Type{…}, ::Type{…})
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/interface.jl:82
 [3] promote_operation(::typeof(MutableArithmetics.add_mul), ::Type, ::Type, ::Type)
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/interface.jl:113
 [4] mutability(::Type, ::Function, ::Type, ::Type, ::Type)
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/interface.jl:273
 [5] mutability(::Matrix{…}, ::Function, ::Matrix{…}, ::Float64, ::SubArray{…})
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/interface.jl:281
 [6] operate!!(::typeof(MutableArithmetics.add_mul), ::Matrix{…}, ::Float64, ::SubArray{…})
   @ MutableArithmetics ~/.julia/dev/MutableArithmetics/src/rewrite.jl:112
 [7] top-level scope
   @ REPL[121]:1
Some type information was truncated. Use `show(err)` to see complete types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant