Hello guys,
the following code performs some computations with encrypted geo coordinates (latitude and longitude) in form of a vector of type double
. All points are stored in another vector encPoints
of type Ciphertext<DCRTPoly>
. The variable serverC
is the current location from which I want to query all locations in the vector encPoints
within a radius of 1000m. So I’m checking the distance point by point, which works fine with scheme switch. I would like to store the results of ctCompareDist
in a vector of type Ciphertext<DCRTPoly>
and serialize them for forwarding to a client. When I try to deserialize the vector of type Ciphertext I get the following message:
std::cout << "Running computations for euclidian distance ... " << '\n' << std::endl;
vector<Ciphertext<DCRTPoly>> euclidDistanceComparisons(encPoints.size());
for (int i = 0; i < encPoints.size(); i++) {
cout << i;
// Computations on the ciphertext
auto ctSubs = serverCC->EvalSub(encPoints[i], serverC);
auto ctSquares = serverCC->EvalSquare(ctSubs);
auto ctSum1 = serverCC->EvalSum(ctSquares, 2);
vector<double> mask = {1, 0, 0};
auto ctSum2 = serverCC->EvalMult(ctSum1, serverCC->MakeCKKSPackedPlaintext(mask));
double lowerBound = 0;
double upperBound = 0.09;
auto ctDistance = serverCC->EvalChebyshevFunction([](double x) -> double { return std::sqrt(x); }, ctSum2, lowerBound, upperBound, 10);
vector<double> mask2 = {0, 0, 1};
auto ct = serverCC->EvalMult(serverC, serverCC->MakeCKKSPackedPlaintext(mask2));
auto ctRadius = serverCC->EvalSum(ct, 3);
auto ctCompareDist = serverCC->EvalCompareSchemeSwitching(ctRadius, ctDistance);
euclidDistanceComparisons[i] = ctCompareDist;
}
Serial::SerializeToFile(DATAFOLDER + encCompareDistLocation, euclidDistanceComparisons, SerType::BINARY);