# Julia type displaying change between versions

**URL:** <https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029>\
**Category:** New to Julia\
**Created:** [July 30, 2022, 2:35pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029 "2022-07-30T14:35:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 2:35pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/1 "2022-07-30T14:35:04Z")

</div>

It is kind of annoying:

I saw this on the internet:

```julia
julia> Array(ones(2,2))
2×2 Array{Float64,2}:
 1.0 1.0
 1.0 1.0

```

but when I do it in my terminal I get:

```julia
julia> Array(ones(2,2))
2×2 Matrix{Float64}:
 1.0 1.0
 1.0 1.0

```

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 30, 2022, 2:36pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/2 "2022-07-30T14:36:58Z")

</div>

It is the same thing `Array{Float64, 2} === Matrix{Float64}`, the printing just changed. Supported Julia version (i.e. \> 1.6) points this out when printing the type:

```julia
julia> Matrix{Float64}
Matrix{Float64} (alias for Array{Float64, 2})

```

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 2:41pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/3 "2022-07-30T14:41:52Z")

</div>

So Julia is not backwards compatible.

All the tutorials on the net are broken now.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 30, 2022, 2:44pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/4 "2022-07-30T14:44:02Z")

</div>

It is backwards compatible – the code `Array(ones(2,2))` worked in both versions, and produced the exact same thing.

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 2:46pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/5 "2022-07-30T14:46:48Z")

</div>

I get it but it is just not professional for a (compiled) programming language that the type information changes.

And version 1.6 was a long time after the inception of Julia.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 30, 2022, 2:48pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/6 "2022-07-30T14:48:26Z")

</div>

> [@Schneeschaufel](#):
>
> type information changes

It didn’t.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 30, 2022, 2:53pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/7 "2022-07-30T14:53:51Z")

</div>

To be clear, `Matrix{Float64}` is an alias for `Array{Float64,2}` and has been since Julia 1.0. The only thing different in Julia 1.7 is how the type is printed.

Julia 1.0.5:

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.0.5 (2019-09-09)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> Array{Float64,2} == Matrix{Float64}
true

julia> Array{Float64,2}
Array{Float64,2}

julia> Matrix{Float64}
Array{Float64,2}

julia> versioninfo()
Julia Version 1.0.5
Commit 3af96bcefc (2019-09-09 19:06 UTC)

```

Julia 1.7.1:

```julia
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.7.1 (2021-12-22)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> Array{Float64,2}
Matrix{Float64} (alias for Array{Float64, 2})

julia> Matrix{Float64}
Matrix{Float64} (alias for Array{Float64, 2})

julia> Array{Float64,2} == Matrix{Float64}
true

```

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 2:53pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/8 "2022-07-30T14:53:53Z")

</div>

```julia
 [0:10...]
11-element Vector{Int64}:
  0 1 2 3 4 5 6 7 8 9 10

```

```julia
julia> [0:10...] 
11-element Array{Int64,1}: 
0 1 2 3 4 5 6 7 8 9 10

