forked from NillionNetwork/nillion-python-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_complex.py
More file actions
22 lines (15 loc) · 716 Bytes
/
array_complex.py
File metadata and controls
22 lines (15 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from nada_dsl import *
def nada_main():
party1 = Party(name="Party1")
party2 = Party(name="Party2")
my_int1 = SecretInteger(Input(name="my_int1", party=party1))
my_array_1 = Array(SecretInteger(Input(name="my_array_1", party=party1)), size=10)
my_array_2 = Array(SecretInteger(Input(name="my_array_2", party=party2)), size=10)
unzipped = unzip(my_array_2.zip(my_array_1))
@nada_fn
def add(a: SecretInteger, b: SecretInteger) -> SecretInteger:
return a + b
new_array = my_array_1.zip(my_array_2).map(add).reduce(add, my_int1)
out1 = Output(unzipped, "zip.unzip.tuple", party1)
out2 = Output(new_array, "zip.map.reduce.array", party1)
return [out1, out2]