forked from data61/MP-SPDZ
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_args.mpc
31 lines (25 loc) · 933 Bytes
/
test_args.mpc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from Compiler.library import print_ln
from Compiler.types import Matrix, sint
from Compiler.compilerLib import Compiler
usage = "usage: %prog [options] [args]"
compiler = Compiler(usage=usage)
compiler.parser.add_option("--rows", dest="rows")
compiler.parser.add_option("--columns", dest="columns")
compiler.parse_args()
if not compiler.options.rows:
compiler.parser.error("--rows required")
if not compiler.options.columns:
compiler.parser.error("--columns required")
@compiler.register_function('testmpc')
def main():
numrows = int(compiler.options.rows)
numcolumns = int(compiler.options.columns)
rows = range(numrows)
reports = Matrix(numrows, numcolumns, sint)
reports.assign_vector(
sint.get_input_from(0, size=numrows * numcolumns)
)
for row in rows:
print_ln("report[{}]: %s".format(row), reports[row].reveal())
if __name__ == "__main__":
compiler.compile_func()