##// END OF EJS Templates
Cleaned up release tools directory....
Cleaned up release tools directory. Converted almost all to python scripts and made toollib to collect common functions and avoid repetition. Properly commented and documented what each script does. The run_ipy_in_profiler one seems broken, I'm not sure what to do with it. We need to either fix it or remove it later, but it's not critical for 0.10.

File last commit:

r1337:53a3e331
r2118:ec9810f7
Show More
rmtkernel.py
44 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.
#-------------------------------------------------------------------------------
import numpy
ra = numpy.random
la = numpy.linalg
def GOE(N):
"""Creates an NxN element of the Gaussian Orthogonal Ensemble"""
m = ra.standard_normal((N,N))
m += m.T
return m
def centerEigenvalueDiff(mat):
"""Compute the eigvals of mat and then find the center eigval difference."""
N = len(mat)
evals = numpy.sort(la.eigvals(mat))
diff = evals[N/2] - evals[N/2-1]
return diff.real
def ensembleDiffs(num, N):
"""Return an array of num eigenvalue differences for the NxN GOE
ensemble."""
diffs = numpy.empty(num)
for i in xrange(num):
mat = GOE(N)
diffs[i] = centerEigenvalueDiff(mat)
return diffs
def normalizeDiffs(diffs):
"""Normalize an array of eigenvalue diffs."""
return diffs/diffs.mean()
def normalizedEnsembleDiffs(num, N):
"""Return an array of num *normalized eigenvalue differences for the NxN
GOE ensemble."""
diffs = ensembleDiffs(num, N)
return normalizeDiffs(diffs)