X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=dunshire%2Fmatrices.py;h=29c5867aabe544f768a1b1ce3862f14c0a316712;hb=f2d4185b8c1a263500848554d4283c7ec3201b1c;hp=13e8150f5c807914782dbcb49733f36be513912c;hpb=381ee9f23d45d7094c9713c846c6119bb64c0807;p=dunshire.git diff --git a/dunshire/matrices.py b/dunshire/matrices.py index 13e8150..29c5867 100644 --- a/dunshire/matrices.py +++ b/dunshire/matrices.py @@ -3,6 +3,7 @@ Utility functions for working with CVXOPT matrices (instances of the class:`cvxopt.base.matrix` class). """ +from copy import copy 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') - syevr(symmat, eigs) + + # Create a copy of ``symmat`` here because ``syevr`` clobbers it. + dummy = copy(symmat) + syevr(dummy, eigs) return list(eigs)