From 20fc9bf961d78d1100d65eddebf7ea3c8093817e Mon Sep 17 00:00:00 2001 From: Duncan Tebbs Date: Mon, 4 Oct 2021 11:16:18 +0100 Subject: [PATCH] Style consistency --- .../domains/arithmetic_sequence_domain.tcc | 16 ++++++++------- .../domains/basic_radix2_domain.tcc | 2 +- .../domains/extended_radix2_domain.tcc | 8 +++++--- .../domains/geometric_sequence_domain.tcc | 18 +++++++++-------- .../domains/step_radix2_domain.tcc | 8 ++++---- .../get_evaluation_domain.tcc | 20 +++++++++---------- 6 files changed, 39 insertions(+), 33 deletions(-) diff --git a/libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.tcc b/libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.tcc index 8ae9431..c9b2a88 100755 --- a/libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.tcc +++ b/libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.tcc @@ -26,11 +26,13 @@ namespace libfqfft { template bool arithmetic_sequence_domain::valid_for_size(const size_t m) { - if (m <=1) - return false; + if (m <=1) { + return false; + } - if (FieldT::arithmetic_generator() == FieldT::zero()) - return false; + if (FieldT::arithmetic_generator() == FieldT::zero()) { + return false; + } return true; } @@ -54,7 +56,7 @@ void arithmetic_sequence_domain::FFT(std::vector &a) /* Monomial to Newton */ monomial_to_newton_basis(a, this->subproduct_tree, this->m); - + /* Newton to Evaluation */ std::vector S(this->m); /* i! * arithmetic_generator */ S[0] = FieldT::one(); @@ -82,7 +84,7 @@ template void arithmetic_sequence_domain::iFFT(std::vector &a) { if (a.size() != this->m) throw DomainSizeException("arithmetic: expected a.size() == this->m"); - + if (!this->precomputation_sentinel) do_precomputation(); /* Interpolation to Newton */ @@ -164,7 +166,7 @@ std::vector arithmetic_sequence_domain::evaluate_all_lagrange_po std::vector w(this->m); w[0] = g_vanish.inverse() * (this->arithmetic_generator^(this->m-1)); - + l[0] = l_vanish * l[0].inverse() * w[0]; for (size_t i = 1; i < this->m; i++) { diff --git a/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc b/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc index 7365ca6..19cb659 100755 --- a/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc +++ b/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc @@ -37,7 +37,7 @@ bool basic_radix2_domain::valid_for_size(const size_t m) return false; } - if( get_root_of_unity_will_throw(m) ) + if (get_root_of_unity_will_throw(m)) return false; return true; diff --git a/libfqfft/evaluation_domain/domains/extended_radix2_domain.tcc b/libfqfft/evaluation_domain/domains/extended_radix2_domain.tcc index 50dfea0..b304f2f 100755 --- a/libfqfft/evaluation_domain/domains/extended_radix2_domain.tcc +++ b/libfqfft/evaluation_domain/domains/extended_radix2_domain.tcc @@ -20,21 +20,23 @@ namespace libfqfft { template bool extended_radix2_domain::valid_for_size(const size_t m) { - if ( m <= 1 ) + if (m <= 1) { return false; + } // Will `get_root_of_unity` throw? if (!std::is_same::value) { const size_t logm = libff::log2(m); - if (logm != (FieldT::s + 1)) + if (logm != (FieldT::s + 1)) { return false; + } } size_t small_m = m / 2; - if( get_root_of_unity_will_throw(small_m) ) + if (get_root_of_unity_will_throw(small_m)) return false; return true; diff --git a/libfqfft/evaluation_domain/domains/geometric_sequence_domain.tcc b/libfqfft/evaluation_domain/domains/geometric_sequence_domain.tcc index fe5bdaa..5368b19 100755 --- a/libfqfft/evaluation_domain/domains/geometric_sequence_domain.tcc +++ b/libfqfft/evaluation_domain/domains/geometric_sequence_domain.tcc @@ -26,13 +26,15 @@ namespace libfqfft { template bool geometric_sequence_domain::valid_for_size(const size_t m) { - if ( m <= 1 ) - return false; + if ( m <= 1 ) { + return false; + } - if (FieldT::geometric_generator() == FieldT::zero()) - return false; + if (FieldT::geometric_generator() == FieldT::zero()) { + return false; + } - return true; + return true; } template @@ -41,13 +43,13 @@ geometric_sequence_domain::geometric_sequence_domain(const size_t m) : e if (m <= 1) throw InvalidSizeException("geometric(): expected m > 1"); if (FieldT::geometric_generator() == FieldT::zero()) throw InvalidSizeException("geometric(): expected FieldT::geometric_generator() != FieldT::zero()"); - + precomputation_sentinel = 0; } template void geometric_sequence_domain::FFT(std::vector &a) -{ +{ if (a.size() != this->m) throw DomainSizeException("geometric: expected a.size() == this->m"); if (!this->precomputation_sentinel) do_precomputation(); @@ -83,7 +85,7 @@ template void geometric_sequence_domain::iFFT(std::vector &a) { if (a.size() != this->m) throw DomainSizeException("geometric: expected a.size() == this->m"); - + if (!this->precomputation_sentinel) do_precomputation(); /* Interpolation to Newton */ diff --git a/libfqfft/evaluation_domain/domains/step_radix2_domain.tcc b/libfqfft/evaluation_domain/domains/step_radix2_domain.tcc index 733975e..28b260d 100755 --- a/libfqfft/evaluation_domain/domains/step_radix2_domain.tcc +++ b/libfqfft/evaluation_domain/domains/step_radix2_domain.tcc @@ -20,7 +20,7 @@ namespace libfqfft { template bool step_radix2_domain::valid_for_size(const size_t m) { - if ( m <= 1 ) + if (m <= 1) return false; const size_t big_m = 1ul<<(libff::log2(m)-1); @@ -30,11 +30,11 @@ bool step_radix2_domain::valid_for_size(const size_t m) return false; // omega - if( get_root_of_unity_will_throw(1ul<(1ul<(1ul<(1ul<::step_radix2_domain(const size_t m) : evaluation_doma try { omega = libff::get_root_of_unity(1ul<(small_m); } diff --git a/libfqfft/evaluation_domain/get_evaluation_domain.tcc b/libfqfft/evaluation_domain/get_evaluation_domain.tcc index 282b2f3..9ab4100 100755 --- a/libfqfft/evaluation_domain/get_evaluation_domain.tcc +++ b/libfqfft/evaluation_domain/get_evaluation_domain.tcc @@ -38,28 +38,28 @@ std::shared_ptr > get_evaluation_domain(const size_t m const size_t small = min_size - big; const size_t rounded_small = (1ul<::valid_for_size(min_size) ) { - result.reset(new basic_radix2_domain(min_size)); + if (basic_radix2_domain::valid_for_size(min_size)) { + result.reset(new basic_radix2_domain(min_size)); } - else if ( extended_radix2_domain::valid_for_size(min_size) ) { + else if (extended_radix2_domain::valid_for_size(min_size)) { result.reset(new extended_radix2_domain(min_size)); } - else if ( step_radix2_domain::valid_for_size(min_size) ) { + else if (step_radix2_domain::valid_for_size(min_size)) { result.reset(new step_radix2_domain(min_size)); } - else if ( basic_radix2_domain::valid_for_size(big + rounded_small) ) { + else if (basic_radix2_domain::valid_for_size(big + rounded_small)) { result.reset(new basic_radix2_domain(big + rounded_small)); } - else if ( extended_radix2_domain::valid_for_size(big + rounded_small) ) { - result.reset(new extended_radix2_domain(big + rounded_small)); + else if (extended_radix2_domain::valid_for_size(big + rounded_small)) { + result.reset(new extended_radix2_domain(big + rounded_small)); } - else if ( step_radix2_domain::valid_for_size(big + rounded_small) ) { + else if (step_radix2_domain::valid_for_size(big + rounded_small)) { result.reset(new step_radix2_domain(big + rounded_small)); } - else if ( geometric_sequence_domain::valid_for_size(min_size) ) { + else if (geometric_sequence_domain::valid_for_size(min_size)) { result.reset(new geometric_sequence_domain(min_size)); } - else if ( arithmetic_sequence_domain::valid_for_size(min_size) ) { + else if (arithmetic_sequence_domain::valid_for_size(min_size)) { result.reset(new arithmetic_sequence_domain(min_size)); } else {