in src/hit/api/linearalgebra/linearalgebra.cpp [701:722]
void LinearAlgebra::matrix_multiply_validation(const EncryptedMatrix &enc_mat_a, const EncryptedMatrix &enc_mat_b,
const string &api) {
TRY_AND_THROW_STREAM(enc_mat_a.validate(),
"The enc_mat_a argument to " + api + " is invalid; has it been initialized?");
TRY_AND_THROW_STREAM(enc_mat_b.validate(),
"The enc_mat_b_trans argument to " + api + " is invalid; has it been initialized?");
if (enc_mat_a.encoding_unit() != enc_mat_b.encoding_unit()) {
LOG_AND_THROW_STREAM("Inputs to " + api + " must have the same units: "
<< dim_string(enc_mat_a.encoding_unit())
<< "!=" << dim_string(enc_mat_b.encoding_unit()));
}
if (enc_mat_a.needs_rescale() || enc_mat_b.needs_rescale()) {
LOG_AND_THROW_STREAM("Inputs to " + api + " must have nominal scale: "
<< "First argument: " << enc_mat_a.needs_rescale()
<< ", Second argument: " << enc_mat_b.needs_rescale());
}
if (enc_mat_a.needs_relin() || enc_mat_b.needs_relin()) {
LOG_AND_THROW_STREAM("Inputs to " + api + " must be linear ciphertexts: "
<< "First argument: " << enc_mat_a.needs_relin()
<< ", Second argument: " << enc_mat_b.needs_relin());
}
}