##// END OF EJS Templates
add deprecation warning for renamed engine/controller_launcher config...
add deprecation warning for renamed engine/controller_launcher config These have been renamed to add _class, which makes it clearer that they are class names/paths. This allows 0.11-style specification of the names to work, but with a warning that the old name is deprecated.

File last commit:

r4910:0dc49390
r5182:79c1f62f
Show More
rmtkernel.py
42 lines | 1.2 KiB | text/x-python | PythonLexer
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 #-------------------------------------------------------------------------------
# Core routines for computing properties of symmetric random matrices.
#-------------------------------------------------------------------------------
Brian E. Granger
Updating RMT parallel example.
r4591 import numpy as np
ra = np.random
la = np.linalg
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
def GOE(N):
"""Creates an NxN element of the Gaussian Orthogonal Ensemble"""
m = ra.standard_normal((N,N))
m += m.T
Brian E. Granger
Updating RMT parallel example.
r4591 return m/2
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
Brian E. Granger
Updating RMT parallel example.
r4591 def center_eigenvalue_diff(mat):
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 """Compute the eigvals of mat and then find the center eigval difference."""
N = len(mat)
Brian E. Granger
Updating RMT parallel example.
r4591 evals = np.sort(la.eigvals(mat))
diff = np.abs(evals[N/2] - evals[N/2-1])
return diff
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337
Brian E. Granger
Updating RMT parallel example.
r4591 def ensemble_diffs(num, N):
"""Return num eigenvalue diffs for the NxN GOE ensemble."""
diffs = np.empty(num)
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 for i in xrange(num):
mat = GOE(N)
Brian E. Granger
Updating RMT parallel example.
r4591 diffs[i] = center_eigenvalue_diff(mat)
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 return diffs
Brian E. Granger
Updating RMT parallel example.
r4591 def normalize_diffs(diffs):
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337 """Normalize an array of eigenvalue diffs."""
return diffs/diffs.mean()
Brian E. Granger
Updating RMT parallel example.
r4591 def normalized_ensemble_diffs(num, N):
"""Return num *normalized* eigenvalue diffs for the NxN GOE ensemble."""
diffs = ensemble_diffs(num, N)
return normalize_diffs(diffs)
Brian E Granger
Adding examples from ipython1-dev to docs/examples/kernel. These ...
r1337