How to add a 2d tuple to a 2d matrix in Julia?
t1 = ((10,20),(30,40)); #2d immutable tuple
a = [1 2;3 4] #2d matrix
a .+ t1
throws an error:
MethodError: no method matching +(::Int64, ::Tuple{Int64, Int64})
Closest candidates are:
+(::Any, ::Any, ::Any, ::Any...) at operators.jl:560
+(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:87
+(::Integer, ::Ptr) at pointer.jl:161
...
Stacktrace:
[1] _broadcast_getindex_evalf
@ .\broadcast.jl:648 [inlined]
[2] _broadcast_getindex
@ .\broadcast.jl:621 [inlined]
[3] getindex
@ .\broadcast.jl:575 [inlined]
[4] copy
@ .\broadcast.jl:922 [inlined]
[5] materialize(bc::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2}, Nothing, typeof(+), Tuple{Matrix{Int64}, Tuple{Tuple{Int64, Int64}, Tuple{Int64, Int64}}}})
@ Base.Broadcast .\broadcast.jl:883
[6] top-level scope
@ REPL[15]:1
Is there a vector/matrix addition method exists? Obviously I can use a for loop for element by element addition.