Skip to content

Commit 7fe404c

Browse files
authored
HElib v2.0.0 release - documentation update
* This update includes a list of deprecated APIs and recommendations of the new APIs to use.
1 parent a645483 commit 7fe404c

File tree

10 files changed

+99
-2
lines changed

10 files changed

+99
-2
lines changed
-504 KB
Binary file not shown.

include/helib/Ctxt.h

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,9 @@ class Ctxt
607607
* @brief Times equals operator with a `ZZX`.
608608
* @param poly Element by which to multiply.
609609
* @return Reference to `*this` post multiplication.
610+
* @deprecated This function is deprecated in favor of a new
611+
* `EncodedPtxt`-based API.\n
612+
* Please use `Ctxt::operator*=(const EncodedPtxt& ptxt)` instead.
610613
**/
611614
// [[deprecated]]
612615
Ctxt& operator*=(const NTL::ZZX& poly);
@@ -648,34 +651,60 @@ class Ctxt
648651
}
649652

650653
//! add a rational number in the form a/b, a,b are long
654+
/**
655+
* @deprecated This function is deprecated in favor of a newer API.
656+
* Please use `Ctxt::operator+=(double ptxt)` instead.
657+
**/
651658
// [[deprecated]]
652659
void addConstantCKKS(std::pair</*numerator=*/long, /*denominator=*/long>);
660+
/**
661+
* @deprecated This function is deprecated in favor of a newer API.
662+
* Please use `Ctxt::operator+=(double ptxt)` instead.
663+
**/
653664
// [[deprecated]]
654665
void addConstantCKKS(double x)
655666
{ // FIXME: not enough precision when x is large
656667
addConstantCKKS(
657668
rationalApprox(x, /*denomBound=*/1L << getContext().getAlMod().getR()));
658669
}
659670

671+
/**
672+
* @deprecated This function is deprecated in favor of a newer API.
673+
* Please use `Ctxt::operator+=(const FatEncodedPtxt& ptxt)` instead.
674+
**/
660675
// [[deprecated]]
661676
void addConstantCKKS(const DoubleCRT& dcrt,
662677
NTL::xdouble size = NTL::xdouble(-1.0),
663678
NTL::xdouble factor = NTL::xdouble(-1.0));
664679

680+
/**
681+
* @deprecated This function is deprecated in favor of a newer API.
682+
* Please use `Ctxt::operator+=(const EncodedPtxt& ptxt)` instead.
683+
**/
665684
// [[deprecated]]
666685
void addConstantCKKS(const NTL::ZZX& poly,
667686
NTL::xdouble size = NTL::xdouble(-1.0),
668687
NTL::xdouble factor = NTL::xdouble(-1.0));
669688

689+
/**
690+
* @deprecated This function is deprecated in favor of a newer API.
691+
* Please use `Ctxt::operator+=(const PtxtArray& ptxt)` instead.
692+
**/
670693
// [[deprecated]]
671694
void addConstantCKKS(const std::vector<std::complex<double>>& ptxt);
672695

673696
/**
674697
* @brief Add a `CKKS` plaintext to this `Ctxt`.
675698
* @param ptxt Plaintext `Ptxt` object with which to add.
699+
* @deprecated This function is deprecated in favor of a newer API.
700+
* Please use `Ctxt::operator+=(const PtxtArray& ptxt)` instead.
676701
**/
677702
// [[deprecated]]
678703
void addConstantCKKS(const Ptxt<CKKS>& ptxt);
704+
/**
705+
* @deprecated This function is deprecated in favor of a newer API.
706+
* Please use `Ctxt::operator+=(const NTL::ZZ& ptxt)` instead.
707+
**/
679708
// [[deprecated]]
680709
void addConstantCKKS(const NTL::ZZ& c);
681710

@@ -1061,6 +1090,10 @@ class Ctxt
10611090
}
10621091

10631092
//! multiply by a rational number or floating point
1093+
/**
1094+
* @deprecated This function is deprecated in favor of a newer API.
1095+
* Please use `Ctxt::operator*=(double ptxt)` instead.
1096+
**/
10641097
// [[deprecated]]
10651098
void multByConstantCKKS(double x)
10661099
{
@@ -1082,18 +1115,30 @@ class Ctxt
10821115
this->negate();
10831116
}
10841117

1118+
/**
1119+
* @deprecated This function is deprecated in favor of a newer API.
1120+
* Please use `Ctxt::operator*=(double ptxt)` instead.
1121+
**/
10851122
// [[deprecated]]
10861123
void multByConstantCKKS(std::pair<long, long> num) // rational number
10871124
{
10881125
multByConstantCKKS(double(num.first) / num.second);
10891126
}
10901127

1128+
/**
1129+
* @deprecated This function is deprecated in favor of a newer API.
1130+
* Please use `Ctxt::operator*=(const FatEncodedPtxt& ptxt)` instead.
1131+
**/
10911132
// [[deprecated]]
10921133
void multByConstantCKKS(const DoubleCRT& dcrt,
10931134
NTL::xdouble size = NTL::xdouble(-1.0),
10941135
NTL::xdouble factor = NTL::xdouble(-1.0),
10951136
double roundingErr = -1.0);
10961137

1138+
/**
1139+
* @deprecated This function is deprecated in favor of a newer API.
1140+
* Please use `Ctxt::operator*=(const EncodedPtxt& ptxt)` instead.
1141+
**/
10971142
// [[deprecated]]
10981143
void multByConstantCKKS(const NTL::ZZX& poly,
10991144
NTL::xdouble size = NTL::xdouble(-1.0),
@@ -1109,9 +1154,15 @@ class Ctxt
11091154
/**
11101155
* @brief Multiply a `CKKS` plaintext to this `Ctxt`.
11111156
* @param ptxt Plaintext `Ptxt` object polynomial with which to multiply.
1157+
* @deprecated This function is deprecated in favor of a newer API.
1158+
* Please use `Ctxt::operator*=(const PtxtArray& ptxt)` instead.
11121159
**/
11131160
// [[deprecated]]
11141161
void multByConstantCKKS(const Ptxt<CKKS>& ptxt);
1162+
/**
1163+
* @deprecated This function is deprecated in favor of a newer API.
1164+
* Please use `Ctxt::operator*=(const PtxtArray& ptxt)` instead.
1165+
**/
11151166
// [[deprecated]]
11161167
void multByConstantCKKS(const std::vector<std::complex<double>>& ptxt);
11171168

@@ -1339,7 +1390,10 @@ class Ctxt
13391390
return 0; // just to keep the compiler happy
13401391
}
13411392

1342-
//! @brief Returns log(noiseBound) - log(q)
1393+
/**
1394+
* @brief Returns log(noiseBound) - log(q)
1395+
* @deprecated This is deprecated. Please use `Ctxt::capacity()` instead.
1396+
**/
13431397
// [[deprecated]] // use capacity()
13441398
double log_of_ratio() const
13451399
{

include/helib/EncryptedArray.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,11 +1148,23 @@ class EncryptedArrayDerived<PA_cx> : public EncryptedArrayBase
11481148
// VJS-FIXME: these routine have a number of issues and should
11491149
// be deprecated in favor of the new EncodedPtxt-based routines
11501150

1151+
/**
1152+
* @brief Function for encoding a `double` into a `zzX`.
1153+
* @deprecated This routine has a number of issues and is deprecated in favor
1154+
* of the new `EncodedPtxt`-based routine.\n
1155+
* Please use `PtxtArray::encode()` instead.
1156+
**/
11511157
double encode(zzX& ptxt,
11521158
double aSingleNumber,
11531159
double useThisSize = -1,
11541160
long precision = -1) const;
11551161

1162+
/**
1163+
* @brief Function for encoding a `double` into a `zzX`.
1164+
* @deprecated This routine has a number of issues and is deprecated in favor
1165+
* of the new `EncodedPtxt`-based routine.\n
1166+
* Please use `PtxtArray::encode()` instead.
1167+
**/
11561168
template <typename PTXT>
11571169
double encode(NTL::ZZX& ptxt,
11581170
const PTXT& pt,
@@ -1365,6 +1377,10 @@ class EncryptedArrayDerived<PA_cx> : public EncryptedArrayBase
13651377
project(array, v);
13661378
}
13671379

1380+
/**
1381+
* @deprecated This routine has a number of issues and is deprecated in favor
1382+
* of either `RandomComplex()` or `PtxtArray::random()`.
1383+
**/
13681384
void random(std::vector<cx_double>& array, double rad = 1.0) const;
13691385
void random(std::vector<double>& array, double rad = 1.0) const
13701386
{
@@ -1990,6 +2006,12 @@ class PlaintextArrayDerived : public PlaintextArrayBase
19902006
virtual void print(std::ostream& s) const { s << data; }
19912007
};
19922008

2009+
/**
2010+
* @deprecated There is a somewhat "friendlier" interface available in
2011+
* `PtxtArray` as it carries with it a reference to an `EncryptedArray`.
2012+
* It is recommended that `PlaintextArray` be deprecated in favor of
2013+
* `PtxtArray`.
2014+
**/
19932015
class PlaintextArray
19942016
{
19952017
private:

include/helib/FHE.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#define HELIB_FHE_H
1515
/**
1616
@file FHE.h
17-
@brief Deprecated entry point header for HElib (legacy alias of helib.h)
17+
@brief Deprecated entry point header for HElib (legacy alias of `helib.h`)
18+
@deprecated This header is a deprecated alias of `helib.h`.
1819
*/
1920

2021
#include <helib/helib.h>

include/helib/keys.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,19 +160,39 @@ class PubKey
160160
// VJS-FIXME: these routine have a number of issues and should
161161
// be deprecated in favor of the new EncodedPtxt-based routines
162162

163+
/**
164+
* @deprecated This routine has a number of issues and is deprecated in favor
165+
* of the new `EncodedPtxt`-based routine.\n
166+
* Please use `PtxtArray::encrypt()` instead.
167+
**/
163168
long Encrypt(Ctxt& ciphertxt,
164169
const NTL::ZZX& plaintxt,
165170
long ptxtSpace,
166171
bool highNoise) const;
172+
/**
173+
* @deprecated This routine has a number of issues and is deprecated in favor
174+
* of the new `EncodedPtxt`-based routine.\n
175+
* Please use `PtxtArray::encrypt()` instead.
176+
**/
167177
long Encrypt(Ctxt& ciphertxt,
168178
const zzX& plaintxt,
169179
long ptxtSpace,
170180
bool highNoise) const;
171181

182+
/**
183+
* @deprecated This routine has a number of issues and is deprecated in favor
184+
* of the new `EncodedPtxt`-based routine.\n
185+
* Please use `PtxtArray::encrypt()` instead.
186+
**/
172187
void CKKSencrypt(Ctxt& ciphertxt,
173188
const NTL::ZZX& plaintxt,
174189
double ptxtSize = 1.0,
175190
double scaling = 0.0) const;
191+
/**
192+
* @deprecated This routine has a number of issues and is deprecated in favor
193+
* of the new `EncodedPtxt`-based routine.\n
194+
* Please use `PtxtArray::encrypt()` instead.
195+
**/
176196
void CKKSencrypt(Ctxt& ciphertxt,
177197
const zzX& plaintxt,
178198
double ptxtSize = 1.0,

0 commit comments

Comments
 (0)