Skip to content

Commit 6902567

Browse files
Feature/major rescaling (#19)
Majorly change redesign of rational interface
1 parent 42e88ae commit 6902567

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1441
-576
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install black
24+
pip install black[jupyter]
2525
- name: Check linting
2626
run: black --check .
2727
# If PR fails in this stage, it's because of linting issues: run `black .` to fix them

examples/broadcasting/src/broadcasting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ def nada_main():
99
parties = na.parties(3)
1010

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

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

1717
# Step 4: Party0 creates an array of dimension (3, ) with name "C"
18-
c = na.array([3], parties[0], "C")
18+
c = na.array([3], parties[0], "C", SecretInteger)
1919

2020
# Step 5: Party1 creates an array of dimension (3, ) with name "D"
21-
d = na.array([3], parties[1], "D")
21+
d = na.array([3], parties[1], "D", SecretInteger)
2222

2323
# Step 4: The result is of computing SIMD operations on top of the elements of the array
2424
# SIMD operations are performed on all the elements of the array.

examples/dot_product/src/dot_product.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ def nada_main():
99
parties = na.parties(3)
1010

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

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

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

examples/matrix_multiplication/src/matrix_multiplication.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ def nada_main():
99
parties = na.parties(3)
1010

1111
# Step 2: Party0 creates an array of dimension (3 x 3) with name "A"
12-
a = na.array([3, 3], parties[0], "A")
12+
a = na.array([3, 3], parties[0], "A", SecretInteger)
1313

1414
# Step 3: Party1 creates an array of dimension (3 x 3) with name "B"
15-
b = na.array([3, 3], parties[1], "B")
15+
b = na.array([3, 3], parties[1], "B", SecretInteger)
1616

1717
# Step 4: The result is of computing the dot product between the two which is another (3 x 3) matrix
1818
result = a @ b

examples/rational_numbers/src/rational_numbers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ def nada_main():
77
parties = na.parties(3)
88

99
# We use na.SecretRational to create a secret rational number for party 0
10-
a = na.SecretRational("my_input_0", parties[0])
10+
a = na.secret_rational("my_input_0", parties[0])
1111

1212
# We use na.SecretRational to create a secret rational number for party 1
13-
b = na.SecretRational("my_input_1", parties[1])
13+
b = na.secret_rational("my_input_1", parties[1])
1414

1515
# This is a compile time rational number
16-
c = na.Rational(1.2)
16+
c = na.rational(1.2)
1717

1818
# The formula below does operations on rational numbers and returns a rational number
1919
# It's easy to see that (a + b - c) is both on numerator and denominator, so the end result is b

nada_algebra/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
"""This is the __init__.py module"""
22

33
from nada_algebra.array import NadaArray
4-
from nada_algebra.types import RationalConfig, Rational, SecretRational
54
from nada_algebra.funcs import *
5+
from nada_algebra.types import (
6+
Rational,
7+
SecretRational,
8+
public_rational,
9+
rational,
10+
secret_rational,
11+
get_log_scale,
12+
reset_log_scale,
13+
set_log_scale,
14+
)

0 commit comments

Comments
 (0)