# About array with dimension\>3

**URL:** <https://discourse.julialang.org/t/about-array-with-dimension-3/11407>\
**Category:** New to Julia\
**Created:** [June 4, 2018, 8:01am UTC](https://discourse.julialang.org/t/about-array-with-dimension-3/11407 "2018-06-04T08:01:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuhuagumu](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wuhuagumu](https://discourse.julialang.org/u/wuhuagumu)\
**Post date:** [June 4, 2018, 8:01am UTC](https://discourse.julialang.org/t/about-array-with-dimension-3/11407/1 "2018-06-04T08:01:56Z")

</div>

I found the construction of high-dimension array very problematic. It is not friendly if you want to create a high-dimensional (dim\>3) array by hand. Also, the column major will lead to extra complications here, for example:

```
julia> a=reshape([1,2,3,4,5,6,7,8],(2,2,2))
2×2×2 Array{Int64,3}:
[:, :, 1] =
 1 3
 2 4

[:, :, 2] =
 5 7
 6 8

```

which is a little conter-intuitive as we expect

```
2×2×2 Array{Int64,3}:
[:, :, 1] =
 1 2
 3 4

[:, :, 2] =
 5 6
 7 8

```

Also, can’t we create a high-dimension array from nested list?

In conclusion, my questions are how to construct high-dimension matrices and how to understand the column major problem in high-dimension arrays.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [June 4, 2018, 8:05am UTC](https://discourse.julialang.org/t/about-array-with-dimension-3/11407/2 "2018-06-04T08:05:49Z")

</div>

> [@wuhuagumu](#):
>
> can’t we create a high-dimension array from nested list?

You can – please provide an example so that we can help with code.

That said, I would just

1. use a flat vector of elements in the desired nesting (eg “row-major”),
2. `reshape`, and
3. use `permutedims`

Eg

```julia
julia> permutedims(reshape(1:12, 2, 2, 3), [3, 2, 1])
3×2×2 Array{Int64,3}:
[:, :, 1] =
 1 3
 5 7
 9 11

[:, :, 2] =
  2 4
  6 8
 10 12

```

---

<div class="post-metadata">

**Author:** ![wuhuagumu](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wuhuagumu](https://discourse.julialang.org/u/wuhuagumu)\
**Post date:** [June 4, 2018, 11:55am UTC](https://discourse.julialang.org/t/about-array-with-dimension-3/11407/3 "2018-06-04T11:55:05Z")

</div>

I noticed I misunderstood the column major behaviour. The result julia provided is very reasonable. Thank you any way.
