under construction
Unitary Matrices
RandomMatrix.randUnitary
— FunctionrandUnitary(n::Int)
- Generates a n by n random Unitary matrix
- Equivalent to
rand(Haar(2,n))
, seeHaar
andCUE
- For orthogonal matrices, use
randOrthogonal
orrand(Haar(1,n))
instead - The algorithm is disccused in How to Generate Random Matrices from the Classical Compact Groups
Examples
Generate a 3 by 3 random Unitary matrix
randUnitary(3)
3×3 Matrix{ComplexF64}:
-0.149398+0.0572715im -0.0935861+0.629201im -0.257255-0.709625im
0.337035-0.342606im -0.36366+0.599236im -0.100838+0.517231im
-0.17097+0.845103im -0.0767105+0.313259im 0.247081+0.3025im
Orthogonal Matrices
RandomMatrix.randOrthogonal
— FunctionrandOrthogonal(n::Int)
- Generates a
n
byn
random Orthogonal matrix - Equivalent to
rand(Haar(1,n))
, seeHaar
andCOE
- For unitary matrices, use
randUnitary
orrand(Haar(2,n))
instead - The algorithm is disccused in How to Generate Random Matrices from the Classical Compact Groups
Examples
Generates a 3 by 3 random Orthogonal matrix
randOrthogonal(3)
3×3 Matrix{Float64}:
-0.875553 0.112448 0.469853
-0.147915 0.863441 -0.482277
0.459921 0.491757 0.739356
Permutation Matrices
RandomMatrix.randPermutation
— FunctionrandPermutation(n; fix)
n
: dimensionfix
: a keyword argument, default is set tofix = 0
. Iffix = x
,randPermutation(n,x)
will have atleastx
fixed points
Examples
Generates a random 5 by 5 permutation matrix
randPermutation(5)
5×5 SparseArrays.SparseMatrixCSC{Int8, Int64} with 5 stored entries:
⋅ ⋅ ⋅ ⋅ 1
⋅ 1 ⋅ ⋅ ⋅
1 ⋅ ⋅ ⋅ ⋅
⋅ ⋅ 1 ⋅ ⋅
⋅ ⋅ ⋅ 1 ⋅
Generates Generates a random 10 by 10 permutation matrix with atleast 7 fix points
randPermutation(10, fix = 7)
10×10 SparseArrays.SparseMatrixCSC{Int8, Int64} with 10 stored entries:
1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
⋅ 1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1 ⋅
⋅ ⋅ ⋅ 1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
⋮ ⋮
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1 ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1 ⋅ ⋅
⋅ ⋅ 1 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 1