Skip to content

Commit ff07ee7

Browse files
authored
feat: improved alignment of lib with Numpy (#30)
* feat: changed behaviour to return np arrays vs items * feat: added both-way broadcasting for secret rationals
1 parent 5e913b4 commit ff07ee7

19 files changed

+500
-87
lines changed

examples/dot_product/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This tutorial shows how to efficiently program a dot product in Nada using Nada
44

55
```python
66
from nada_dsl import *
7+
78
# Step 0: Nada Algebra is imported with this line
89
import nada_algebra as na
910

@@ -13,16 +14,16 @@ def nada_main():
1314
parties = na.parties(3)
1415

1516
# Step 2: Party0 creates an array of dimension (3, ) with name "A"
16-
a = na.array([3], parties[0], "A")
17+
a = na.array([3], parties[0], "A", SecretInteger)
1718

1819
# Step 3: Party1 creates an array of dimension (3, ) with name "B"
19-
b = na.array([3], parties[1], "B")
20+
b = na.array([3], parties[1], "B", SecretInteger)
2021

2122
# Step 4: The result is of computing the dot product between the two
2223
result = a.dot(b)
2324

2425
# Step 5: We can use result.output() to produce the output for Party2 and variable name "my_output"
25-
return result.output(parties[1], "my_output")
26+
return na.output(result, parties[1], "my_output")
2627

2728
```
2829

examples/dot_product/src/dot_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def nada_main():
1818
result = a.dot(b)
1919

2020
# Step 5: We can use result.output() to produce the output for Party2 and variable name "my_output"
21-
return result.output(parties[1], "my_output")
21+
return na.output(result, parties[1], "my_output")

0 commit comments

Comments
 (0)