```

You may argue a vector is a subset of a 1D array (maybe a linear algebra expert has got the exact definition of a vector).

If there is no difference between a vector and an Array why change the type message with version 1.6.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 30, 2022, 2:56pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/9 "2022-07-30T14:56:22Z")

</div>

> [@Schneeschaufel](#):
>
> why change the type message with version 1.6.

it’s just the display because Vector{} is more readable?, `Vector{T}` is exactly the same thing as `Array{T, 1}`, nothing changed

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 30, 2022, 2:59pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/10 "2022-07-30T14:59:11Z")

</div>

Here’s the history of the change if you are interested:  
[https://github.com/JuliaLang/julia/pull/36032](https://github.com/JuliaLang/julia/pull/36032)  
[https://github.com/JuliaLang/julia/pull/36107](https://github.com/JuliaLang/julia/pull/36107)

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 3:05pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/11 "2022-07-30T15:05:19Z")

</div>

And exactly this is the problem. It leads to confusion.

Same with numpy: I have no idea if numpy has vectors. I often think I use a vector but then it turns out when I pass ‘my vector’ to a numpy function it expects kind of (1,n) array or matrix. And often the other way round I have no idea if numpy thinks a (1,n) matrix is a 1D vector.

And also numpy changes things at random. The numpy claims it doesn’t know what to do with np.float anymore and I have to change everything from np.float to np.float32 or np.float64 to avoid those nagging warning. Now, I expect no better from numpy that they change things at random because numpy is total mess (I would call it a rats nest even).

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 3:08pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/12 "2022-07-30T15:08:59Z")

</div>

I also find a vector easier to imagine than a row of an array or matrix.

But I am not certain it should be done in array language.

Maybe a linear algebra expert can comment on it.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 30, 2022, 3:13pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/13 "2022-07-30T15:13:01Z")

</div>

The printing is just a visual thing, **it does not affect your code** , so no, this is NOT LIKE your complaint about NumPy.

This is literally just a type alias and Julia tells you that:

```julia
julia> Vector{Int}
Vector{Int64} (alias for Array{Int64, 1})

```

I don’t understand what this fuss is about tbh

* * *

it’s also mentioned in docs:  
[https://docs.julialang.org/en/v1/base/arrays/#Base.Vector](https://docs.julialang.org/en/v1/base/arrays/#Base.Vector)

and manual [Single- and multi-dimensional Arrays · The Julia Language](https://docs.julialang.org/en/v1/manual/arrays/)

> The [`Array`](https://docs.julialang.org/en/v1/base/arrays/#Core.Array) type is a specific instance of `DenseArray`; [`Vector`](https://docs.julialang.org/en/v1/base/arrays/#Base.Vector) and [`Matrix`](https://docs.julialang.org/en/v1/base/arrays/#Base.Matrix) are aliases for the 1-d and 2-d cases.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [July 30, 2022, 3:19pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/14 "2022-07-30T15:19:01Z")

</div>

> [@Schneeschaufel](#):
>
> I also find a vector easier to imagine than a row of an array or matrix.
> 
> But I am not certain it should be done in array language.
> 
> Maybe a linear algebra expert can comment on it.

There are “row” and “column” vectors:

> **[Row and column vectors](https://en.wikipedia.org/wiki/Row_and_column_vectors)**
>
> In linear algebra, a column vector with 
>   
>     
>       
> m
>       
>     
> {\\displaystyle m}
>   
> elements is an 
>   
>     
>       
> m
> ×
> 1
>       
>     
> {\\displaystyle m\\times 1}
>   
> matrix consisting of a single column of 
>   
>     
>       
> m
>       
>     
> {\\displaystyle m}
>   
> entries, for example,
> Similarly, a row vector is a 
>   
>     
>       
> 1
> ×
> n
>       
>     
> {\\displaystyle 1\\times n}
>   
> matrix for some 
>   
>     
>       
> n
> ...

In Julia, row and column vectors are best represented as follows:

```julia
julia> [1,2,3,4] # column vector
4-element Vector{Int64}:
 1
 2
 3
 4

julia> [1,2,3,4]' # row vector
1×4 adjoint(::Vector{Int64}) with eltype Int64:
 1 2 3 4

julia> typeof(ans)
LinearAlgebra.Adjoint{Int64, Vector{Int64}}

julia> transpose([1,2,3,4]) # also a row vector
1×4 transpose(::Vector{Int64}) with eltype Int64:
 1 2 3 4

julia> typeof(ans)
LinearAlgebra.Transpose{Int64, Vector{Int64}}

