Skip to content

Commit 7de98fb

Browse files
committed
Factored up Ginibre random matrix ensembles
1 parent 8d6e890 commit 7de98fb

File tree

5 files changed

+79
-53
lines changed

5 files changed

+79
-53
lines changed

LICENSE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The RandomMatrices Julia module is licensed under the MIT License:
2+
3+
> Copyright (c) 2013: Jiahao Chen, Alan Edelman and Jameson Nash
4+
>
5+
> Permission is hereby granted, free of charge, to any person obtaining
6+
> a copy of this software and associated documentation files (the
7+
> "Software"), to deal in the Software without restriction, including
8+
> without limitation the rights to use, copy, modify, merge, publish,
9+
> distribute, sublicense, and/or sell copies of the Software, and to
10+
> permit persons to whom the Software is furnished to do so, subject to
11+
> the following conditions:
12+
>
13+
> The above copyright notice and this permission notice shall be
14+
> included in all copies or substantial portions of the Software.
15+
>
16+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
> LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
> OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
> WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
julia 0.2-
12
Catalan
23
Distributions
34
GSL

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.2

src/Ginibre.jl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
export rand, Ginibre
2+
import Base.rand
3+
4+
#Samples a matrix from the Ginibre ensemble
5+
#This ensemble lives in GL(N, F), the set of all invertible N x N matrices
6+
#over the field F
7+
#For beta=1,2,4, F=R, C, H respectively
8+
immutable Ginibre <: ContinuousMatrixDistribution
9+
beta::Float64
10+
N::Integer
11+
end
12+
13+
function rand(W::Ginibre)
14+
if beta==1
15+
randn(n,n)
16+
elseif beta==2
17+
randn(n,n)+im*randn(n,n)
18+
elseif beta==4
19+
Q0=randn(n,n)
20+
Q1=randn(n,n)
21+
Q2=randn(n,n)
22+
Q3=randn(n,n)
23+
[Q0+im*Q1 Q2+im*Q3;-Q2+im*Q3 Q0-im*Q1]
24+
else
25+
error(string("beta = ", beta, " not implemented"))
26+
end
27+
end
28+
29+
function jpdf{z<:Complex}(Z::AbstractMatrix{z})
30+
pi^(size(Z,1)^2)*exp(-trace(Z'*Z))
31+
end
32+
33+
#Dyson Circular orthogonal, unitary and symplectic ensembles
34+
immutable CircularOrthogonal
35+
N :: Int64
36+
end
37+
38+
function rand(M::CircularOrthogonal)
39+
U = rand(Ginibre(2, M.N))
40+
U * U'
41+
end
42+
43+
immutable CircularUnitary
44+
N :: Int64
45+
end
46+
47+
rand(M::CircularUnitary) = rand(Ginibre(2, M.N))
48+
49+
immutable CircularSymplectic
50+
N :: Int64
51+
end
52+
53+
rand(M::CircularSymplectic) = error("Not implemented")
54+

src/HaarMeasure.jl

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
export rand, Ginibre, NeedPiecewiseCorrection, jpdfGinibre,
2-
CircularOrthogonal, CircularUnitary, CircularSymplectic
1+
export rand, NeedPiecewiseCorrection
32
import Base.rand
43

54
# Computes samplex of real or complex Haar matrices of size nxn
@@ -66,57 +65,6 @@ function NeedPiecewiseCorrection()
6665
end
6766

6867

69-
#Samples a matrix from the Ginibre ensemble
70-
#This ensemble lives in GL(N, F), the set of all invertible N x N matrices
71-
#over the field F
72-
#For beta=1,2,4, F=R, C, H respectively
73-
immutable Ginibre <: ContinuousMatrixDistribution
74-
beta::Float64
75-
N::Integer
76-
end
77-
78-
function rand(W::Ginibre)
79-
if beta==1
80-
randn(n,n)
81-
elseif beta==2
82-
randn(n,n)+im*randn(n,n)
83-
elseif beta==4
84-
Q0=randn(n,n)
85-
Q1=randn(n,n)
86-
Q2=randn(n,n)
87-
Q3=randn(n,n)
88-
[Q0+im*Q1 Q2+im*Q3;-Q2+im*Q3 Q0-im*Q1]
89-
else
90-
error(string("beta = ", beta, " not implemented"))
91-
end
92-
end
93-
94-
function jpdfGinibre{z<:Complex}(Z::AbstractMatrix{z})
95-
pi^(size(Z,1)^2)*exp(-trace(Z'*Z))
96-
end
97-
98-
#Dyson Circular orthogonal, unitary and symplectic ensembles
99-
immutable CircularOrthogonal
100-
N :: Int64
101-
end
102-
103-
function rand(M::CircularOrthogonal)
104-
U = rand(Ginibre(2, M.N))
105-
U * U'
106-
end
107-
108-
immutable CircularUnitary
109-
N :: Int64
110-
end
111-
112-
rand(M::CircularUnitary) = rand(Ginibre(2, M.N))
113-
114-
immutable CircularSymplectic
115-
N :: Int64
116-
end
117-
118-
rand(M::CircularSymplectic) = error("Not implemented")
119-
12068
#TODO maybe, someday
12169
#Haar measure on U(N) in terms of local coordinates
12270
#Zyczkowski and Kus, Random unitary matrices, J. Phys. A: Math. Gen. 27,

0 commit comments

Comments
 (0)