Skip to content

Commit

Permalink
Python dependencies removed from Sequre
Browse files Browse the repository at this point in the history
  • Loading branch information
hsmajlovic committed Nov 24, 2023
1 parent c3eee70 commit b8faedf
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
prerelease: true

- name: Output Release URL File
if: steps.check.outputs.MAKE_RELEASE
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mkdir $HOME/.codon && curl -L https://github.com/0xTCG/sequre-mhe/releases/downl

Then install Sequre:
```bash
curl -L https://github.com/0xTCG/sequre-mhe/releases/download/v0.0.3-alpha/sequre-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz | tar zxvf - -C $HOME/.codon/lib/codon/plugins
curl -L https://github.com/0xTCG/sequre-mhe/releases/download/v0.0.4-alpha/sequre-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz | tar zxvf - -C $HOME/.codon/lib/codon/plugins
```

Afterwards, add alias for sequre command:
Expand Down
25 changes: 0 additions & 25 deletions stdlib/helpers.codon
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,3 @@ def _evaluate_and_reorder(mpc, mats):

def matmul_reordering(mpc, mats):
return _evaluate_and_reorder(mpc, [m for m in mats])


# Python helpers
@python
def python_modulus(n: str, q: str) -> str:
return str(int(n) % int(q))


@python
def python_lin_reg_stat_sig(X: List[List[float]], y: List[float], predictions: List[float], weights: List[float]) -> List[float]:
import numpy as np
from scipy import stats

np_X = np.array(X)
np_y = np.array(y)
np_pred = np.array(predictions)
np_w = np.array(weights)

X_tilde = np.append(np.ones((len(np_X), 1)), np_X, axis=1)
mse = (sum((np_y - np_pred) ** 2)) / (len(X_tilde) - len(X_tilde[0]))
v_b = mse * (np.linalg.inv(np.dot(X_tilde.T, X_tilde)).diagonal())
s_b = np.sqrt(v_b)
t_b = np_w / s_b

return [2 * (1 - stats.t.cdf(np.abs(i), (len(X_tilde) - len(X_tilde[0])))) for i in t_b]
1 change: 0 additions & 1 deletion stdlib/sequre/utils/param.codon
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,4 @@ P1_P2_SOCKET_PATH = f'{AF_PREFIX}{PORT_P1_P2}'
# Stdlib
DIV_MAX_N = 100000
MATMUL_LEAF_SIZE = 64
SIGMOID_APPROX_PATH = 'data/sigmoid_approx.txt'
EIGEN_DECOMP_ITER_PER_EVAL = 5
6 changes: 5 additions & 1 deletion tests/unit_tests/test_primitives.codon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ from sequre.utils.testing import assert_eq
from sequre.utils.param import *
from sequre.utils.primitives import strassen, mod_inv, mod_pow

from helpers import python_modulus

# Python helpers required in this module
@python
def python_modulus(n: str, q: str) -> str:
return str(int(n) % int(q))


def test_modular[TP](modulus: TP, algebraic_structure: str):
Expand Down

0 comments on commit b8faedf

Please sign in to comment.