在Julia中连接ArrayViews(或sliceviews或SubArrays)?

时间:2015-05-02 21:53:29

标签: julia

有没有办法在Julia中连接ArrayViews,它不会复制底层数据? (如果能解决问题,我也很乐意使用SubArray。)

在下面的代码中,例如,我想要一个引用y1y2中数据的ArrayView。

julia> x = [1:50];

julia> using ArrayViews;

julia> y1 = view(x, 2:5);

julia> y2 = view(x, 44:48);

julia> concat(y1, y2)  # I wish there were a function like this
ERROR: concat not defined

julia> [y1, y2]  # This copies the data in y1 and y2, unfortunately
9-element Array{Int64,1}:
  2
  3
  4
  5
 44
 45
 46
 47
 48

0 个答案:

没有答案