You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to add two arrays with different offsets assuming zero-padding, and tried to use paddedviews(). But, didn't work :-(
So, I tried to create a function to do that... Below is my first attempt in a one-dimentional case.
Before extending it to multi-dimensional arrays, it looks already pretty complicated :-(
I don't think we want to support this operation. After all:
julia>rand(2) +rand(2)
2-element Array{Float64,1}:0.9036645229477761.6401079495522737
julia>rand(2) +rand(3)
ERROR:DimensionMismatch("dimensions must match")
Stacktrace:
[1] promote_shape at ./indices.jl:154 [inlined]
[2] promote_shape(::Array{Float64,1}, ::Array{Float64,1}) at ./indices.jl:145
[3] +(::Array{Float64,1}, ::Array{Float64,1}) at ./arraymath.jl:45
[4] top-level scope at none:0
and that's the way it should be. Likewise, when you're thinking about offset arrays, a location is specified by its indices and so if two arrays don't have all their indices in common, you're essentially asking to make up missing data.
Padding both arrays to have the same indices is definitely the way to go here. Perhaps file an issue over at PaddedViews if something isn't working.
I wanted to add two arrays with different offsets assuming zero-padding, and tried to use paddedviews(). But, didn't work :-(
So, I tried to create a function to do that... Below is my first attempt in a one-dimentional case.
Before extending it to multi-dimensional arrays, it looks already pretty complicated :-(
Are there better ways to do that?
The text was updated successfully, but these errors were encountered: