HElib icon indicating copy to clipboard operation
HElib copied to clipboard

Question about the choice of vector<Ctxt> ctxt or Ctxt* ctxt

Open DylanWangWQF opened this issue 3 years ago • 0 comments

Hi, I have a question about creating a Ctxt array. Which one should I choose (which is faster or more reasonable in ciphertext operations?):

Ctxt* ctxt1 = new Ctxt(publicKey, size);
vector<Ctxt> ctxt2(size);
ctxt1[0] = ctxt_test;
ctxt2[0] = ctxt_test;

2-dimensional:

vector<vector<Ctxt>> ctxt3(size);
ctxt3[k] = vector<Ctxt>(size);

Ctxt** ctxt4 = new Ctxt*[size];
ctxt4[k] = new Ctxt(publicKey, size);

Or use the definitions in CtPtrs.h? Is there any document to introduce this and guide us to use this?

typedef PtrVector<Ctxt> CtPtrs;
// CtPtrs_VecCt(NTL::Vec<Ctxt>)
typedef PtrVector_VecT<Ctxt> CtPtrs_VecCt;
// CtPtrs_vectorCt(std::vector<Ctxt>)
typedef PtrVector_vectorT<Ctxt> CtPtrs_vectorCt;
// CtPtrs_VecPt(NTL::Vec<Ctxt*>)
typedef PtrVector_VecPt<Ctxt> CtPtrs_VecPt;
// CtPtrs_vectorPt(std::vector<Ctxt*>)
typedef PtrVector_vectorPt<Ctxt> CtPtrs_vectorPt;

DylanWangWQF avatar Apr 30 '21 03:04 DylanWangWQF