if not self._e2 in K:
raise ValueError('the point e2 must lie in the interior of K')
+ # Initial value of cached method.
+ self._L_specnorm_value = None
def __str__(self):
"""
p = self.e2() / (norm(self.e2()) ** 2)
dist = self.K().ball_radius(self.e1())
- nu = - specnorm(self.L())/(dist*norm(self.e2()))
+ nu = - self._L_specnorm()/(dist*norm(self.e2()))
x = matrix([nu, p], (self.dimension() + 1, 1))
s = - self._G()*x
"""
q = self.e1() / (norm(self.e1()) ** 2)
dist = self.K().ball_radius(self.e2())
- omega = specnorm(self.L())/(dist*norm(self.e1()))
+ omega = self._L_specnorm()/(dist*norm(self.e1()))
y = matrix([omega])
z2 = q
z1 = y*self.e2() - self.L().trans()*z2
return {'y': y, 'z': z}
+ def _L_specnorm(self):
+ """
+ Compute the spectral norm of ``L`` and cache it.
+ """
+ if self._L_specnorm_value is None:
+ self._L_specnorm_value = specnorm(self.L())
+ return self._L_specnorm_value
+
def solution(self):
"""
Solve this linear game and return a :class:`Solution`.