```

I have degrees in Mathematics and Biophysics. This is one of the best representations of linear algebra that I have seen in a programming language. Does that count as a comment from a linear algebra expert?

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 3:24pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/15 "2022-07-30T15:24:39Z")

</div>

I know that there are row and column vectors.

When you read physics papers with heavy math in it careful authors always point out that v.T now is a row vector.

I am more sloppy to be honest.

Although: Coming back to your demonstration. Why is 1 column vector not a (n,1) matrix vector? What is the exact definition here?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 30, 2022, 3:31pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/16 "2022-07-30T15:31:03Z")

</div>

> [@Schneeschaufel](#):
>
> Although: Coming back to your demonstration. Why is 1 column vector not a (n,1) matrix vector? What is the exact definition here?

why is it not a `(n, 1, 1, 1, 1, 1)` tensor? in fact, behavior wise, this, mental model works:

```julia
julia> a = [1,2,3];

julia> a[2, 1,1,1,1,1]
2

```

but Julia’s typing system is designed to be able to distinguish dimension of array, if you like everything being Matrix, maybe you should use MATLAB, where a scalar is a 1x1 Matrix

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 30, 2022, 3:43pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/17 "2022-07-30T15:43:11Z")

</div>

I do not use Matlab (okay I must have used it 20 years ago when I was PhD student in physics).

And I do not wanna know what NumPy thinks a scalar should be.

But I have heard people loathing the 1x1 matrix Matlab scalar representation thing.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [July 31, 2022, 7:45pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/18 "2022-07-31T19:45:38Z")

</div>

> [@Schneeschaufel](#):
>
> Although: Coming back to your demonstration. Why is 1 column vector not a (n,1) matrix vector? What is the exact definition here?

One thing that I don’t think I saw mentioned that confused me when I started is that there IS a difference between a Vector (that is, a 1D array), and Matrix (that is, a 2D array) with a single column.

I gather this distinction is important to the linear algebra folks, but I find it a bit awkward. then again, it rarely comes up in practice, and I assure you that the behavior hasn’t changed (aside from the printing, that is).

> [@Schneeschaufel](#):
>
> I am more sloppy to be honest

Me too. But I have found that anything that seems sloppy, weird, or wrong in Julia’s implementation of linear algebra is almost certainly a misunderstanding on my part, or there’s a very good reason.

---

<div class="post-metadata">

**Author:** ![Schneeschaufel](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Schneeschaufel](https://discourse.julialang.org/u/Schneeschaufel)\
**Post date:** [July 31, 2022, 9:04pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/19 "2022-07-31T21:04:14Z")

</div>

Also this is pretty confusing:

```julia
**julia>** Array[[5,6],[9,78]]

2-element Vector{Array}:

[5, 6]

[9, 78]

```

It shouldn’t rather be expressed as:

```julia
**julia>** Vector[[5,6],[9,78]]

```

Because an array normally is thought of as a vector of vectors and each element again can represent a vectors. Maybe I am losing money on that bet but that is how most languages would implement an array (I did it in the past with Scheme which only knows vectors but not multi dimensional arrays or 2D matrices for that matter). Why overcomplicate things.

People will argue does it really matter if you type ‘Array’ versus ‘Vector’ because the end result is practically the same.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [July 31, 2022, 9:09pm UTC](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029/20 "2022-07-31T21:09:01Z")

</div>

The reason for an explicit multidimensional array type is to have 1) static guarantee that each inner slice has the same length and 2) to have all memory occupied by the matrix be contiguous. Both of these make better use of caching effects. If you have a vector of vectors as your “Matrix” type, you don’t get those guarantees.

> [@Schneeschaufel](#):
>
> People will argue does it really matter if you type ‘Array’ versus ‘Vector’ because the end result is practically the same.

It is not the same - having a `Vector{Array}` can hold arbitrary arrays, not even necessarily having the same shape or containing the same element type. A `Vector{Vector}` at least guarantees you the shape (i.e. dimensionality) to be the same, though still allows them to contain different elements typewise.

[Next page](https://discourse.julialang.org/t/julia-type-displaying-change-between-versions/85029.md?page=2)
