# HG changeset patch
# User Jason Grout <jason.grout@drake.edu>
# Date 1322960538 21600
# Node ID 899f7a1b3497660e883badc6c832650eba5a269a
# Parent 8300ef213ba4106c347bebbb2db56f0f89a041db
[mq]: trac11596copycachedata.patch
diff git a/sage/matrix/matrix2.pyx b/sage/matrix/matrix2.pyx
a

b


 1  
1  2  
2  3  """ 
3  4  Base class for matrices, part 2 
… 
… 

5040  5041  [2] 
5041  5042  
5042  5043  """ 
 5044  from copy import copy 
5043  5045  x = self.fetch('eigenvalues') 
5044   if not x is None: 
 5046  if x is not None: 
5045  5047  if not extend: 
5046   x1=Sequence([]) 
5047   for i in x: 
5048   if i in self.base_ring(): 
5049   x1.append(i) 
5050   x=x1 
5051   return x 
 5048  return Sequence([i for i in x if i in self.base_ring()]) 
 5049  else: 
 5050  return copy(x) 
5052  5051  
5053  5052  if not self.base_ring().is_exact(): 
5054  5053  from warnings import warn 
… 
… 

5071  5070  raise NotImplementedError, "eigenvalues() is not implemented for matrices with eigenvalues that are not in the fraction field of the base ring or in QQbar" 
5072  5071  V.extend(alpha*e) 
5073  5072  i+=1 
5074   V = Sequence(V) 
5075   if extend: 
5076   self.cache('eigenvalues', V) 
 5073  x = Sequence(V) 
5077  5074  if not extend: 
5078   V1=Sequence([]) 
5079   for i in V: 
5080   if i in self.base_ring(): 
5081   V1.append(i) 
5082   V=V1 
5083   return V 
5084   
5085   
 5075  return Sequence([i for i in x if i in self.base_ring()]) 
 5076  else: 
 5077  self.cache('eigenvalues', x) 
 5078  return copy(x) 
5086  5079  
5087  5080  def eigenvectors_left(self,extend=True): 
5088  5081  r""" 
… 
… 

5131  5124  ], 1)] 
5132  5125  
5133  5126  """ 
 5127  # never put into the cache! 
 5128  from copy import deepcopy 
5134  5129  x = self.fetch('eigenvectors_left') 
5135   if not x is None: 
5136   return x 
 5130  if x is not None: 
 5131  return deepcopy(x) 
5137  5132  
5138  5133  if not self.base_ring().is_exact(): 
5139  5134  from warnings import warn 
… 
… 

5740  5735  x = self.fetch('echelon_form') 
5741  5736  if x is not None: 
5742  5737  if not transformation: 
5743   return x 
 5738  return x # x is immutable 
5744  5739  y = self.fetch('echelon_transformation') 
5745  5740  if y: 
5746  5741  return (x, y) 