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

Matrix of Symbolic Matrices #782

Open
hiiroo opened this issue Nov 5, 2022 · 0 comments
Open

Matrix of Symbolic Matrices #782

hiiroo opened this issue Nov 5, 2022 · 0 comments

Comments

@hiiroo
Copy link

hiiroo commented Nov 5, 2022

I have attempted to this;

using Symbolics
@variables X[1:2, 1:2] Y[1:2, 1:2] Z[1:2, 1:2]
test = Array{Symbolics.Arr{Num,2}}(undef, 2,2)
test[:].=[X, Y, Z, X]
sum(test,dims=2)

and I got this;

MethodError: no method matching similar(::Symbolics.Arr{Num, 2}, ::Type{Num}, ::Tuple{UnitRange{Int64}, UnitRange{Int64}})
Closest candidates are:
  similar(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{N}}, ::Type{ElType}, ::Any) where {N, ElType} at broadcast.jl:212
  similar(::Base.Broadcast.Broadcasted{Base.Broadcast.ArrayConflict}, ::Type{ElType}, ::Any) where ElType at broadcast.jl:217
  similar(::AbstractArray, ::Type{T}, ::Union{Integer, AbstractUnitRange}...) where T at abstractarray.jl:797
  ...

Stacktrace:
  [1] similar(a::Symbolics.Arr{Num, 2}, #unused#::Type{Num})
    @ Base ./abstractarray.jl:794
  [2] zero(x::Symbolics.Arr{Num, 2})
    @ Base ./abstractarray.jl:1156
  [3] _reducedim_init(f::typeof(identity), op::typeof(Base.add_sum), fv::typeof(zero), fop::typeof(sum), A::Matrix{Symbolics.Arr{Num, 2}}, region::Int64)
    @ Base ./reducedim.jl:120
  [4] reducedim_init(f::Function, op::typeof(Base.add_sum), A::Matrix{Symbolics.Arr{Num, 2}}, region::Int64)
    @ Base ./reducedim.jl:108
  [5] _mapreduce_dim(f::Function, op::Function, #unused#::Base._InitialValue, A::Matrix{Symbolics.Arr{Num, 2}}, dims::Int64)
    @ Base ./reducedim.jl:371
  [6] #mapreduce#765
    @ ./reducedim.jl:357 [inlined]
  [7] #_sum#799
    @ ./reducedim.jl:1023 [inlined]
  [8] _sum
    @ ./reducedim.jl:1023 [inlined]
  [9] #_sum#798
...
    @ In[17]:1
 [13] eval
    @ ./boot.jl:368 [inlined]
 [14] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1428

I believe issue tied to the Issue #707. I don't know if there is a proper way of doing it.

Thanks in advance

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

No branches or pull requests

1 participant