Skip to content

Refactor includes #3

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

Merged
merged 4 commits into from
Jun 27, 2017
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.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ find_library(GMPXX_LIBRARIES NAMES gmpxx libgmpxx)

# libff
find_path(LIBFF_INCLUDE_DIR NAMES libff)
include_directories(${LIBFF_INCLUDE_DIR}/libff)
include_directories(${LIBFF_INCLUDE_DIR})
find_library(LIBFF_LIBRARIES NAMES ff libff)

# Google Test
Expand All @@ -102,5 +102,5 @@ add_custom_target(
)

include_directories(.)
add_subdirectory(src)
add_subdirectory(tutorials)
add_subdirectory(libfqfft)
add_subdirectory(tutorials)
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ ___libfqfft___ is a C++ library for __Fast Fourier Transforms (FFTs)__ in __fini

The directory structure is as follows:

* [__src__](src): C++ source code, containing the following modules:
* [__evaluation\_domain__](src/evaluation_domain): declaration of interfaces for evaluation domains
* [__kronecker\_substitution__](src/kronecker_substitution): Kronecker substitution for polynomial multiplication
* [__polynomial\_arithmetic__](src/polynomial_arithmetic): polynomial arithmetic and extended GCD
* [__profiling__](src/profiling): functionality to profile running time, space usage, and number of field operations
* [__tests__](src/tests): collection of GTests
* [__tools__](src/tools): tools for evaluation domains
* [__libfqfft__](libfqfft): C++ source code, containing the following modules:
* [__evaluation\_domain__](libfqfft/evaluation_domain): declaration of interfaces for evaluation domains
* [__kronecker\_substitution__](libfqfft/kronecker_substitution): Kronecker substitution for polynomial multiplication
* [__polynomial\_arithmetic__](libfqfft/polynomial_arithmetic): polynomial arithmetic and extended GCD
* [__profiling__](libfqfft/profiling): functionality to profile running time, space usage, and number of field operations
* [__tests__](libfqfft/tests): collection of GTests
* [__tools__](libfqfft/tools): tools for evaluation domains
* [__tutorials__](tutorials): tutorials for getting started with _libfqfft_

## Introduction
Expand Down Expand Up @@ -127,7 +127,7 @@ NUMA node0 CPU(s): 0-7

