mirror of
https://github.com/data61/MP-SPDZ.git
synced 2026-01-10 05:57:57 -05:00
Convolutional neural network training.
This commit is contained in:
36
FHE/AddableVector.hpp
Normal file
36
FHE/AddableVector.hpp
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* AddableVector.cpp
|
||||
*
|
||||
*/
|
||||
|
||||
#include "AddableVector.h"
|
||||
#include "Rq_Element.h"
|
||||
#include "FHE_Keys.h"
|
||||
#include "P2Data.h"
|
||||
|
||||
template<class T>
|
||||
AddableVector<T> AddableVector<T>::mul_by_X_i(int j,
|
||||
const FHE_PK& pk) const
|
||||
{
|
||||
int phi_m = this->size();
|
||||
assert(phi_m == pk.get_params().phi_m());
|
||||
AddableVector res(phi_m);
|
||||
for (int i = 0; i < phi_m; i++)
|
||||
{
|
||||
int k = j + i, s = 1;
|
||||
while (k >= phi_m)
|
||||
{
|
||||
k -= phi_m;
|
||||
s = -s;
|
||||
}
|
||||
if (s == 1)
|
||||
{
|
||||
res[k] = (*this)[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
res[k] = -(*this)[i];
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in New Issue
Block a user