viff

changeset 993:ed6a1c88de29

Merged.
author Martin Geisler <mg@daimi.au.dk>
date Thu, 02 Oct 2008 11:20:05 +0200
parents 13a883981248 35fc8a249a2a
children 383e6bfb4863
files viff/comparison.py viff/runtime.py
diffstat 4 files changed, 8 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Wed Oct 01 14:09:26 2008 +0200
     1.2 +++ b/.hgignore	Thu Oct 02 11:20:05 2008 +0200
     1.3 @@ -22,6 +22,7 @@
     1.4  # Benchmarking data.
     1.5  profile.data
     1.6  *.prof
     1.7 +*.pstats
     1.8  
     1.9  # LaTeX outputs.
    1.10  # *.{aux,dvi,log,nav,out,pdf,ps,snm,toc,vrb}
     2.1 --- a/viff/comparison.py	Wed Oct 01 14:09:26 2008 +0200
     2.2 +++ b/viff/comparison.py	Thu Oct 02 11:20:05 2008 +0200
     2.3 @@ -80,8 +80,7 @@
     2.4          assert self.num_players + 2 < 2**l
     2.5  
     2.6          bits = [self.prss_share_bit_double(field) for _ in range(m)]
     2.7 -        int_bits = [a for (a, _) in bits]
     2.8 -        bit_bits = [b for (_, b) in bits]
     2.9 +        int_bits, bit_bits = zip(*bits)
    2.10  
    2.11          def bits_to_int(bits):
    2.12              """Converts a list of bits to an integer."""
    2.13 @@ -94,7 +93,7 @@
    2.14          a = share_a - share_b + 2**l
    2.15          T = self.open(2**t - int_b + a)
    2.16  
    2.17 -        result = gather_shares([T] + bit_bits)
    2.18 +        result = gather_shares((T,) + bit_bits)
    2.19          self.schedule_callback(result, self._finish_greater_than_equal, l)
    2.20          return result
    2.21  
     3.1 --- a/viff/runtime.py	Wed Oct 01 14:09:26 2008 +0200
     3.2 +++ b/viff/runtime.py	Thu Oct 02 11:20:05 2008 +0200
     3.3 @@ -1126,7 +1126,7 @@
     3.4          # http://bugs.python.org/issue1375 since the start and stop
     3.5          # calls are in different stack frames.
     3.6          import hotshot
     3.7 -        prof = hotshot.Profile("viff-%d.prof" % id)
     3.8 +        prof = hotshot.Profile("player-%d.prof" % id)
     3.9          old_run = reactor.run
    3.10          def new_run(*args, **kwargs):
    3.11              print "Starting reactor with profiling"
    3.12 @@ -1136,12 +1136,13 @@
    3.13              import hotshot.stats
    3.14              print "Loading profiling statistics...",
    3.15              sys.stdout.flush()
    3.16 -            stats = hotshot.stats.load("viff-%d.prof" % id)
    3.17 +            stats = hotshot.stats.load("player-%d.prof" % id)
    3.18              print "done."
    3.19              print
    3.20              stats.strip_dirs()
    3.21              stats.sort_stats("time", "calls")
    3.22              stats.print_stats(40)
    3.23 +            stats.dump_stats("player-%d.pstats" % id)
    3.24          reactor.run = new_run
    3.25  
    3.26      # This will yield a Runtime when all protocols are connected.
     4.1 --- a/viff/shamir.py	Wed Oct 01 14:09:26 2008 +0200
     4.2 +++ b/viff/shamir.py	Thu Oct 02 11:20:05 2008 +0200
     4.3 @@ -98,10 +98,9 @@
     4.4      Shares is a list of *threshold* + 1 ``(player id, share)`` pairs.
     4.5      Recombination is done in the optional point *x_recomb*.
     4.6      """
     4.7 -    xs = [x_i for (x_i, _) in shares]
     4.8 -    ys = [y_i for (_, y_i) in shares]
     4.9 +    xs, ys = zip(*shares)
    4.10 +    key = xs + (x_recomb, )
    4.11      try:
    4.12 -        key = tuple(xs) + (x_recomb, )
    4.13          vector = _recombination_vectors[key]
    4.14      except KeyError:
    4.15          vector = []