__Warning:__ Profiling of memory usage is Linux-specific as it makes use of `getrusage()` from `<sys/resource.h>`. Compatibility of the `getrusage()` BSD syscall equivalent is kernel specific, such as with the `getrusage()` call listed under Darwin/OSX [XNU-3248.20.55](http://opensource.apple.com//source/xnu/xnu-3248.20.55/) in `bsd/kern/kern_resource.c`.

The library includes functionality for profiling running time, memory usage, and number of field operations, and also for plotting the resulting data with [gnuplot](http://www.gnuplot.info/). All profiling and plotting activity is logged in the folder `src/profiling/logs`; logs are sorted into a directory hierarchy by profiling type and timestamp, respectively. The running time and memory usage profiling also supports multi-threading.
The library includes functionality for profiling running time, memory usage, and number of field operations, and also for plotting the resulting data with [gnuplot](http://www.gnuplot.info/). All profiling and plotting activity is logged in the folder `libfqfft/profiling/logs`; logs are sorted into a directory hierarchy by profiling type and timestamp, respectively. The running time and memory usage profiling also supports multi-threading.

To start the profiler, after [Compilation](#compilation), run ```./profiling_menu``` from the project root directory. Below is an explanation of profiling and plotting options.

Expand All @@ -141,7 +141,7 @@ Profiling options include:
2. __Domain type:__ All domains, radix-2 domains, or arithmetic/geometric sequence domains
3. __Domain sizes:__ Preset small, preset large, or custom size

Profiling results are saved in ```src/profiling/logs/{datetime}```.
Profiling results are saved in ```libfqfft/profiling/logs/{datetime}```.

### Plotting

Expand All @@ -164,9 +164,9 @@ To run the GTests for this library, after [Compilation](#compilation), run:
make check
```

This will compile and run the tests. Alternatively, from the `build` folder, one can also run `./src/gtests` after compiling.
This will compile and run the tests. Alternatively, from the `build` folder, one can also run `./libfqfft/gtests` after compiling.

The unit tests are divided into three GTest files located under `src/tests`:
The unit tests are divided into three GTest files located under `libfqfft/tests`:

1. __Evaluation domains__: `evaluation_domain_test.cpp`
2. __Polynomial arithmetic__: `polynomial_arithmetic_test.cpp`
Expand Down Expand Up @@ -267,7 +267,7 @@ The above will compile the executables to the `build/tutorials` folder, and then

* Run: `./polynomial_multiplication`

We construct two polynomials, _a_ and _b_, and then call the `_polynomial_multiplication()` function in `src/polynomial_arithmetic/basic_operations.hpp` to perform our operation. The result is stored into polynomial _c_, and then printed out. Note that polynomials are stored in C++ STL vectors in order from lowest to highest degree.
We construct two polynomials, _a_ and _b_, and then call the `_polynomial_multiplication()` function in `libfqfft/polynomial_arithmetic/basic_operations.hpp` to perform our operation. The result is stored into polynomial _c_, and then printed out. Note that polynomials are stored in C++ STL vectors in order from lowest to highest degree.

### Polynomial evaluation

Expand Down
16 changes: 7 additions & 9 deletions src/CMakeLists.txt → libfqfft/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
include_directories(.)

install(
DIRECTORY "" DESTINATION "include/libfqfft"
FILES_MATCHING
Expand All @@ -15,10 +13,10 @@ add_executable(
gtests
EXCLUDE_FROM_ALL

${CMAKE_HOME_DIRECTORY}/src/tests/init_test
${CMAKE_HOME_DIRECTORY}/src/tests/evaluation_domain_test
${CMAKE_HOME_DIRECTORY}/src/tests/polynomial_arithmetic_test
${CMAKE_HOME_DIRECTORY}/src/tests/kronecker_substitution_test
tests/init_test
tests/evaluation_domain_test
tests/polynomial_arithmetic_test
tests/kronecker_substitution_test
)
target_link_libraries(
gtests
Expand All @@ -34,7 +32,7 @@ target_link_libraries(
add_executable(
profiling_menu

${CMAKE_HOME_DIRECTORY}/src/profiling/profiling_menu.cpp
profiling/profiling_menu.cpp
)
set_target_properties(
profiling_menu
Expand All @@ -47,7 +45,7 @@ set_target_properties(
add_executable(
profiler

${CMAKE_HOME_DIRECTORY}/src/profiling/profile/profile.cpp
profiling/profile/profile.cpp
)
target_compile_definitions(
profiler
Expand Down Expand Up @@ -90,4 +88,4 @@ add_test(
COMMAND gtests
)

add_dependencies(check gtests)
add_dependencies(check gtests)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef ARITHMETIC_SEQUENCE_DOMAIN_HPP
#define ARITHMETIC_SEQUENCE_DOMAIN_HPP

#include "../evaluation_domain.hpp"
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>

namespace libfqfft {

Expand Down Expand Up @@ -44,6 +44,6 @@ namespace libfqfft {

} // libfqfft

#include "arithmetic_sequence_domain.tcc"
#include <libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.tcc>

#endif // ARITHMETIC_SEQUENCE_DOMAIN_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#ifndef ARITHMETIC_SEQUENCE_DOMAIN_TCC_
#define ARITHMETIC_SEQUENCE_DOMAIN_TCC_

#include "basic_radix2_domain_aux.hpp"
#include "../../polynomial_arithmetic/basis_change.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>
#include <libfqfft/polynomial_arithmetic/basis_change.hpp>

#ifdef MULTICORE
#include <omp.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef BASIC_RADIX2_DOMAIN_HPP_
#define BASIC_RADIX2_DOMAIN_HPP_

#include "../evaluation_domain.hpp"
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>

namespace libfqfft {

Expand All @@ -40,6 +40,6 @@ class basic_radix2_domain : public evaluation_domain<FieldT> {

} // libfqfft

#include "basic_radix2_domain.tcc"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain.tcc>

#endif // BASIC_RADIX2_DOMAIN_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef BASIC_RADIX2_DOMAIN_TCC_
#define BASIC_RADIX2_DOMAIN_TCC_

#include "basic_radix2_domain_aux.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ std::vector<FieldT> _basic_radix2_evaluate_all_lagrange_polynomials(const size_t

} // libfqfft

#include "basic_radix2_domain_aux.tcc"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.tcc>

#endif // BASIC_RADIX2_DOMAIN_AUX_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include <omp.h>
#endif

#include "algebra/fields/field_utils.hpp"
#include <libff/algebra/fields/field_utils.hpp>

#include "../../tools/exceptions.hpp"
#include <libfqfft/tools/exceptions.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef EXTENDED_RADIX2_DOMAIN_HPP_
#define EXTENDED_RADIX2_DOMAIN_HPP_

#include "../evaluation_domain.hpp"
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>

namespace libfqfft {

Expand Down Expand Up @@ -43,6 +43,6 @@ class extended_radix2_domain : public evaluation_domain<FieldT> {

} // libfqfft

#include "extended_radix2_domain.tcc"
#include <libfqfft/evaluation_domain/domains/extended_radix2_domain.tcc>

#endif // EXTENDED_RADIX2_DOMAIN_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#ifndef EXTENDED_RADIX2_DOMAIN_TCC_

#include "basic_radix2_domain_aux.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#ifndef GEOMETRIC_SEQUENCE_DOMAIN_HPP
#define GEOMETRIC_SEQUENCE_DOMAIN_HPP

#include "../evaluation_domain.hpp"
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>

namespace libfqfft {

Expand Down Expand Up @@ -43,6 +43,6 @@ namespace libfqfft {

} // libfqfft

#include "geometric_sequence_domain.tcc"
#include <libfqfft/evaluation_domain/domains/geometric_sequence_domain.tcc>

#endif // GEOMETRIC_SEQUENCE_DOMAIN_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#ifndef GEOMETRIC_SEQUENCE_DOMAIN_TCC_
#define GEOMETRIC_SEQUENCE_DOMAIN_TCC_

#include "basic_radix2_domain_aux.hpp"
#include "../../polynomial_arithmetic/basis_change.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>
#include <libfqfft/polynomial_arithmetic/basis_change.hpp>

#ifdef MULTICORE
#include <omp.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef STEP_RADIX2_DOMAIN_HPP_
#define STEP_RADIX2_DOMAIN_HPP_

#include "../evaluation_domain.hpp"
#include <libfqfft/evaluation_domain/evaluation_domain.hpp>

namespace libfqfft {

Expand Down Expand Up @@ -45,6 +45,6 @@ class step_radix2_domain : public evaluation_domain<FieldT> {

} // libfqfft

#include "step_radix2_domain.tcc"
#include <libfqfft/evaluation_domain/domains/step_radix2_domain.tcc>

#endif // STEP_RADIX2_DOMAIN_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#ifndef STEP_RADIX2_DOMAIN_TCC_

#include "basic_radix2_domain_aux.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ std::shared_ptr<evaluation_domain<FieldT> > get_evaluation_domain(const size_t m

} // libfqfft

#include "evaluation_domain.tcc"
#include <libfqfft/evaluation_domain/evaluation_domain.tcc>

#endif // EVALUATION_DOMAIN_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
#ifndef EVALUATION_DOMAIN_TCC_
#define EVALUATION_DOMAIN_TCC_

#include "domains/basic_radix2_domain.hpp"
#include "domains/extended_radix2_domain.hpp"
#include "domains/step_radix2_domain.hpp"
#include "domains/arithmetic_sequence_domain.hpp"
#include "domains/geometric_sequence_domain.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain.hpp>
#include <libfqfft/evaluation_domain/domains/extended_radix2_domain.hpp>
#include <libfqfft/evaluation_domain/domains/step_radix2_domain.hpp>
#include <libfqfft/evaluation_domain/domains/arithmetic_sequence_domain.hpp>
#include <libfqfft/evaluation_domain/domains/geometric_sequence_domain.hpp>

#include "../tools/exceptions.hpp"
#include <libfqfft/tools/exceptions.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void kronecker_substitution(std::vector<FieldT> &v3, const std::vector<FieldT> &

} // libfqfft

#include "kronecker_substitution.tcc"
#include <libfqfft/kronecker_substitution/kronecker_substitution.tcc>

#endif // KRONECKER_SUBSTITUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ void _polynomial_division(std::vector<FieldT> &q, std::vector<FieldT> &r, const

} // libfqfft

#include "basic_operations.tcc"
#include <libfqfft/polynomial_arithmetic/basic_operations.tcc>

#endif // BASIC_OPERATIONS_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

#include <algorithm>

#include "../evaluation_domain/domains/basic_radix2_domain_aux.hpp"
#include "../kronecker_substitution/kronecker_substitution.hpp"
#include "../tools/exceptions.hpp"
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>
#include <libfqfft/kronecker_substitution/kronecker_substitution.hpp>
#include <libfqfft/tools/exceptions.hpp>

#ifdef MULTICORE
#include <omp.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ void newton_to_monomial_basis_geometric(std::vector<FieldT> &a,

} // libfqfft

#include "basis_change.tcc"
#include <libfqfft/polynomial_arithmetic/basis_change.tcc>

#endif // BASIS_CHANGE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#define BASIS_CHANGE_TCC_

#include <algorithm>
#include "basic_operations.hpp"
#include "xgcd.hpp"
#include "../evaluation_domain/domains/basic_radix2_domain_aux.hpp"
#include <libfqfft/polynomial_arithmetic/basic_operations.hpp>
#include <libfqfft/polynomial_arithmetic/xgcd.hpp>
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>

namespace libfqfft {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ FieldT evaluate_lagrange_polynomial(const size_t &m, const std::vector<FieldT> &

} // libfqfft

#include "naive_evaluate.tcc"
#include <libfqfft/polynomial_arithmetic/naive_evaluate.tcc>

#endif // NAIVE_EVALUATE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ void _polynomial_xgcd(const std::vector<FieldT> &a, const std::vector<FieldT> &b

} // libfqfft

#include "xgcd.tcc"
#include <libfqfft/polynomial_arithmetic/xgcd.tcc>

#endif // XGCD_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#define XGCD_TCC_

#include <algorithm>
#include "basic_operations.hpp"
#include "../evaluation_domain/domains/basic_radix2_domain_aux.hpp"
#include <libfqfft/polynomial_arithmetic/basic_operations.hpp>
#include <libfqfft/evaluation_domain/domains/basic_radix2_domain_aux.hpp>

namespace libfqfft {

Expand Down
Loading