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