Examples and features #2
hsmajlovic
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sequre examples
Householder (~65 LOC in C++):
QR factorization (~100 LOC in C++):
Tridiagonalization (~120 LOC in C++):
Eigen decomposition (~80 LOC in C++):
Orthonormal basis calculation (~110 LOC in C++):
Sequre features
Beaver partitions propagation
Beaver partitions of
a
andb
are propagated toc
(offline) withinc = a ˚ b
, where˚
is some SMPC operation.Polynomial reduction (currently disabled)
In the code snippet above, first two assignments are erased and return statement is replaced with
return a**2 * d + 2*a*b*d + b**2 * d
in compile time, which is then propagated to optimized polynomial reduction method in runtime. This polynomial reduction method requires only a single beaver partitioning for a, b, and d (c is removed by compiler).Numpy-like syntax
No need for explicit
double_to_fp
orint_to_fp
calls in Sequre. Compiler will apply those automatically:Comparison operators (
<
,>
) between shared values will be transformed into MPC equivalents (i.e.is_positive
,less_than
, etc.)Compile-time pattern matching and optimization
There are few compile time transformations that leverage some MPC intrinsics in order to optimize performance. Examples:
a = b / sqrt(c)
will be internally transformed intoa = b * sqrt_inv(c)
a = b / 3.4
will be internally transformed intoa = b.to_fp() * double_to_fp(1 / 3.4)
etc.
Diagonal matrix optimizations
In code snipped above, calculation of C will be transformed into (approx.):
as compiler will figure out that two addends are diagonal matrices.
Beta Was this translation helpful? Give feedback.
All reactions