class:`cvxopt.base.matrix` class).
"""
+from copy import copy
from math import sqrt
from cvxopt import matrix
from cvxopt.lapack import gees, gesdd, syevr
domain_dim = symmat.size[0]
eigs = matrix(0, (domain_dim, 1), tc='d')
- syevr(symmat, eigs)
+
+ # Create a copy of ``symmat`` here because ``syevr`` clobbers it.
+ dummy = copy(symmat)
+ syevr(dummy, eigs)
return list(eigs)
Examples
--------
- >>> condition_number(identity(1, typecode='d'))
- 1.0
- >>> condition_number(identity(2, typecode='d'))
- 1.0
>>> condition_number(identity(3, typecode='d'))
1.0
"""
num_eigs = min(mat.size)
- eigs = matrix(0, (num_eigs,1), tc='d')
+ eigs = matrix(0, (num_eigs, 1), tc='d')
gesdd(mat, eigs)
if len(eigs) > 0: