Skip to content

Commit

Permalink
renames ntl files to be more systematic
Browse files Browse the repository at this point in the history
  • Loading branch information
amiller committed Jun 7, 2019
1 parent 5d9b1f6 commit 0636730
Show file tree
Hide file tree
Showing 14 changed files with 25 additions and 21 deletions.
1 change: 1 addition & 0 deletions honeybadgermpc/ntl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._hbmpc_ntl_helpers import * # noqa F403, F401
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Code ot help help python objects to C++ objects
cdef extern from "ccobject.h":
cdef extern from "ccobject_impl.h":
# Print representation of any C++ object
str ccrepr[T](T x)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
# The data validation and checking must be done in python in all cases!
# PEP8 standards are observed wherever possible but ignored in cases whether NTL
# classes are used (like ZZ, mat_ZZ_p, etc) and also for NTL function names
from .ctypes cimport ZZ, ZZ_p, mat_ZZ_p, vec_ZZ_p, ZZ_pX_c
from .ctypes cimport mat_ZZ_p_mul
from .ctypes cimport ZZFromBytes, bytesFromZZ, to_ZZ_p, to_ZZ, ZZNumBytes
from .objectwrapper cimport ccrepr, ccreadstr
from .ctypes cimport SetNTLNumThreads_c, AvailableThreads, ZZ_p_init, ZZ_pX_get_coeff, \
ZZ_pX_set_coeff, ZZ_pX_eval, SqrRootMod
from .ntlwrapper cimport ZZ, ZZ_p, mat_ZZ_p, vec_ZZ_p, ZZ_pX_c
from .ntlwrapper cimport mat_ZZ_p_mul, ZZ_p_init, SqrRootMod
from .ntlwrapper cimport ZZFromBytes, bytesFromZZ, to_ZZ_p, to_ZZ, ZZNumBytes
from .ntlwrapper cimport SetNTLNumThreads_c, AvailableThreads
from .ntlwrapper cimport ZZ_pX_get_coeff, ZZ_pX_set_coeff, ZZ_pX_eval
from .rsdecode cimport interpolate_c, vandermonde_inverse_c, set_vm_matrix_c, fft_c, fft_partial_c, fnt_decode_step1_c, fnt_decode_step2_c, gao_interpolate_c, gao_interpolate_fft_c
from .ccobject cimport ccrepr, ccreadstr
from cpython.int cimport PyInt_AS_LONG
from cython.parallel import parallel, prange
from libc.stdlib cimport free
from libcpp.vector cimport vector
cimport openmp


cdef ZZ intToZZ(x):
num = (x.bit_length() + 7) // 8
return ZZFromBytes(x.to_bytes(num, 'little'), num)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from libcpp.vector cimport vector

cdef extern from "ntlwrapper.h":
cdef extern from "ntlwrapper_impl.h":
cdef cppclass ZZ "ZZ":
ZZ() except +
pass
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .ctypes cimport ZZ, mat_ZZ_p, vec_ZZ_p, ZZ_p, ZZ_pX_c
from .ntlwrapper cimport ZZ, mat_ZZ_p, vec_ZZ_p, ZZ_p, ZZ_pX_c
from libcpp.vector cimport vector
from libcpp cimport bool

Expand Down
4 changes: 2 additions & 2 deletions honeybadgermpc/polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from functools import reduce
from itertools import zip_longest

from honeybadgermpc.ntl.helpers import fft as fft_cpp
from honeybadgermpc.ntl.helpers import fft_interpolate as fft_interpolate_cpp
from honeybadgermpc.ntl import fft as fft_cpp
from honeybadgermpc.ntl import fft_interpolate as fft_interpolate_cpp

from .betterpairing import ZR
from .elliptic_curve import Subgroup
Expand Down
2 changes: 1 addition & 1 deletion honeybadgermpc/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from os import makedirs
from .field import GF
from .polynomial import polynomials_over
from .ntl.helpers import vandermonde_batch_evaluate
from .ntl import vandermonde_batch_evaluate
from .elliptic_curve import Subgroup


Expand Down
4 changes: 2 additions & 2 deletions honeybadgermpc/progs/triple_refinement.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import asyncio
from honeybadgermpc.ntl.helpers import vandermonde_batch_evaluate
from honeybadgermpc.ntl.helpers import vandermonde_batch_interpolate
from honeybadgermpc.ntl import vandermonde_batch_evaluate
from honeybadgermpc.ntl import vandermonde_batch_interpolate


async def batch_beaver(context, a_, b_, x_, y_, z_):
Expand Down
6 changes: 3 additions & 3 deletions honeybadgermpc/reed_solomon.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from honeybadgermpc.ntl.helpers import vandermonde_batch_evaluate, \
from honeybadgermpc.ntl import vandermonde_batch_evaluate, \
vandermonde_batch_interpolate
from honeybadgermpc.ntl.helpers import gao_interpolate
from honeybadgermpc.ntl.helpers import fft, fft_interpolate, fft_batch_interpolate, \
from honeybadgermpc.ntl import gao_interpolate
from honeybadgermpc.ntl import fft, fft_interpolate, fft_batch_interpolate, \
fft_batch_evaluate, SetNumThreads, AvailableNTLThreads
from honeybadgermpc.reed_solomon_wb import make_wb_encoder_decoder
from honeybadgermpc.exceptions import HoneyBadgerMPCError
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@

extensions = [
Extension(
name="honeybadgermpc.ntl.helpers",
sources=["honeybadgermpc/ntl/helpers.pyx"],
name="honeybadgermpc.ntl._hbmpc_ntl_helpers",
sources=["honeybadgermpc/ntl/hbmpc_ntl_helpers.pyx"],
language="c++",
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ntl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from honeybadgermpc.ntl.helpers import lagrange_interpolate, \
from honeybadgermpc.ntl import lagrange_interpolate, \
vandermonde_batch_interpolate, vandermonde_batch_evaluate, \
fft, fft_interpolate, fft_batch_interpolate, \
gao_interpolate, evaluate, sqrt_mod, partial_fft, fft_batch_evaluate
Expand Down
2 changes: 1 addition & 1 deletion tests/test_reed_solomon.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from honeybadgermpc.polynomial import EvalPoint
from honeybadgermpc.reed_solomon import EncoderFactory, DecoderFactory
from honeybadgermpc.reed_solomon import EncoderSelector, DecoderSelector
from honeybadgermpc.ntl.helpers import AvailableNTLThreads
from honeybadgermpc.ntl import AvailableNTLThreads
from unittest.mock import patch


Expand Down

0 comments on commit 0636730

Please sign in to comment.