projects
/
linpy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b3af8a4
)
Rename Expression._canonify() into _toint()
author
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Wed, 18 Jun 2014 19:55:32 +0000
(21:55 +0200)
committer
Vivien Maisonneuve
<v.maisonneuve@gmail.com>
Wed, 18 Jun 2014 19:55:32 +0000
(21:55 +0200)
pypol/linear.py
patch
|
blob
|
history
diff --git
a/pypol/linear.py
b/pypol/linear.py
index
4f3aeef
..
7544633
100644
(file)
--- a/
pypol/linear.py
+++ b/
pypol/linear.py
@@
-270,30
+270,30
@@
class Expression:
def __hash__(self):
return hash((self._coefficients, self._constant))
def __hash__(self):
return hash((self._coefficients, self._constant))
- def _
canonify
(self):
+ def _
toint
(self):
lcm = functools.reduce(lambda a, b: a*b // gcd(a, b),
[value.denominator for value in self.values()])
return self * lcm
@_polymorphic_method
def _eq(self, other):
lcm = functools.reduce(lambda a, b: a*b // gcd(a, b),
[value.denominator for value in self.values()])
return self * lcm
@_polymorphic_method
def _eq(self, other):
- return Polyhedron(equalities=[(self - other)._
canonify
()])
+ return Polyhedron(equalities=[(self - other)._
toint
()])
@_polymorphic_method
def __le__(self, other):
@_polymorphic_method
def __le__(self, other):
- return Polyhedron(inequalities=[(other - self)._
canonify
()])
+ return Polyhedron(inequalities=[(other - self)._
toint
()])
@_polymorphic_method
def __lt__(self, other):
@_polymorphic_method
def __lt__(self, other):
- return Polyhedron(inequalities=[(other - self)._
canonify
() - 1])
+ return Polyhedron(inequalities=[(other - self)._
toint
() - 1])
@_polymorphic_method
def __ge__(self, other):
@_polymorphic_method
def __ge__(self, other):
- return Polyhedron(inequalities=[(self - other)._
canonify
()])
+ return Polyhedron(inequalities=[(self - other)._
toint
()])
@_polymorphic_method
def __gt__(self, other):
@_polymorphic_method
def __gt__(self, other):
- return Polyhedron(inequalities=[(self - other)._
canonify
() - 1])
+ return Polyhedron(inequalities=[(self - other)._
toint
() - 1])
def constant(numerator=0, denominator=None):
def constant(numerator=0, denominator=None):