Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add const qualifier to Evaluator and BatchEncoder functions #334

Merged
merged 1 commit into from May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions native/src/seal/batchencoder.cpp
Expand Up @@ -107,7 +107,7 @@ namespace seal
}
}

void BatchEncoder::encode(const vector<uint64_t> &values_matrix, Plaintext &destination)
void BatchEncoder::encode(const vector<uint64_t> &values_matrix, Plaintext &destination) const
{
auto &context_data = *context_.first_context_data();

Expand Down Expand Up @@ -148,7 +148,7 @@ namespace seal
inverse_ntt_negacyclic_harvey(destination.data(), *context_data.plain_ntt_tables());
}

void BatchEncoder::encode(const vector<int64_t> &values_matrix, Plaintext &destination)
void BatchEncoder::encode(const vector<int64_t> &values_matrix, Plaintext &destination) const
{
auto &context_data = *context_.first_context_data();
uint64_t modulus = context_data.parms().plain_modulus().value();
Expand Down Expand Up @@ -192,7 +192,7 @@ namespace seal
inverse_ntt_negacyclic_harvey(destination.data(), *context_data.plain_ntt_tables());
}
#ifdef SEAL_USE_MSGSL
void BatchEncoder::encode(gsl::span<const uint64_t> values_matrix, Plaintext &destination)
void BatchEncoder::encode(gsl::span<const uint64_t> values_matrix, Plaintext &destination) const
{
auto &context_data = *context_.first_context_data();

Expand Down Expand Up @@ -232,7 +232,7 @@ namespace seal
inverse_ntt_negacyclic_harvey(destination.data(), *context_data.plain_ntt_tables());
}

void BatchEncoder::encode(gsl::span<const int64_t> values_matrix, Plaintext &destination)
void BatchEncoder::encode(gsl::span<const int64_t> values_matrix, Plaintext &destination) const
{
auto &context_data = *context_.first_context_data();
uint64_t modulus = context_data.parms().plain_modulus().value();
Expand Down Expand Up @@ -275,7 +275,7 @@ namespace seal
inverse_ntt_negacyclic_harvey(destination.data(), *context_data.plain_ntt_tables());
}
#endif
void BatchEncoder::decode(const Plaintext &plain, vector<uint64_t> &destination, MemoryPoolHandle pool)
void BatchEncoder::decode(const Plaintext &plain, vector<uint64_t> &destination, MemoryPoolHandle pool) const
{
if (!is_valid_for(plain, context_))
{
Expand Down Expand Up @@ -314,7 +314,7 @@ namespace seal
}
}

void BatchEncoder::decode(const Plaintext &plain, vector<int64_t> &destination, MemoryPoolHandle pool)
void BatchEncoder::decode(const Plaintext &plain, vector<int64_t> &destination, MemoryPoolHandle pool) const
{
if (!is_valid_for(plain, context_))
{
Expand Down Expand Up @@ -358,7 +358,7 @@ namespace seal
}
}
#ifdef SEAL_USE_MSGSL
void BatchEncoder::decode(const Plaintext &plain, gsl::span<uint64_t> destination, MemoryPoolHandle pool)
void BatchEncoder::decode(const Plaintext &plain, gsl::span<uint64_t> destination, MemoryPoolHandle pool) const
{
if (!is_valid_for(plain, context_))
{
Expand Down Expand Up @@ -399,7 +399,7 @@ namespace seal
}
}

void BatchEncoder::decode(const Plaintext &plain, gsl::span<int64_t> destination, MemoryPoolHandle pool)
void BatchEncoder::decode(const Plaintext &plain, gsl::span<int64_t> destination, MemoryPoolHandle pool) const
{
if (!is_valid_for(plain, context_))
{
Expand Down
16 changes: 8 additions & 8 deletions native/src/seal/batchencoder.h
Expand Up @@ -77,7 +77,7 @@ namespace seal
@param[out] destination The plaintext polynomial to overwrite with the result
@throws std::invalid_argument if values is too large
*/
void encode(const std::vector<std::uint64_t> &values, Plaintext &destination);
void encode(const std::vector<std::uint64_t> &values, Plaintext &destination) const;

/**
Creates a plaintext from a given matrix. This function "batches" a given matrix
Expand All @@ -95,7 +95,7 @@ namespace seal
@param[out] destination The plaintext polynomial to overwrite with the result
@throws std::invalid_argument if values is too large
*/
void encode(const std::vector<std::int64_t> &values, Plaintext &destination);
void encode(const std::vector<std::int64_t> &values, Plaintext &destination) const;
#ifdef SEAL_USE_MSGSL
/**
Creates a plaintext from a given matrix. This function "batches" a given matrix
Expand All @@ -113,7 +113,7 @@ namespace seal
@param[out] destination The plaintext polynomial to overwrite with the result
@throws std::invalid_argument if values is too large
*/
void encode(gsl::span<const std::uint64_t> values, Plaintext &destination);
void encode(gsl::span<const std::uint64_t> values, Plaintext &destination) const;

/**
Creates a plaintext from a given matrix. This function "batches" a given matrix
Expand All @@ -131,7 +131,7 @@ namespace seal
@param[out] destination The plaintext polynomial to overwrite with the result
@throws std::invalid_argument if values is too large
*/
void encode(gsl::span<const std::int64_t> values, Plaintext &destination);
void encode(gsl::span<const std::int64_t> values, Plaintext &destination) const;
#endif
/**
Inverse of encode. This function "unbatches" a given plaintext into a matrix
Expand All @@ -150,7 +150,7 @@ namespace seal
*/
void decode(
const Plaintext &plain, std::vector<std::uint64_t> &destination,
MemoryPoolHandle pool = MemoryManager::GetPool());
MemoryPoolHandle pool = MemoryManager::GetPool()) const;

/**
Inverse of encode. This function "unbatches" a given plaintext into a matrix
Expand All @@ -169,7 +169,7 @@ namespace seal
*/
void decode(
const Plaintext &plain, std::vector<std::int64_t> &destination,
MemoryPoolHandle pool = MemoryManager::GetPool());
MemoryPoolHandle pool = MemoryManager::GetPool()) const;
#ifdef SEAL_USE_MSGSL
/**
Inverse of encode. This function "unbatches" a given plaintext into a matrix
Expand All @@ -189,7 +189,7 @@ namespace seal
*/
void decode(
const Plaintext &plain, gsl::span<std::uint64_t> destination,
MemoryPoolHandle pool = MemoryManager::GetPool());
MemoryPoolHandle pool = MemoryManager::GetPool()) const;

/**
Inverse of encode. This function "unbatches" a given plaintext into a matrix
Expand All @@ -209,7 +209,7 @@ namespace seal
*/
void decode(
const Plaintext &plain, gsl::span<std::int64_t> destination,
MemoryPoolHandle pool = MemoryManager::GetPool());
MemoryPoolHandle pool = MemoryManager::GetPool()) const;
#endif
/**
Returns the number of slots.
Expand Down