It is my basic code for solving problem on project euler.
- C++ dev environment that supports C++17 or above.
- The compiler suppports building x86_64 targets.
-
Make sure "#include <pe.hpp>" work.
- Put all the files in an installation folder (directory).
- Add the installation folder to the environment variable CPLUS_INCLUDE_PATH. Other approaches are also OK.
-
Configure this library.
- Execute gen_config.py in the installation folder to generate pe_config.
- Static configuration. The values are always 1 in the generated config file. You can edit the values after generating the config file.
- ENABLE_ASSERT whether to assert some inputs or conditions.
- TRY_TO_USE_INT128 whether to check whether the compiler support int128 and use it. If it is 0, it int128 is disabled even if the compiler supports it.
- Auto-deduced configuration for third party libraries. The script searches for the corresponding header file and set the value to 1 if found. See Build and use pe's dependent libraries for the pre-built third party binaries.
- Static configuration. The values are always 1 in the generated config file. You can edit the values after generating the config file.
- Edit the pe_config by adding more configuration items manually.
- ENABLE_OPENMP whether to use openmp. It is NOT generated by the script automatically becaused it's inferred at the compiling time. You can still define it in pe_config to prevernt the library from inferring the value from the compiling environment. If it is enabled but the environment doesn't support it, a warning message will show.
- Execute gen_config.py in the installation folder to generate pe_config.
-
[optional, recommended] Generate precompile header "pe.hpp.gch".
- Run "g++ -xc++-header pe.hpp" in the installation folder.
- Add more compiling options if necessary. Usually, they are the same as the options used to build your binary. e.g. "g++ -xc++-header pe.hpp --std=c++17 -O3 -march=native -fopenmp".
See example.c for quick start.
- pe: Including all the implementation files.
- pe.hpp: The file for generating precompile header. It only includes pe.
- pe_algo: Algorithms.
- pe_array: An array implementation with compiling time dimension length. The element count can be more than the limit of int32 and you can specify customized allocator.
- pe_base: Some pre-including headers. Some macros and typedef. Some basic inline functions.
- pe_bi32: Big integer whose base is 1 << 32.
- pe_bit: Bit operation tricks.
- pe_config: a centralized place the configure pe.
- pe_db: load and save pre-calculated result such as prime pi and prime sum.
- pe_extended_int: The extended integer.
- pe_extended_signed_int: Extended signed integer.
- pe_extended_unsigned_int: Extended unsigned integer.
- pe_fft: Fast fourier transform and polynomial multiplication.
- pe_float128: Unified float number functions of __float128.
- pe_fraction: Fraction arithmetic.
- pe_gbi: general big integer. The content corresponds to pe_nt.
- pe_geometry: Support Point2D and Point3D.
- pe_initializer: The helper class and macros used to initialize the library.
- pe_int: Basic integer utilities.
- pe_int128: Support to output int128 and the corresponding type traits.
- pe_internal: Include configurations, define necessary types/macros and include third party libraries.
- pe_io: methods and macros that simplify or fasten reading from and writing std io.
- pe_mat: Matrix operations.
- pe_memory: Memory manipulation such as allocating large memory. (windows only)
- pe_misc: misc codes.
- pe_mma: support mma: helper method or class to generate mma codes.
- pe_mod: Modular arithmetic.
- pe_nt: Basic code of number theory.
- pe_nt_base: Generate prime list, factorize integer, prime test, compute phi and mu.
- pe_parallel: A simple framework to solve problem with multi-threads. (windows only)
- pe_parallel_algo: Parallel algorithms.
- pe_persistance: KVPersistance. (it may support linux if we change the generated cmdline and check the other codes)
- pe_poly: Polynomial c++ wrapper.
- pe_poly_algo: Polynomial algorithms.
- pe_poly_base: Polynomial basic algorithms.
- pe_poly_base_flint: Flint based polynomial basic algorithms.
- pe_poly_base_libbf: Libbf based polynomial basic algorithms.
- pe_poly_base_min25: Min_25's polynomial basic algorithms. The polynomial multiplication implementation is the fastest one among mod polynomials integrated into pe.
- pe_poly_base_ntl: Ntl based polynomial basic algorithms.
- pe_rand: Random number.
- pe_range: generate an range of numbers, iterate a container with index.
- pe_sym_poly: Symbolic polynomial.
- pe_time: Support TimeDelta, TimeRecorder.
- pe_tree: Some tree based data structures.
- pe_type_traits: Type traits.