Base Julia knows at least three types of vectors:

```
julia> x=rand(3)
3-element Vector{Float64}:
0.9378913600546382
0.04174077280647481
0.7608954281716017
julia> x'
1×3 adjoint(::Vector{Float64}) with eltype Float64:
0.937891 0.0417408 0.760895
julia> transpose(x)
1×3 transpose(::Vector{Float64}) with eltype Float64:
0.937891 0.0417408 0.760895
```

What are commonly used types of matrices?

If you are asking to type function arguments, don’t worry: type them as `AbstractMatrix{T}`

. This will be sufficiently flexible.

I don’t worry, I just want to explain the advantages of Julia to a colleague that uses Matlab, and I think one of the advantages is that you can write functions that are optimized for curtain matrix types, e.g. symmetric matrices, but I did not find a list of types that are defined…

EDIT: OK, found it: Linear Algebra · The Julia Language

Maybe also useful?

```
julia> subtypes(AbstractMatrix)
28-element Vector{Any}:
AbstractSlices{T, 2} where T
Base.ReinterpretArray{T, 2, S} where {T, S}
Base.ReshapedArray{T, 2} where T
Base.SCartesianIndices2
BitMatrix (alias for BitArray{2})
CartesianIndices{2, R} where R<:Tuple{OrdinalRange{Int64, Int64}, OrdinalRange{Int64, Int64}}
Core.Compiler.BitArray{2}
Core.Compiler.LinearIndices{2, R} where R<:Tuple{Core.Compiler.AbstractUnitRange{Int64}, Core.Compiler.AbstractUnitRange{Int64}}
DenseMatrix (alias for DenseArray{T, 2} where T)
LinearAlgebra.AbstractQ
LinearAlgebra.AbstractTriangular
LinearAlgebra.Adjoint
LinearAlgebra.Bidiagonal
⋮
LinearAlgebra.LQPackedQ
LinearAlgebra.SymTridiagonal
LinearAlgebra.Symmetric
LinearAlgebra.Transpose
LinearAlgebra.Tridiagonal
LinearAlgebra.UpperHessenberg
LinearIndices{2, R} where R<:Tuple{AbstractUnitRange{Int64}, AbstractUnitRange{Int64}}
PermutedDimsArray{T, 2} where T
AbstractSparseMatrix (alias for SparseArrays.AbstractSparseArray{Tv, Ti, 2} where {Tv, Ti})
SparseArrays.CHOLMOD.FactorComponent
SparseArrays.ReadOnly{T, 2, V} where {T, V<:AbstractMatrix{T}}
SubArray{T, 2} where T
Test.GenericArray{T, 2} where T
```

3 Likes

I am pretty sure Matlab has specialized matrices too.

Well, not really. While you can define classes in Matlab, matrices are not classes but a special build-in type.

Yes, you are right: the specializations are built-in types.

You might also want to point out that many packages have already implemented special matrix types. Here are just a few for example…

```
julia> using LinearAlgebra
julia> old_types = subtypes(AbstractMatrix); length(old_types)
28
julia> using BlockArrays, InfiniteArrays, StaticArrays, ToeplitzMatrices
julia> foreach(t -> t ∉ old_types && println(t), subtypes(AbstractMatrix))
AbstractToeplitz
ArrayLayouts.LayoutMatrix
BlockArrays.BlockIndexRange{2, R} where R<:Tuple{AbstractUnitRange{Int64}, AbstractUnitRange{Int64}}
BlockArrays.BlocksView{S, 2, T, B} where {T<:(AbstractMatrix), S, B<:AbstractMatrix{S}}
BlockRange{2, R} where R<:Tuple{AbstractUnitRange{Int64}, AbstractUnitRange{Int64}}
FillArrays.AbstractFill{T, 2} where T
FillArrays.OneElement{T, 2} where T
FillArrays.RectDiagonal
Hankel
InfiniteArrays.ReshapedArray{T, 2} where T
StaticArrays.TrivialView{A, T, 2} where {A, T}
StaticArray{S, T, 2} where {S<:Tuple, T}
```

1 Like

And I think you cannot specialize your own code on the inbuilt Matlab specialized matrices when writing your own Matlab functions. At least that’s my understanding…