From b844c27c46db08cf3f897079d9346d5d6b719c6e Mon Sep 17 00:00:00 2001 From: Aleksejs Popovs Date: Thu, 22 Jun 2017 19:43:51 -0400 Subject: [PATCH] Add missing includes & sort all includes. I have added a couple missing includes, so that every *.cpp or *.hpp file in the repository can now be compiled individually^. I also grouped all includes (by stdlib/external libs/libfqfft) and sorted them. ^ With the exception of libfqfft/evaluation_domain/domains/*, which are to be refactored soon (because of a cyclic dependency). --- .../domains/basic_radix2_domain.hpp | 2 ++ .../domains/basic_radix2_domain.tcc | 4 +++ .../domains/basic_radix2_domain_aux.hpp | 2 ++ .../domains/basic_radix2_domain_aux.tcc | 5 ++++ .../evaluation_domain/evaluation_domain.hpp | 1 + .../evaluation_domain/evaluation_domain.tcc | 5 ++-- .../kronecker_substitution.hpp | 2 ++ .../kronecker_substitution.tcc | 15 +++++------ .../basic_operations.hpp | 4 ++- .../polynomial_arithmetic/basis_change.hpp | 4 ++- .../polynomial_arithmetic/basis_change.tcc | 3 ++- .../polynomial_arithmetic/naive_evaluate.hpp | 6 ++++- libfqfft/polynomial_arithmetic/xgcd.hpp | 4 ++- libfqfft/polynomial_arithmetic/xgcd.tcc | 3 ++- libfqfft/profiling/profile/profile.cpp | 25 +++++++++---------- libfqfft/profiling/profiling_menu.cpp | 11 ++++---- libfqfft/tests/evaluation_domain_test.cpp | 19 ++++++-------- .../tests/kronecker_substitution_test.cpp | 3 ++- libfqfft/tests/polynomial_arithmetic_test.cpp | 3 ++- 19 files changed, 73 insertions(+), 48 deletions(-) diff --git a/libfqfft/evaluation_domain/domains/basic_radix2_domain.hpp b/libfqfft/evaluation_domain/domains/basic_radix2_domain.hpp index e6d6318..7b77b29 100755 --- a/libfqfft/evaluation_domain/domains/basic_radix2_domain.hpp +++ b/libfqfft/evaluation_domain/domains/basic_radix2_domain.hpp @@ -14,6 +14,8 @@ #ifndef BASIC_RADIX2_DOMAIN_HPP_ #define BASIC_RADIX2_DOMAIN_HPP_ +#include + #include namespace libfqfft { diff --git a/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc b/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc index ad9eced..2486f7a 100755 --- a/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc +++ b/libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc @@ -14,6 +14,10 @@ #ifndef BASIC_RADIX2_DOMAIN_TCC_ #define BASIC_RADIX2_DOMAIN_TCC_ +#include +#include +#include + #include namespace libfqfft { diff --git a/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp b/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp index cb94cbe..596b322 100755 --- a/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp +++ b/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp @@ -15,6 +15,8 @@ #ifndef BASIC_RADIX2_DOMAIN_AUX_HPP_ #define BASIC_RADIX2_DOMAIN_AUX_HPP_ +#include + namespace libfqfft { /** diff --git a/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.tcc b/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.tcc index a98acd1..3c00e5a 100755 --- a/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.tcc +++ b/libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.tcc @@ -15,6 +15,7 @@ #define BASIC_RADIX2_DOMAIN_AUX_TCC_ #include +#include #ifdef MULTICORE #include @@ -24,6 +25,10 @@ #include +#ifdef DEBUG +#include +#endif + namespace libfqfft { #ifdef MULTICORE diff --git a/libfqfft/evaluation_domain/evaluation_domain.hpp b/libfqfft/evaluation_domain/evaluation_domain.hpp index 4bb9dfe..e9ad13e 100755 --- a/libfqfft/evaluation_domain/evaluation_domain.hpp +++ b/libfqfft/evaluation_domain/evaluation_domain.hpp @@ -27,6 +27,7 @@ #define EVALUATION_DOMAIN_HPP_ #include +#include namespace libfqfft { diff --git a/libfqfft/evaluation_domain/evaluation_domain.tcc b/libfqfft/evaluation_domain/evaluation_domain.tcc index 7897a81..cf6b26e 100755 --- a/libfqfft/evaluation_domain/evaluation_domain.tcc +++ b/libfqfft/evaluation_domain/evaluation_domain.tcc @@ -19,12 +19,11 @@ #ifndef EVALUATION_DOMAIN_TCC_ #define EVALUATION_DOMAIN_TCC_ +#include #include #include -#include -#include #include - +#include #include namespace libfqfft { diff --git a/libfqfft/kronecker_substitution/kronecker_substitution.hpp b/libfqfft/kronecker_substitution/kronecker_substitution.hpp index b32d668..295d0c0 100755 --- a/libfqfft/kronecker_substitution/kronecker_substitution.hpp +++ b/libfqfft/kronecker_substitution/kronecker_substitution.hpp @@ -12,6 +12,8 @@ #ifndef KRONECKER_SUBSTITUTION_HPP_ #define KRONECKER_SUBSTITUTION_HPP_ +#include + namespace libfqfft { /** diff --git a/libfqfft/kronecker_substitution/kronecker_substitution.tcc b/libfqfft/kronecker_substitution/kronecker_substitution.tcc index 63dcc41..26c583d 100755 --- a/libfqfft/kronecker_substitution/kronecker_substitution.tcc +++ b/libfqfft/kronecker_substitution/kronecker_substitution.tcc @@ -15,9 +15,10 @@ #define KRONECKER_SUBSTITUTION_TCC_ #include -#include +#include -#define GMP_LIMB_BITS 64 +#include +#include namespace libfqfft { @@ -44,7 +45,7 @@ void kronecker_substitution(std::vector &v3, const std::vector & /* Output polynomial */ v3.resize(n3, FieldT::zero()); - /* + /* * Allocate all MP_LIMB_T space once and store the reference pointer M1 * to free memory afterwards. P1, P2, and P3 will remain fixed pointers * to the start of their respective polynomials as reference. @@ -72,7 +73,7 @@ void kronecker_substitution(std::vector &v3, const std::vector & val = v1[i].as_ulong(); limb += (val << limb_b); - /* + /* * If the next iteration of LIMB_B is >= to the GMP_LIMB_BITS, then * write it out to MP_LIMB_T* and reset LIMB. If VAL has remaining * bits due to GMP_LIMB_BITS boundary, set it in LIMB and proceed. @@ -99,7 +100,7 @@ void kronecker_substitution(std::vector &v3, const std::vector & val = v2[i].as_ulong(); limb += (val << limb_b); - /* + /* * If the next iteration of LIMB_B is >= to the GMP_LIMB_BITS, then * write it out to MP_LIMB_T* and reset LIMB. If VAL has remaining * bits due to GMP_LIMB_BITS boundary, set it in LIMB and proceed. @@ -130,7 +131,7 @@ void kronecker_substitution(std::vector &v3, const std::vector & limb_b = 0; for (size_t i = 0; i < n3; i++) { - /* + /* * If the coefficient's bit length is contained in LIMB, then * write the masked value out to vector V3 and decrement LIMB * by B bits. @@ -142,7 +143,7 @@ void kronecker_substitution(std::vector &v3, const std::vector & delta = b; delta_b = limb_b - delta; } - /* + /* * If the remaining coefficient is across two LIMBs, then write * to vector V3 the current limb's value and add upper bits from * the second part. Lastly, decrement LIMB by the coefficient's diff --git a/libfqfft/polynomial_arithmetic/basic_operations.hpp b/libfqfft/polynomial_arithmetic/basic_operations.hpp index cff4e2f..60086cd 100755 --- a/libfqfft/polynomial_arithmetic/basic_operations.hpp +++ b/libfqfft/polynomial_arithmetic/basic_operations.hpp @@ -3,7 +3,7 @@ ***************************************************************************** Declaration of interfaces for basic polynomial operation routines. - + ***************************************************************************** * @author This file is part of libfqfft, developed by SCIPR Lab * and contributors (see AUTHORS). @@ -13,6 +13,8 @@ #ifndef BASIC_OPERATIONS_HPP_ #define BASIC_OPERATIONS_HPP_ +#include + namespace libfqfft { /** diff --git a/libfqfft/polynomial_arithmetic/basis_change.hpp b/libfqfft/polynomial_arithmetic/basis_change.hpp index 72aeda1..fc4395c 100755 --- a/libfqfft/polynomial_arithmetic/basis_change.hpp +++ b/libfqfft/polynomial_arithmetic/basis_change.hpp @@ -2,7 +2,7 @@ ***************************************************************************** Declaration of interfaces for basis change routines. - + ***************************************************************************** * @author This file is part of libfqfft, developed by SCIPR Lab * and contributors (see AUTHORS). @@ -12,6 +12,8 @@ #ifndef BASIS_CHANGE_HPP_ #define BASIS_CHANGE_HPP_ +#include + namespace libfqfft { /** diff --git a/libfqfft/polynomial_arithmetic/basis_change.tcc b/libfqfft/polynomial_arithmetic/basis_change.tcc index 03d4eaa..c07f773 100755 --- a/libfqfft/polynomial_arithmetic/basis_change.tcc +++ b/libfqfft/polynomial_arithmetic/basis_change.tcc @@ -15,9 +15,10 @@ #define BASIS_CHANGE_TCC_ #include + +#include #include #include -#include namespace libfqfft { diff --git a/libfqfft/polynomial_arithmetic/naive_evaluate.hpp b/libfqfft/polynomial_arithmetic/naive_evaluate.hpp index 8eec114..5f93c85 100755 --- a/libfqfft/polynomial_arithmetic/naive_evaluate.hpp +++ b/libfqfft/polynomial_arithmetic/naive_evaluate.hpp @@ -2,7 +2,7 @@ ***************************************************************************** Declaration of interfaces for naive evaluation routines. - + ***************************************************************************** * @author This file is part of libfqfft, developed by SCIPR Lab * and contributors (see AUTHORS). @@ -12,6 +12,10 @@ #ifndef NAIVE_EVALUATE_HPP_ #define NAIVE_EVALUATE_HPP_ +#include + +#include + namespace libfqfft { /** diff --git a/libfqfft/polynomial_arithmetic/xgcd.hpp b/libfqfft/polynomial_arithmetic/xgcd.hpp index 804de1b..1e2dabb 100755 --- a/libfqfft/polynomial_arithmetic/xgcd.hpp +++ b/libfqfft/polynomial_arithmetic/xgcd.hpp @@ -2,7 +2,7 @@ ***************************************************************************** Declaration of interfaces for extended GCD routines. - + ***************************************************************************** * @author This file is part of libfqfft, developed by SCIPR Lab * and contributors (see AUTHORS). @@ -12,6 +12,8 @@ #ifndef XGCD_HPP_ #define XGCD_HPP_ +#include + namespace libfqfft { /** diff --git a/libfqfft/polynomial_arithmetic/xgcd.tcc b/libfqfft/polynomial_arithmetic/xgcd.tcc index ed1966c..f1ace4b 100755 --- a/libfqfft/polynomial_arithmetic/xgcd.tcc +++ b/libfqfft/polynomial_arithmetic/xgcd.tcc @@ -15,8 +15,9 @@ #define XGCD_TCC_ #include -#include + #include +#include namespace libfqfft { diff --git a/libfqfft/profiling/profile/profile.cpp b/libfqfft/profiling/profile/profile.cpp index 5c91b36..a61743e 100755 --- a/libfqfft/profiling/profile/profile.cpp +++ b/libfqfft/profiling/profile/profile.cpp @@ -9,28 +9,27 @@ * @copyright MIT license (see LICENSE file) *****************************************************************************/ +#ifndef PROFILE_OP_COUNTS +#error PROFILE_OP_COUNTS must be defined to build this profiler. +#endif + +#include +#include +#include +#include #include -#include #include -#include +#include #include -#include -#include -#include -#include +#include #include #include -#include #include #include +#include -#include -#include -#include -#include -#include -#include +#include // this also includes all children of evaluation_domain using namespace libfqfft; diff --git a/libfqfft/profiling/profiling_menu.cpp b/libfqfft/profiling/profiling_menu.cpp index a917229..6ed08c2 100755 --- a/libfqfft/profiling/profiling_menu.cpp +++ b/libfqfft/profiling/profiling_menu.cpp @@ -11,17 +11,18 @@ #include #include -#include -#include #include +#include #include -#include -#include +#include + +#include #include +#include #include +#include #include #include -#include /* Level 2: Profile */ void profile() diff --git a/libfqfft/tests/evaluation_domain_test.cpp b/libfqfft/tests/evaluation_domain_test.cpp index f415a2c..d410821 100755 --- a/libfqfft/tests/evaluation_domain_test.cpp +++ b/libfqfft/tests/evaluation_domain_test.cpp @@ -5,18 +5,13 @@ * @copyright MIT license (see LICENSE file) *****************************************************************************/ -#include -#include #include +#include #include +#include -#include -#include -#include -#include -#include -#include +#include // this also includes all children of evaluation_domain #include #include @@ -78,7 +73,7 @@ namespace libfqfft { } } } - + TYPED_TEST(EvaluationDomainTest, InverseFFTofFFT) { const size_t m = 4; @@ -111,7 +106,7 @@ namespace libfqfft { catch(const InvalidSizeException &e) { printf("%s - skipping\n", e.what()); - } + } } } @@ -161,7 +156,7 @@ namespace libfqfft { std::shared_ptr > domain; for (int key = 0; key < 5; key++) { - + try { if (key == 0) domain.reset(new basic_radix2_domain(m)); @@ -198,7 +193,7 @@ namespace libfqfft { } TYPED_TEST(EvaluationDomainTest, ComputeZ) { - + const size_t m = 8; TypeParam t = TypeParam(10); diff --git a/libfqfft/tests/kronecker_substitution_test.cpp b/libfqfft/tests/kronecker_substitution_test.cpp index c821e90..628a6cb 100755 --- a/libfqfft/tests/kronecker_substitution_test.cpp +++ b/libfqfft/tests/kronecker_substitution_test.cpp @@ -5,9 +5,10 @@ * @copyright MIT license (see LICENSE file) *****************************************************************************/ +#include + #include #include -#include #include diff --git a/libfqfft/tests/polynomial_arithmetic_test.cpp b/libfqfft/tests/polynomial_arithmetic_test.cpp index 01cae43..1b07551 100755 --- a/libfqfft/tests/polynomial_arithmetic_test.cpp +++ b/libfqfft/tests/polynomial_arithmetic_test.cpp @@ -5,9 +5,10 @@ * @copyright MIT license (see LICENSE file) *****************************************************************************/ +#include + #include #include -#include #include #include