Try reshape:
julia> a = [1:10]
10-element Array{Int64,1}:
1
2
3
4
5
6
7
8
9
10
julia> b=reshape(a,2,5)
2x5 Array{Int64,2}:
1 3 5 7 9
2 4 6 8 10
Which is also a view of a. (note that I turned the range 1:10 into an
array by [1:10], otherwise it's not a view).
But note that at the moment indexing an array will return a copy and not
a view as in numpy.
On Fri, 2014-07-11 at 19:16, Neal Becker <[email protected]> wrote:
> In numpy, I might do
>
> a = np.arange (10)
> b = a.reshape (2, 5)
>
> now b is a 'view' of a, and modifications to b will change a.
>
> How do I do the equivalent in julia?