Skip to content

Commit

Permalink
Remove LONG_INTEGER definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
catch22 committed Jul 6, 2016
1 parent 435df89 commit 57c38c1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
1 change: 0 additions & 1 deletion barvikron/__init__.py
Expand Up @@ -2,7 +2,6 @@
import sys

__version__ = '0.3'
LONG_INTEGER = int if sys.version_info > (3, ) else long

from .parfun import *
from .barvinok import *
Expand Down
4 changes: 2 additions & 2 deletions barvikron/barvinok.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
import os, subprocess
from six.moves import map, range
from . import LONG_INTEGER, EvaluatorBase
from . import EvaluatorBase

__all__ = ['BarvinokEvaluator']

Expand Down Expand Up @@ -47,4 +47,4 @@ def eval(self, vpn, b):
assert popen.returncode == 0

# parse output
return LONG_INTEGER(stdout.splitlines()[-1])
return int(stdout.splitlines()[-1])
3 changes: 1 addition & 2 deletions barvikron/findiff.py
@@ -1,7 +1,6 @@
from __future__ import absolute_import
from collections import defaultdict
import numpy as np
from . import LONG_INTEGER

__all__ = ['finite_differences']

Expand All @@ -19,7 +18,7 @@ def finite_differences(positive_roots):
l += [(-x[0], x[1] + root) for x in l]

# optimize
d = defaultdict(LONG_INTEGER)
d = defaultdict(int)
for coeff, shift in l:
d[tuple(shift)] += coeff

Expand Down
4 changes: 2 additions & 2 deletions barvikron/kronecker.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
import itertools, logging
import numpy as np
from . import VectorPartitionFunction, finite_differences, LONG_INTEGER
from . import VectorPartitionFunction, finite_differences

__all__ = ['kronecker_weight_vpn', 'flatten_weight',
'kronecker_weight_multiplicity', 'positive_roots', 'kronecker']
Expand Down Expand Up @@ -84,7 +84,7 @@ def kronecker(partitions, evaluator):
'About to compute %d weight multiplicities using a partition function of size %s.',
total, vpn.A.shape)

g = LONG_INTEGER(0)
g = 0
for i, (coeff, shift) in enumerate(findiff):
# compute next weight multiplicity
weight = highest_weight + shift
Expand Down
4 changes: 2 additions & 2 deletions barvikron/latte.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
import os, re, subprocess, tempfile
from six.moves import map, range
from . import LONG_INTEGER, EvaluatorBase
from . import EvaluatorBase

__all__ = ['LatteEvaluator']

Expand Down Expand Up @@ -56,6 +56,6 @@ def eval(self, vpn, b):
stdout)
if not match:
raise Exception('Could not parse LattE output: %s' % stdout)
return LONG_INTEGER(match.group(1))
return int(match.group(1))
finally:
os.remove(input_path)
4 changes: 2 additions & 2 deletions barvikron/scripts/parallel.py
Expand Up @@ -3,7 +3,7 @@
from six.moves.queue import Empty
from six.moves import map
import click
from .. import BarvinokEvaluator, LatteEvaluator, kronecker_weight_multiplicity, kronecker, LONG_INTEGER, flatten_weight, finite_differences, positive_roots, kronecker_weight_vpn
from .. import BarvinokEvaluator, LatteEvaluator, kronecker_weight_multiplicity, kronecker, flatten_weight, finite_differences, positive_roots, kronecker_weight_vpn
from . import WeightParamType, enable_logging


Expand Down Expand Up @@ -63,7 +63,7 @@ def master(partitions, port, authkey, verbose):

# accumulate weight multiplicities
logging.info('All work items have been processed. Now accumulating...')
g = LONG_INTEGER(0)
g = 0
for _ in findiff:
g += result_queue.get()
click.echo(g)
Expand Down

0 comments on commit 57c38c1

Please sign in to comment.