in src/hit/api/linearalgebra/encryptedcolvector.cpp [114:139]
void EncryptedColVector::validate() const {
// validate the unit
unit.validate();
if (height_ <= 0) {
LOG_AND_THROW_STREAM("Invalid EncryptedColVector: "
<< "height must be non-negative, got " << height_);
}
if (cts.size() != ceil(height_ / static_cast<double>(unit.encoding_width()))) {
LOG_AND_THROW_STREAM("Invalid EncryptedColVector: "
<< "Expected " << ceil(height_ / static_cast<double>(unit.encoding_width()))
<< " ciphertexts, found " << cts.size() << ". ");
}
for (int i = 1; i < cts.size(); i++) {
if (cts[i].scale() != cts[0].scale()) {
LOG_AND_THROW_STREAM("Invalid EncryptedColVector: "
<< "Each ciphertext must have the same scale.");
}
if (cts[i].he_level() != cts[0].he_level()) {
LOG_AND_THROW_STREAM("Invalid EncryptedColVector: "
<< "Each ciphertext must have the same level.");
}
}
}