from math import sqrt
from cvxopt import matrix
+from cvxopt.lapack import syev
def append_col(left, right):
"""
"""
return matrix([top, bottom])
+
+def eigenvalues(real_matrix):
+ """
+ Return the eigenvalues of the given ``real_matrix``.
+
+ EXAMPLES:
+
+ >>> A = matrix([[2,1],[1,2]], tc='d')
+ >>> eigenvalues(A)
+ [1.0, 3.0]
+
+ """
+ domain_dim = real_matrix.size[0] # Assume ``real_matrix`` is square.
+ W = matrix(0, (domain_dim, 1), tc='d')
+ syev(real_matrix, W)
+ return list(W)
+
+
def identity(domain_dim):
"""
Return a ``domain_dim``-by-``domain_dim`` dense integer identity