/rev/aa2b3941a380
changeset: 1195:aa2b3941a380
user:      Martin Geisler <[email protected]>
date:      Mon Jul 13 14:17:52 2009 +0200
summary:   Faster computation of dot product.

diffstat:

 viff/passive.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 51167e387cc3 -r aa2b3941a380 viff/passive.py
--- a/viff/passive.py   Thu Jun 25 08:58:54 2009 +0200
+++ b/viff/passive.py   Mon Jul 13 14:17:52 2009 +0200
@@ -19,6 +19,8 @@
 
 """Passively secure VIFF runtime."""
 
+import operator
+
 from viff import shamir
 from viff.runtime import Runtime, increment_pc, Share, ShareList, gather_shares
 from viff.prss import prss, prss_lsb, prss_zero, prss_multi
@@ -163,8 +165,7 @@
             "Number of coefficients and shares should be equal."
 
         def computation(shares, coefficients):
-            summands = [shares[i] * coefficients[i] for i in 
range(len(shares))]
-            return reduce(lambda x, y: x + y, summands)
+            return sum(map(operator.mul, shares, coefficients))
 
         result = gather_shares(shares)
         result.addCallback(computation, coefficients)
_______________________________________________
viff-commits mailing list
[email protected]
http://lists.viff.dk/listinfo.cgi/viff-commits-viff.dk

Reply via email to