]> gitweb.michael.orlitzky.com - dunshire.git/blobdiff - dunshire/matrices.py
Enable doctest ELLIPSIS in a few modules.
[dunshire.git] / dunshire / matrices.py
index 13e8150f5c807914782dbcb49733f36be513912c..94f841d39f888392624077afd12bcdcb7e0c3c19 100644 (file)
@@ -3,6 +3,7 @@ Utility functions for working with CVXOPT matrices (instances of the
 class:`cvxopt.base.matrix` class).
 """
 
 class:`cvxopt.base.matrix` class).
 """
 
+from copy import copy
 from math import sqrt
 from cvxopt import matrix
 from cvxopt.lapack import gees, gesdd, syevr
 from math import sqrt
 from cvxopt import matrix
 from cvxopt.lapack import gees, gesdd, syevr
@@ -140,7 +141,10 @@ def eigenvalues(symmat):
 
     domain_dim = symmat.size[0]
     eigs = matrix(0, (domain_dim, 1), tc='d')
 
     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)
 
 
     return list(eigs)
 
 
@@ -418,10 +422,6 @@ def condition_number(mat):
     Examples
     --------
 
     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
 
     >>> condition_number(identity(3, typecode='d'))
     1.0