├── .clang-format ├── .gitignore ├── .travis.yml ├── .vscode └── settings.json ├── CHANGELOG.rst ├── CMakeLists.txt ├── COPYING.gpl3 ├── COPYING.lgpl3 ├── README.md ├── appveyor.yml ├── benchmark_results ├── emma_gastineau2_perf_20150731004707.txt ├── emma_gastineau3_perf_20150731060142.txt ├── emma_pearce2_perf_20150730180254.txt └── emma_pearce2_unpacked_perf_20150823171832.txt ├── benchmarks ├── CMakeLists.txt ├── audi.cpp ├── data │ ├── s2l1.mpackp.bz2 │ └── sl1l3.mpackp.bz2 ├── estimation.cpp ├── evaluate.cpp ├── fateman1.cpp ├── fateman1.hpp ├── fateman1_dynamic.cpp ├── fateman1_rational.cpp ├── fateman1_unpacked.cpp ├── fateman1_unpacked_truncation.cpp ├── fateman2.cpp ├── fateman2.hpp ├── gastineau1.cpp ├── gastineau1.hpp ├── gastineau2.cpp ├── gastineau2.hpp ├── gastineau3.cpp ├── gastineau3.hpp ├── gastineau4.cpp ├── gastineau4.hpp ├── memory_perf.cpp ├── monagan.hpp ├── monagan1.cpp ├── monagan2.cpp ├── monagan3.cpp ├── monagan4.cpp ├── monagan5.cpp ├── pearce1.cpp ├── pearce1.hpp ├── pearce1_dynamic.cpp ├── pearce1_rational.cpp ├── pearce1_unpacked.cpp ├── pearce2.cpp ├── pearce2.hpp ├── pearce2_unpacked.cpp ├── perminov1.cpp ├── power_series.cpp ├── rectangular.cpp ├── s11n_perf.cpp ├── simple_timer.hpp └── symengine_expand2b.cpp ├── cmake_modules ├── FindDbgEng.cmake ├── FindMSGPACK-C.cmake ├── Findlibbacktrace.cmake ├── PiranhaFindBZip2.cmake ├── PiranhaFindBoost.cmake ├── PiranhaPlatformSettings.cmake └── yacma │ ├── LICENSE │ ├── README.md │ ├── YACMACompilerLinkerSettings.cmake │ ├── YACMAPythonSetup.cmake │ └── YACMAThreadingSetup.cmake ├── codecov.yml ├── config.hpp.in ├── doc ├── Makefile ├── concepts.rst ├── conf.py.in ├── conversions.rst ├── index.rst ├── key_interface.rst ├── key_key_degree.rst ├── key_key_is_one.rst ├── key_key_is_zero.rst ├── key_key_ldegree.rst ├── kronecker_monomial.rst ├── make.bat ├── math.rst ├── math_binomial.rst ├── math_cos.rst ├── math_degree.rst ├── math_gcd.rst ├── math_gcd3.rst ├── math_is_one.rst ├── math_is_zero.rst ├── math_ldegree.rst ├── math_pow.rst ├── math_sin.rst ├── numerical_types.rst ├── reference.rst ├── safe_cast.rst ├── safe_convert.rst └── symbol_management.rst ├── include └── piranha │ ├── array_key.hpp │ ├── base_series_multiplier.hpp │ ├── cache_aligning_allocator.hpp │ ├── convert_to.hpp │ ├── detail │ ├── atomic_flag_array.hpp │ ├── atomic_lock_guard.hpp │ ├── cf_mult_impl.hpp │ ├── config_clang.hpp │ ├── config_gcc.hpp │ ├── config_intel.hpp │ ├── debug_access.hpp │ ├── demangle.hpp │ ├── divisor_series_fwd.hpp │ ├── init.hpp │ ├── km_commons.hpp │ ├── monomial_common.hpp │ ├── parallel_vector_transform.hpp │ ├── poisson_series_fwd.hpp │ ├── polynomial_fwd.hpp │ ├── prepare_for_print.hpp │ ├── safe_integral_arith.hpp │ ├── series_fwd.hpp │ ├── series_multiplier_fwd.hpp │ ├── sfinae_types.hpp │ ├── small_vector_fwd.hpp │ ├── stacktrace.hpp │ └── vector_hasher.hpp │ ├── divisor.hpp │ ├── divisor_series.hpp │ ├── dynamic_aligning_allocator.hpp │ ├── exceptions.hpp │ ├── forwarding.hpp │ ├── hash_set.hpp │ ├── integer.hpp │ ├── invert.hpp │ ├── ipow_substitutable_series.hpp │ ├── is_cf.hpp │ ├── is_key.hpp │ ├── key │ ├── key_degree.hpp │ ├── key_is_one.hpp │ ├── key_is_zero.hpp │ └── key_ldegree.hpp │ ├── key_is_convertible.hpp │ ├── key_is_multipliable.hpp │ ├── kronecker_array.hpp │ ├── kronecker_monomial.hpp │ ├── lambdify.hpp │ ├── math.hpp │ ├── math │ ├── binomial.hpp │ ├── cos.hpp │ ├── degree.hpp │ ├── gcd.hpp │ ├── gcd3.hpp │ ├── is_one.hpp │ ├── is_zero.hpp │ ├── ldegree.hpp │ ├── pow.hpp │ └── sin.hpp │ ├── memory.hpp │ ├── monomial.hpp │ ├── piranha.hpp │ ├── poisson_series.hpp │ ├── polynomial.hpp │ ├── power_series.hpp │ ├── print_coefficient.hpp │ ├── print_tex_coefficient.hpp │ ├── rational.hpp │ ├── real.hpp │ ├── real_trigonometric_kronecker_monomial.hpp │ ├── runtime_info.hpp │ ├── s11n.hpp │ ├── safe_cast.hpp │ ├── safe_convert.hpp │ ├── series.hpp │ ├── series_multiplier.hpp │ ├── settings.hpp │ ├── small_vector.hpp │ ├── static_vector.hpp │ ├── substitutable_series.hpp │ ├── symbol_utils.hpp │ ├── t_substitutable_series.hpp │ ├── term.hpp │ ├── thread_barrier.hpp │ ├── thread_management.hpp │ ├── thread_pool.hpp │ ├── trigonometric_series.hpp │ ├── tuning.hpp │ └── type_traits.hpp ├── piranha-config.cmake.in ├── pyranha ├── CMakeLists.txt ├── __init__.py ├── _common.py ├── _version.py.in ├── celmec.py ├── core.cpp ├── divisor_series_descriptor.hpp ├── exceptions.hpp ├── expose_divisor_series.hpp ├── expose_divisor_series_0.cpp ├── expose_divisor_series_1.cpp ├── expose_divisor_series_2.cpp ├── expose_divisor_series_3.cpp ├── expose_divisor_series_4.cpp ├── expose_divisor_series_5.cpp ├── expose_poisson_series.hpp ├── expose_poisson_series_0.cpp ├── expose_poisson_series_1.cpp ├── expose_poisson_series_10.cpp ├── expose_poisson_series_11.cpp ├── expose_poisson_series_2.cpp ├── expose_poisson_series_3.cpp ├── expose_poisson_series_4.cpp ├── expose_poisson_series_5.cpp ├── expose_poisson_series_6.cpp ├── expose_poisson_series_7.cpp ├── expose_poisson_series_8.cpp ├── expose_poisson_series_9.cpp ├── expose_polynomials.hpp ├── expose_polynomials_0.cpp ├── expose_polynomials_1.cpp ├── expose_polynomials_10.cpp ├── expose_polynomials_2.cpp ├── expose_polynomials_3.cpp ├── expose_polynomials_4.cpp ├── expose_polynomials_5.cpp ├── expose_polynomials_6.cpp ├── expose_polynomials_7.cpp ├── expose_polynomials_8.cpp ├── expose_polynomials_9.cpp ├── expose_utils.cpp ├── expose_utils.hpp ├── math.py ├── poisson_series_descriptor.hpp ├── polynomial_descriptor.hpp ├── python_converters.hpp ├── python_includes.hpp ├── test.py ├── type_system.cpp ├── type_system.hpp ├── types.py └── utils.hpp ├── tests ├── CMakeLists.txt ├── array_key.cpp ├── atomic_utils.cpp ├── base_series_multiplier.cpp ├── binomial.cpp ├── cache_aligning_allocator.cpp ├── convert_to.cpp ├── degree.cpp ├── demangle.cpp ├── divisor_01.cpp ├── divisor_02.cpp ├── divisor_series_01.cpp ├── divisor_series_02.cpp ├── dynamic_aligning_allocator.cpp ├── exceptions.cpp ├── gcd.cpp ├── hash_set_01.cpp ├── hash_set_02.cpp ├── integer_01.cpp ├── integer_02.cpp ├── invert.cpp ├── ipow_substitutable_series.cpp ├── is_cf.cpp ├── is_key.cpp ├── is_one.cpp ├── is_zero.cpp ├── key_degree.cpp ├── key_is_convertible.cpp ├── key_is_multipliable.cpp ├── key_is_one.cpp ├── key_is_zero.cpp ├── key_ldegree.cpp ├── kronecker_array.cpp ├── kronecker_monomial_01.cpp ├── kronecker_monomial_02.cpp ├── lambdify.cpp ├── ldegree.cpp ├── math.cpp ├── memory.cpp ├── monomial_01.cpp ├── monomial_02.cpp ├── parallel_vector_transform.cpp ├── poisson_series_01.cpp ├── poisson_series_02.cpp ├── poisson_series_03.cpp ├── poisson_series_04.cpp ├── polynomial_01.cpp ├── polynomial_02.cpp ├── polynomial_03.cpp ├── polynomial_04.cpp ├── polynomial_multiplier_01.cpp ├── polynomial_multiplier_02.cpp ├── polynomial_multiplier_03.cpp ├── polynomial_truncation.cpp ├── pow.cpp ├── power_series_01.cpp ├── power_series_02.cpp ├── print_coefficient.cpp ├── print_tex_coefficient.cpp ├── rational_01.cpp ├── rational_02.cpp ├── real_01.cpp ├── real_02.cpp ├── real_trigonometric_kronecker_monomial_01.cpp ├── real_trigonometric_kronecker_monomial_02.cpp ├── runtime_info.cpp ├── s11n.cpp ├── safe_cast.cpp ├── safe_convert.cpp ├── safe_integral_arith.cpp ├── series_01.cpp ├── series_02.cpp ├── series_03.cpp ├── series_04.cpp ├── series_05.cpp ├── series_06.cpp ├── series_07.cpp ├── series_08.cpp ├── settings.cpp ├── sincos.cpp ├── small_vector_01.cpp ├── small_vector_02.cpp ├── static_vector_01.cpp ├── static_vector_02.cpp ├── substitutable_series.cpp ├── symbol_utils.cpp ├── t_substitutable_series.cpp ├── term.cpp ├── thread_barrier.cpp ├── thread_management.cpp ├── thread_pool.cpp ├── trigonometric_series.cpp ├── tuning.cpp └── type_traits.cpp └── tools ├── benchmark.py ├── install_deps.sh ├── install_travis.sh └── sample_project ├── CMakeLists.txt └── main.cpp /.clang-format: -------------------------------------------------------------------------------- 1 | Language: Cpp 2 | AccessModifierOffset: -4 3 | AlignAfterOpenBracket: true 4 | AlignConsecutiveAssignments: false 5 | AlignEscapedNewlinesLeft: false 6 | AlignOperands: true 7 | AlignTrailingComments: true 8 | AllowAllParametersOfDeclarationOnNextLine: true 9 | AllowShortBlocksOnASingleLine: false 10 | AllowShortCaseLabelsOnASingleLine: false 11 | AllowShortFunctionsOnASingleLine: Empty 12 | AllowShortIfStatementsOnASingleLine: false 13 | AllowShortLoopsOnASingleLine: false 14 | AlwaysBreakAfterDefinitionReturnType: None 15 | AlwaysBreakBeforeMultilineStrings: false 16 | AlwaysBreakTemplateDeclarations: true 17 | BinPackArguments: true 18 | BinPackParameters: true 19 | BreakBeforeBinaryOperators: All 20 | BreakBeforeBraces: Linux 21 | BreakBeforeTernaryOperators: true 22 | BreakConstructorInitializersBeforeComma: false 23 | ColumnLimit: 120 24 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 25 | ConstructorInitializerIndentWidth: 4 26 | ContinuationIndentWidth: 4 27 | Cpp11BracedListStyle: true 28 | DerivePointerAlignment: false 29 | DisableFormat: false 30 | ExperimentalAutoDetectBinPacking: false 31 | IndentCaseLabels: true 32 | IndentWidth: 4 33 | IndentWrappedFunctionNames: false 34 | KeepEmptyLinesAtTheStartOfBlocks: true 35 | MacroBlockBegin: '' 36 | MacroBlockEnd: '' 37 | MaxEmptyLinesToKeep: 1 38 | NamespaceIndentation: None 39 | ObjCBlockIndentWidth: 2 40 | ObjCSpaceAfterProperty: false 41 | ObjCSpaceBeforeProtocolList: true 42 | PenaltyBreakBeforeFirstCallParameter: 19 43 | PenaltyBreakComment: 22312 44 | PenaltyBreakFirstLessLess: 120 45 | PenaltyBreakString: 2123 46 | PenaltyExcessCharacter: 1000000 47 | PenaltyReturnTypeOnItsOwnLine: 60 48 | PointerAlignment: Right 49 | SpaceAfterCStyleCast: false 50 | SpaceBeforeAssignmentOperators: true 51 | SpaceBeforeParens: ControlStatements 52 | SpaceInEmptyParentheses: false 53 | SpacesBeforeTrailingComments: 1 54 | SpacesInAngles: false 55 | SpacesInContainerLiterals: false 56 | SpacesInCStyleCastParentheses: false 57 | SpacesInParentheses: false 58 | SpacesInSquareBrackets: false 59 | Standard: Cpp11 60 | TabWidth: 4 61 | UseTab: Never 62 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build dirs. 2 | build* 3 | 4 | # Documentation. 5 | doc/_build 6 | doc/conf.py 7 | 8 | # Temp files. 9 | *~ 10 | *.bak 11 | 12 | # .orig files from patch. 13 | *.orig 14 | 15 | # Python bits. 16 | *.pyc 17 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": true, 4 | "build*": true, 5 | "doc/_build/": true 6 | } 7 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Piranha 2 | [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/bluescarni/piranha) 3 | [![Build Status](https://travis-ci.org/bluescarni/piranha.svg?branch=master)](https://travis-ci.org/bluescarni/piranha) 4 | [![Build status](https://ci.appveyor.com/api/projects/status/27ssomrhwjsy2hda/branch/master?svg=true)](https://ci.appveyor.com/project/bluescarni/piranha/branch/master) 5 | [![PyPI](https://img.shields.io/pypi/v/pyranha.svg)](https://pypi.python.org/pypi/pyranha) 6 | [![Docs](https://media.readthedocs.org/static/projects/badges/passing.svg)](http://bluescarni.github.io/piranha/sphinx/) 7 | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.246239.svg)](https://doi.org/10.5281/zenodo.246239) 8 | [![codecov.io](https://codecov.io/github/bluescarni/piranha/coverage.svg?branch=master)](https://codecov.io/github/bluescarni/piranha?branch=master) 9 | 10 | **WARNING** 11 | 12 | *Piranha is currently undergoing an extensive internal rework: features may (temporarily) disappear 13 | and the API will be subject to various breaking changes. Please keep on using the latest released version (0.10) 14 | until further notice.* 15 | 16 | Piranha is a C++11-based computer algebra library for the manipulation of 17 | algebraic objects, such as polynomials and Poisson series, commonly encountered 18 | in celestial mechanics. 19 | 20 | Piranha is free software and may be freely copied on the terms contained in the 21 | files COPYING*. 22 | 23 | If you are using piranha as part of your research, teaching, or other activities, we would be grateful if you could star 24 | the repository and/or cite our work. The DOI of the latest version and other citation resources are available 25 | at [this link](https://doi.org/10.5281/zenodo.594860). 26 | 27 | The (work-in-progress) documentation is available [here](http://bluescarni.github.io/piranha/sphinx/). 28 | -------------------------------------------------------------------------------- /benchmark_results/emma_gastineau2_perf_20150731004707.txt: -------------------------------------------------------------------------------- 1 | 8.696753457999999455e+02 4.324762596000000485e+02 3.183652260000000069e+02 2.466621547999999962e+02 2.097140410000000088e+02 1.784347122000000070e+02 1.580158808000000192e+02 1.384473850000000255e+02 1.249136238000000105e+02 1.128202925999999877e+02 1.040895155999999986e+02 9.500244580000000383e+01 8.881389319999999543e+01 8.258479820000000871e+01 7.772188600000001202e+01 7.250643560000000321e+01 6.879105859999999950e+01 6.511559499999999900e+01 6.195028960000000495e+01 5.906593199999999655e+01 2 | 5.162286063969863115e+00 3.917400119065671538e-01 1.142530931486190893e+00 5.291092036524586151e-01 4.194574834868257662e-01 3.053561173645280014e-01 1.576868725298344598e-01 1.552490286546074350e-01 3.692705640374548404e-01 2.399246394255071801e-01 2.629941980378264210e-01 1.769742509480966286e-01 1.660271555024653289e-01 1.584753447777920987e-01 1.465554809739298414e-01 1.120167917040123667e-01 1.163804500986325291e-01 6.692810316077806021e-02 4.041858056463631249e-02 1.786953698434856908e-01 3 | -------------------------------------------------------------------------------- /benchmark_results/emma_gastineau3_perf_20150731060142.txt: -------------------------------------------------------------------------------- 1 | 8.472947523999998793e+02 3.921515763999999535e+02 2.690991373999999610e+02 2.056078521999999680e+02 1.764181513999999993e+02 1.485810046000000000e+02 1.327103017999999963e+02 1.163553822000000082e+02 1.065259702000000033e+02 9.615783340000000123e+01 9.046769199999998534e+01 8.266778560000000198e+01 7.765521979999999758e+01 7.323914740000000734e+01 6.834141780000000210e+01 6.552965720000000260e+01 6.305429600000000079e+01 5.920564779999999416e+01 5.692918959999999373e+01 5.559462539999999819e+01 2 | 1.984522477948279517e+00 3.322818536782638499e-01 7.913438006555538473e-02 1.584400306151823590e-01 1.675202039992786940e-01 1.078308771074390771e-01 1.642910792147301846e-01 3.269489110610401816e-02 3.103848839965291928e-01 6.521569678888805566e-02 7.011214839004004107e-01 1.716462836738980591e-01 8.326973477464696960e-02 2.521378436559238989e-01 1.253288872672220777e-01 8.495669058961767550e-02 3.581112911776171415e-01 1.290820095595818506e-01 1.608268692664883148e-01 1.192221827612635621e-01 3 | -------------------------------------------------------------------------------- /benchmark_results/emma_pearce2_perf_20150730180254.txt: -------------------------------------------------------------------------------- 1 | 8.161534599999999529e+00 4.255512200000000078e+00 3.127638999999999836e+00 2.338616199999999701e+00 2.012964999999999893e+00 1.702573200000000231e+00 1.478299199999999924e+00 1.297977799999999959e+00 1.249887999999999888e+00 1.107745400000000213e+00 1.030882599999999982e+00 9.930694000000001020e-01 9.360665999999999709e-01 8.657090000000000618e-01 8.546671999999999603e-01 7.999454000000000287e-01 7.585792000000000090e-01 7.381942000000000226e-01 7.223233999999999488e-01 7.064212000000000824e-01 2 | 9.712309032748060733e-02 1.974611091177201280e-02 1.499645220710549114e-02 1.978083191728801857e-02 1.818517735409801508e-02 2.295874805471763078e-02 1.700962178709451711e-02 8.885666848357535660e-03 2.119680579945950813e-02 1.709552974493625324e-02 1.450254955033769728e-02 1.800451269154485293e-02 2.076464541377964421e-02 1.588224923932376326e-02 2.842107508768800320e-02 1.289222074198235514e-02 4.698671380294653158e-03 1.507547792409912220e-02 1.011116862484253212e-02 7.582504331683571561e-03 3 | -------------------------------------------------------------------------------- /benchmark_results/emma_pearce2_unpacked_perf_20150823171832.txt: -------------------------------------------------------------------------------- 1 | 3.370735750000000053e+01 2.124843849999999890e+01 1.474280749999999962e+01 1.101074949999999930e+01 9.446082000000000534e+00 7.723708499999999866e+00 6.652107499999999618e+00 5.805536999999999281e+00 5.361823499999999854e+00 4.819794500000000426e+00 4.563839500000000271e+00 4.211005000000000109e+00 3.846269500000000008e+00 3.712442000000000242e+00 3.565160500000000177e+00 3.362391500000000200e+00 3.197455999999999854e+00 3.060327499999999645e+00 2.973186499999999732e+00 2.821048000000000222e+00 2 | 1.986385000000012446e-01 1.018250000000087141e-02 8.877449999999953434e-02 2.742449999999951524e-02 4.188669999999996008e-01 3.880850000000002353e-02 2.808050000000017130e-02 6.591999999999930381e-03 1.472449999999980719e-02 3.044500000000116557e-03 1.065350000000009345e-02 2.315999999999984738e-02 8.374250000000003913e-02 1.321199999999999979e-02 1.663450000000010406e-02 9.881499999999874759e-03 1.646799999999992367e-02 3.122950000000001766e-02 4.105549999999990457e-02 1.034199999999985131e-02 3 | -------------------------------------------------------------------------------- /benchmarks/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Setup for the split compilation of benchmarks. 2 | 3 | # NOTE: this needs to be a macro since it is modifying the external variable _PIRANHA_TEST_NUM. 4 | macro(ADD_PIRANHA_BENCHMARK arg1) 5 | if(PIRANHA_TEST_NSPLIT) 6 | math(EXPR _PIRANHA_TEST_NUM "(${_PIRANHA_TEST_NUM} + 1) % ${PIRANHA_TEST_NSPLIT}") 7 | endif() 8 | if(NOT PIRANHA_TEST_NSPLIT OR "${PIRANHA_TEST_SPLIT_NUM}" STREQUAL "${_PIRANHA_TEST_NUM}") 9 | add_executable("${arg1}" "${arg1}.cpp") 10 | target_compile_options(${arg1} PRIVATE "$<$:${PIRANHA_CXX_FLAGS_DEBUG}>" "$<$:${PIRANHA_CXX_FLAGS_RELEASE}>") 11 | # Pass the current source dir as a definition, so we can load data for tests from the source dir. 12 | target_compile_definitions(${arg1} PRIVATE PIRANHA_TESTS_DIRECTORY="${CMAKE_CURRENT_SOURCE_DIR}") 13 | target_link_libraries(${arg1} piranha Boost::system Boost::filesystem) 14 | set_property(TARGET ${arg1} PROPERTY CXX_STANDARD 11) 15 | set_property(TARGET ${arg1} PROPERTY CXX_STANDARD_REQUIRED YES) 16 | set_property(TARGET ${arg1} PROPERTY CXX_EXTENSIONS NO) 17 | endif() 18 | endmacro() 19 | 20 | ADD_PIRANHA_BENCHMARK(audi) 21 | ADD_PIRANHA_BENCHMARK(estimation) 22 | ADD_PIRANHA_BENCHMARK(evaluate) 23 | ADD_PIRANHA_BENCHMARK(fateman1) 24 | ADD_PIRANHA_BENCHMARK(fateman1_dynamic) 25 | ADD_PIRANHA_BENCHMARK(fateman1_rational) 26 | ADD_PIRANHA_BENCHMARK(fateman1_unpacked) 27 | ADD_PIRANHA_BENCHMARK(fateman1_unpacked_truncation) 28 | ADD_PIRANHA_BENCHMARK(fateman2) 29 | ADD_PIRANHA_BENCHMARK(gastineau1) 30 | ADD_PIRANHA_BENCHMARK(gastineau2) 31 | ADD_PIRANHA_BENCHMARK(gastineau3) 32 | ADD_PIRANHA_BENCHMARK(gastineau4) 33 | ADD_PIRANHA_BENCHMARK(memory_perf) 34 | ADD_PIRANHA_BENCHMARK(monagan1) 35 | ADD_PIRANHA_BENCHMARK(monagan2) 36 | ADD_PIRANHA_BENCHMARK(monagan3) 37 | ADD_PIRANHA_BENCHMARK(monagan4) 38 | ADD_PIRANHA_BENCHMARK(monagan5) 39 | ADD_PIRANHA_BENCHMARK(power_series) 40 | ADD_PIRANHA_BENCHMARK(pearce1) 41 | ADD_PIRANHA_BENCHMARK(pearce1_dynamic) 42 | ADD_PIRANHA_BENCHMARK(pearce1_rational) 43 | ADD_PIRANHA_BENCHMARK(pearce1_unpacked) 44 | ADD_PIRANHA_BENCHMARK(pearce2) 45 | ADD_PIRANHA_BENCHMARK(pearce2_unpacked) 46 | if(PIRANHA_WITH_MSGPACK AND PIRANHA_WITH_BZIP2) 47 | ADD_PIRANHA_BENCHMARK(perminov1) 48 | endif() 49 | ADD_PIRANHA_BENCHMARK(rectangular) 50 | ADD_PIRANHA_BENCHMARK(s11n_perf) 51 | ADD_PIRANHA_BENCHMARK(symengine_expand2b) 52 | -------------------------------------------------------------------------------- /benchmarks/audi.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE audi_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include "simple_timer.hpp" 40 | 41 | using namespace piranha; 42 | 43 | // A performance test for truncated polynomial multiplication, in the spirit of automatic differentiation. 44 | // Compute: 45 | // (1+x1+x2+x3+x4+x5+x6+x7+x8+x9+x10)**10 * (1-x1-x2-x3-x4-x5-x6-x7-x8-x9-x10)**10 46 | // truncated to the total degree of 10. 47 | 48 | BOOST_AUTO_TEST_CASE(audi_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | using p_type = polynomial; 56 | p_type::set_auto_truncate_degree(10); 57 | p_type x1{"x1"}, x2{"x2"}, x3{"x3"}, x4{"x4"}, x5{"x5"}, x6{"x6"}, x7{"x7"}, x8{"x8"}, x9{"x9"}, x10{"x10"}; 58 | auto f = math::pow(1 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10, 10); 59 | auto g = math::pow(1 - x1 - x2 - x3 - x4 - x5 - x6 - x7 - x8 - x9 - x10, 10); 60 | p_type h; 61 | { 62 | simple_timer t; 63 | h = f * g; 64 | } 65 | BOOST_CHECK_EQUAL(h.size(), 122464u); 66 | } 67 | -------------------------------------------------------------------------------- /benchmarks/data/s2l1.mpackp.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluescarni/piranha/d6da0a0157cf04c06a7102f852cd383fec1cffa6/benchmarks/data/s2l1.mpackp.bz2 -------------------------------------------------------------------------------- /benchmarks/data/sl1l3.mpackp.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bluescarni/piranha/d6da0a0157cf04c06a7102f852cd383fec1cffa6/benchmarks/data/sl1l3.mpackp.bz2 -------------------------------------------------------------------------------- /benchmarks/fateman1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman1.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Fateman's polynomial multiplication test number 1. Calculate: 45 | // f * (f+1) 46 | // where f = (1+x+y+z+t)**20 47 | 48 | BOOST_AUTO_TEST_CASE(fateman1_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((fateman1, kronecker_monomial<>>().size()), 135751u); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/fateman1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_FATEMAN1_HPP 30 | #define PIRANHA_FATEMAN1_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial fateman1(unsigned long long factor = 1u) 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"); 44 | auto f = x + y + z + t + 1; 45 | auto tmp(f); 46 | for (auto i = 1; i < 20; ++i) { 47 | f *= tmp; 48 | } 49 | if (factor > 1u) { 50 | f *= factor; 51 | } 52 | { 53 | simple_timer t; 54 | return f * (f + 1); 55 | } 56 | } 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /benchmarks/fateman1_dynamic.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman1.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | #include 42 | #include 43 | #include 44 | 45 | using namespace piranha; 46 | 47 | // Fateman's polynomial multiplication test number 1. Calculate: 48 | // f * (f+1) 49 | // where f = (1+x+y+z+t)**20 50 | 51 | BOOST_AUTO_TEST_CASE(fateman1_test) 52 | { 53 | settings::set_thread_binding(true); 54 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 55 | settings::set_n_threads( 56 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 57 | } 58 | BOOST_CHECK_EQUAL((fateman1, kronecker_monomial<>>( 59 | static_cast(std::numeric_limits<::mp_limb_t>::max())) 60 | .size()), 61 | 135751u); 62 | } 63 | -------------------------------------------------------------------------------- /benchmarks/fateman1_rational.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman1.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Fateman's polynomial multiplication test number 1. Calculate: 45 | // f * (f+1) 46 | // where f = (1+x+y+z+t)**20 47 | 48 | BOOST_AUTO_TEST_CASE(fateman1_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((fateman1, kronecker_monomial<>>().size()), 135751u); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/fateman1_unpacked.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman1.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman1_unpacked_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Fateman's polynomial multiplication test number 1. Calculate: 45 | // f * (f+1) 46 | // where f = (1+x+y+z+t)**20, using unpacked monomials. 47 | 48 | BOOST_AUTO_TEST_CASE(fateman1_unpacked_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((fateman1, monomial>().size()), 135751u); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/fateman1_unpacked_truncation.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman1.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman1_unpacked_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | using namespace piranha; 44 | 45 | // Fateman's polynomial multiplication test number 1. Calculate: 46 | // f * (f+1) 47 | // where f = (1+x+y+z+t)**20, using unpacked monomials. Truncate the result to degree 20 and 30. 48 | 49 | BOOST_AUTO_TEST_CASE(fateman1_unpacked_test) 50 | { 51 | settings::set_thread_binding(true); 52 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 53 | settings::set_n_threads( 54 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 55 | } 56 | polynomial, monomial>::set_auto_truncate_degree(20); 57 | BOOST_CHECK_EQUAL((fateman1, monomial>().size()), 10626u); 58 | polynomial, monomial>::set_auto_truncate_degree(30); 59 | BOOST_CHECK_EQUAL((fateman1, monomial>().size()), 46376u); 60 | } 61 | -------------------------------------------------------------------------------- /benchmarks/fateman2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "fateman2.hpp" 30 | 31 | #define BOOST_TEST_MODULE fateman2_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Fateman's polynomial multiplication test number 2. Calculate: 45 | // f * (f+1) 46 | // where f = (1+x+y+z+t)**30 47 | 48 | BOOST_AUTO_TEST_CASE(fateman2_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((fateman2, kronecker_monomial<>>().size()), 635376u); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/fateman2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_FATEMAN2_HPP 30 | #define PIRANHA_FATEMAN2_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial fateman2() 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"); 44 | auto f = x + y + z + t + 1; 45 | auto tmp(f); 46 | for (auto i = 1; i < 30; ++i) { 47 | f *= tmp; 48 | } 49 | { 50 | simple_timer t; 51 | return f * (f + 1); 52 | } 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /benchmarks/gastineau1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "gastineau1.hpp" 30 | 31 | #define BOOST_TEST_MODULE gastineau1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | using namespace piranha; 41 | 42 | // Gastineau's polynomial multiplication test number 1. Calculate: 43 | // f * (f+1) 44 | // where f = (1+x+y+z+t)**40. 45 | // http://arxiv.org/abs/1303.7425 46 | 47 | BOOST_AUTO_TEST_CASE(gastineau1_test) 48 | { 49 | settings::set_thread_binding(true); 50 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 51 | settings::set_n_threads( 52 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 53 | } 54 | BOOST_CHECK_EQUAL((gastineau1>().size()), 1929501u); 55 | } 56 | -------------------------------------------------------------------------------- /benchmarks/gastineau1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_GASTINEAU1_HPP 30 | #define PIRANHA_GASTINEAU1_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial gastineau1() 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"); 44 | auto f = x + y + z + t + 1; 45 | auto tmp(f); 46 | for (auto i = 1; i < 40; ++i) { 47 | f *= tmp; 48 | } 49 | { 50 | simple_timer t; 51 | return f * (f + 1); 52 | } 53 | } 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /benchmarks/gastineau2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "gastineau2.hpp" 30 | 31 | #define BOOST_TEST_MODULE gastineau2_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | using namespace piranha; 41 | 42 | // Gastineau's polynomial multiplication test number 2. Calculate: 43 | // f * g 44 | // where 45 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**25 46 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**25 47 | 48 | BOOST_AUTO_TEST_CASE(gastineau2_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((gastineau2>().size()), 312855140ull); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/gastineau2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_GASTINEAU2_HPP 30 | #define PIRANHA_GASTINEAU2_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial gastineau2() 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"), u("u"); 44 | 45 | auto f = (x + y + z * z * 2 + t * t * t * 3 + u * u * u * u * u * 5 + 1); 46 | auto tmp_f(f); 47 | auto g = (u + t + z * z * 2 + y * y * y * 3 + x * x * x * x * x * 5 + 1); 48 | auto tmp_g(g); 49 | for (int i = 1; i < 25; ++i) { 50 | f *= tmp_f; 51 | g *= tmp_g; 52 | } 53 | { 54 | simple_timer t; 55 | return f * g; 56 | } 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /benchmarks/gastineau3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "gastineau3.hpp" 30 | 31 | #define BOOST_TEST_MODULE gastineau3_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Gastineau's polynomial multiplication test number 2. Calculate: 45 | // f * g 46 | // where 47 | // f = (1 + u**2 + v + w**2 + x - y**2)**28 48 | // g = (1 + u + v**2 + w + x**2 + y**3)**28 + 1 49 | 50 | BOOST_AUTO_TEST_CASE(gastineau3_test) 51 | { 52 | settings::set_thread_binding(true); 53 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 54 | settings::set_n_threads( 55 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 56 | } 57 | BOOST_CHECK_EQUAL((gastineau3, kronecker_monomial<>>().size()), 144049555ull); 58 | } 59 | -------------------------------------------------------------------------------- /benchmarks/gastineau3.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_GASTINEAU3_HPP 30 | #define PIRANHA_GASTINEAU3_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial gastineau3() 41 | { 42 | typedef polynomial p_type; 43 | p_type u("u"), v("v"), w("w"), x("x"), y("y"); 44 | 45 | auto f = (1 + u * u + v + w * w + x - y * y); 46 | auto g = (1 + u + v * v + w + x * x + y * y * y); 47 | auto tmp_f(f), tmp_g(g); 48 | for (int i = 1; i < 28; ++i) { 49 | f *= tmp_f; 50 | g *= tmp_g; 51 | } 52 | g += 1; 53 | { 54 | simple_timer t; 55 | return f * g; 56 | } 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /benchmarks/gastineau4.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "gastineau4.hpp" 30 | 31 | #define BOOST_TEST_MODULE gastineau3_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | using namespace piranha; 41 | 42 | // Gastineau's polynomial multiplication test number 4. Calculate: 43 | // f * g 44 | // where 45 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**20 46 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**20 47 | 48 | BOOST_AUTO_TEST_CASE(gastineau4_test) 49 | { 50 | settings::set_thread_binding(true); 51 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 52 | settings::set_n_threads( 53 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 54 | } 55 | BOOST_CHECK_EQUAL((gastineau4>().size()), 95033335ull); 56 | } 57 | -------------------------------------------------------------------------------- /benchmarks/gastineau4.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_GASTINEAU4_HPP 30 | #define PIRANHA_GASTINEAU4_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial gastineau4() 41 | { 42 | typedef polynomial p_type; 43 | p_type z("z"), t("t"), u("u"), x("x"), y("y"); 44 | 45 | auto f = (1 + x + y + 2 * z * z + 3 * t * t * t + 5 * u * u * u * u * u); 46 | auto g = (1 + u + t + 2 * z * z + 3 * y * y * y + 5 * x * x * x * x * x); 47 | auto tmp_f(f), tmp_g(g); 48 | for (int i = 1; i < 20; ++i) { 49 | f *= tmp_f; 50 | g *= tmp_g; 51 | } 52 | { 53 | simple_timer t; 54 | return f * g; 55 | } 56 | } 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /benchmarks/monagan1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE monagan1_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "monagan.hpp" 41 | 42 | using namespace piranha; 43 | 44 | BOOST_AUTO_TEST_CASE(monagan1_test) 45 | { 46 | settings::set_thread_binding(true); 47 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 48 | settings::set_n_threads( 49 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 50 | } 51 | BOOST_CHECK_EQUAL((monagan1, kronecker_monomial<>>().size()), 12341u); 52 | } 53 | -------------------------------------------------------------------------------- /benchmarks/monagan2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE monagan2_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "monagan.hpp" 41 | 42 | using namespace piranha; 43 | 44 | BOOST_AUTO_TEST_CASE(monagan2_test) 45 | { 46 | settings::set_thread_binding(true); 47 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 48 | settings::set_n_threads( 49 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 50 | } 51 | BOOST_CHECK_EQUAL((monagan2, kronecker_monomial<>>().size()), 12341u); 52 | } 53 | -------------------------------------------------------------------------------- /benchmarks/monagan3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE monagan3_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "monagan.hpp" 41 | 42 | using namespace piranha; 43 | 44 | BOOST_AUTO_TEST_CASE(monagan3_test) 45 | { 46 | settings::set_thread_binding(true); 47 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 48 | settings::set_n_threads( 49 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 50 | } 51 | BOOST_CHECK_EQUAL((monagan3, kronecker_monomial<>>().size()), 39711u); 52 | } 53 | -------------------------------------------------------------------------------- /benchmarks/monagan4.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE monagan4_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | #include "monagan.hpp" 41 | 42 | using namespace piranha; 43 | 44 | BOOST_AUTO_TEST_CASE(monagan4_test) 45 | { 46 | settings::set_thread_binding(true); 47 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 48 | settings::set_n_threads( 49 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 50 | } 51 | BOOST_CHECK_EQUAL((monagan4, kronecker_monomial<>>().size()), 135751u); 52 | } 53 | -------------------------------------------------------------------------------- /benchmarks/monagan5.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE monagan5_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | #include "monagan.hpp" 39 | 40 | using namespace piranha; 41 | 42 | BOOST_AUTO_TEST_CASE(monagan5_test) 43 | { 44 | settings::set_thread_binding(true); 45 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 46 | settings::set_n_threads( 47 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 48 | } 49 | BOOST_CHECK_EQUAL((monagan5>().size()), 417311u); 50 | } 51 | -------------------------------------------------------------------------------- /benchmarks/pearce1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | #include "pearce1.hpp" 29 | 30 | #define BOOST_TEST_MODULE pearce1_test 31 | #include 32 | 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | using namespace piranha; 42 | 43 | // Pearce's polynomial multiplication test number 1. Calculate: 44 | // f * g 45 | // where 46 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**12 47 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**12 48 | 49 | BOOST_AUTO_TEST_CASE(pearce1_test) 50 | { 51 | settings::set_thread_binding(true); 52 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 53 | settings::set_n_threads( 54 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 55 | } 56 | BOOST_CHECK_EQUAL((pearce1, kronecker_monomial<>>().size()), 5821335u); 57 | } 58 | -------------------------------------------------------------------------------- /benchmarks/pearce1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_PEARCE1_HPP 30 | #define PIRANHA_PEARCE1_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial pearce1(unsigned long long factor = 1u) 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"), u("u"); 44 | 45 | auto f = (x + y + z * z * 2 + t * t * t * 3 + u * u * u * u * u * 5 + 1); 46 | auto tmp_f(f); 47 | auto g = (u + t + z * z * 2 + y * y * y * 3 + x * x * x * x * x * 5 + 1); 48 | auto tmp_g(g); 49 | for (int i = 1; i < 12; ++i) { 50 | f *= tmp_f; 51 | g *= tmp_g; 52 | } 53 | if (factor > 1u) { 54 | f *= factor; 55 | g *= factor; 56 | } 57 | { 58 | simple_timer t; 59 | return f * g; 60 | } 61 | } 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /benchmarks/pearce1_dynamic.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "pearce1.hpp" 30 | 31 | #define BOOST_TEST_MODULE pearce1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | 40 | #include 41 | #include 42 | #include 43 | 44 | using namespace piranha; 45 | 46 | // Pearce's polynomial multiplication test number 1. Calculate: 47 | // f * g 48 | // where 49 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**12 50 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**12 51 | 52 | BOOST_AUTO_TEST_CASE(pearce1_test) 53 | { 54 | settings::set_thread_binding(true); 55 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 56 | settings::set_n_threads( 57 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 58 | } 59 | BOOST_CHECK_EQUAL((pearce1>( 60 | static_cast(std::numeric_limits<::mp_limb_t>::max())) 61 | .size()), 62 | 5821335u); 63 | } 64 | -------------------------------------------------------------------------------- /benchmarks/pearce1_rational.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "pearce1.hpp" 30 | 31 | #define BOOST_TEST_MODULE pearce1_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Pearce's polynomial multiplication test number 1. Calculate: 45 | // f * g 46 | // where 47 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**12 48 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**12 49 | 50 | BOOST_AUTO_TEST_CASE(pearce1_test) 51 | { 52 | settings::set_thread_binding(true); 53 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 54 | settings::set_n_threads( 55 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 56 | } 57 | BOOST_CHECK_EQUAL((pearce1, kronecker_monomial<>>().size()), 5821335u); 58 | } 59 | -------------------------------------------------------------------------------- /benchmarks/pearce1_unpacked.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "pearce1.hpp" 30 | 31 | #define BOOST_TEST_MODULE pearce1_unpacked_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Pearce's polynomial multiplication test number 1. Calculate: 45 | // f * g 46 | // where 47 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**12 48 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**12 49 | // The monomial is in unpacked form. 50 | 51 | BOOST_AUTO_TEST_CASE(pearce1_test) 52 | { 53 | settings::set_thread_binding(true); 54 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 55 | settings::set_n_threads( 56 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 57 | } 58 | BOOST_CHECK_EQUAL((pearce1, monomial>().size()), 5821335u); 59 | } 60 | -------------------------------------------------------------------------------- /benchmarks/pearce2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "pearce2.hpp" 30 | 31 | #define BOOST_TEST_MODULE pearce2_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Pearce's polynomial multiplication test number 2. Calculate: 45 | // f * g 46 | // where 47 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**16 48 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**16 49 | 50 | BOOST_AUTO_TEST_CASE(pearce2_test) 51 | { 52 | settings::set_thread_binding(true); 53 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 54 | settings::set_n_threads( 55 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 56 | } 57 | BOOST_CHECK_EQUAL((pearce2, kronecker_monomial<>>().size()), 28398035u); 58 | } 59 | -------------------------------------------------------------------------------- /benchmarks/pearce2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_PEARCE2_HPP 30 | #define PIRANHA_PEARCE2_HPP 31 | 32 | #include 33 | 34 | #include "simple_timer.hpp" 35 | 36 | namespace piranha 37 | { 38 | 39 | template 40 | inline polynomial pearce2() 41 | { 42 | typedef polynomial p_type; 43 | p_type x("x"), y("y"), z("z"), t("t"), u("u"); 44 | 45 | auto f = (x + y + z * z * 2 + t * t * t * 3 + u * u * u * u * u * 5 + 1); 46 | auto tmp_f(f); 47 | auto g = (u + t + z * z * 2 + y * y * y * 3 + x * x * x * x * x * 5 + 1); 48 | auto tmp_g(g); 49 | for (int i = 1; i < 16; ++i) { 50 | f *= tmp_f; 51 | g *= tmp_g; 52 | } 53 | { 54 | simple_timer t; 55 | return f * g; 56 | } 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /benchmarks/pearce2_unpacked.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "pearce2.hpp" 30 | 31 | #define BOOST_TEST_MODULE pearce2_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | // Pearce's polynomial multiplication test number 2. Calculate: 45 | // f * g 46 | // where 47 | // f = (1 + x + y + 2*z**2 + 3*t**3 + 5*u**5)**16 48 | // g = (1 + u + t + 2*z**2 + 3*y**3 + 5*x**5)**16 49 | 50 | BOOST_AUTO_TEST_CASE(pearce2_test) 51 | { 52 | settings::set_thread_binding(true); 53 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 54 | settings::set_n_threads( 55 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 56 | } 57 | BOOST_CHECK_EQUAL((pearce2, monomial>().size()), 28398035u); 58 | } 59 | -------------------------------------------------------------------------------- /benchmarks/power_series.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #define BOOST_TEST_MODULE power_series_test 30 | #include 31 | 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | #include "pearce1.hpp" 40 | #include "simple_timer.hpp" 41 | 42 | using namespace piranha; 43 | 44 | BOOST_AUTO_TEST_CASE(pearce1_test) 45 | { 46 | settings::set_thread_binding(true); 47 | std::cout << "Timing multiplication:\n"; 48 | auto ret1 = pearce1, kronecker_monomial<>>(); 49 | decltype(ret1) ret2; 50 | { 51 | std::cout << "Timing degree computation: "; 52 | simple_timer t; 53 | std::cout << ret1.degree() << '\n'; 54 | } 55 | { 56 | std::cout << "Timing degree truncation:\n"; 57 | simple_timer t; 58 | ret2 = ret1.truncate_degree(30); 59 | } 60 | { 61 | std::cout << "Timing new degree computation: "; 62 | simple_timer t; 63 | std::cout << ret2.degree() << '\n'; 64 | } 65 | { 66 | std::cout << "Timing partial degree truncation:\n"; 67 | simple_timer t; 68 | ret2 = ret1.truncate_degree(30, {"u", "z"}); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /benchmarks/rectangular.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE rectangular_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | #include "simple_timer.hpp" 40 | 41 | using namespace piranha; 42 | 43 | // Test taken from: 44 | // http://groups.google.com/group/sage-devel/browse_thread/thread/f5b976c979a3b784/1263afcc6f9d09da 45 | // Meant to test sparse multiplication where series have very different sizes. 46 | 47 | BOOST_AUTO_TEST_CASE(rectangular_test) 48 | { 49 | settings::set_thread_binding(true); 50 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 51 | settings::set_n_threads( 52 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 53 | } 54 | typedef polynomial> p_type; 55 | 56 | auto func = []() -> p_type { 57 | p_type x("x"), y("y"), z("z"); 58 | auto f = x * y * y * y * z * z + x * x * y * y * z + x * y * y * y * z + x * y * y * z * z + y * y * y * z * z 59 | + y * y * y * z + 2 * y * y * z * z + 2 * x * y * z + y * y * z + y * z * z + y * y + 2 * y * z + z; 60 | p_type curr(1); 61 | for (auto i = 1; i <= 70; ++i) { 62 | curr *= f; 63 | } 64 | BOOST_CHECK_EQUAL(curr.size(), 1284816u); 65 | return curr; 66 | }; 67 | { 68 | simple_timer t; 69 | auto tmp = func(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /benchmarks/simple_timer.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SIMPLE_TIMER_HPP 30 | #define PIRANHA_SIMPLE_TIMER_HPP 31 | 32 | #include 33 | #include 34 | 35 | namespace piranha 36 | { 37 | 38 | // A simple RAII timer class, using std::chrono. It will print, upon destruction, 39 | // the time elapsed since construction (in ms). 40 | class simple_timer 41 | { 42 | public: 43 | simple_timer() : m_start(std::chrono::high_resolution_clock::now()) 44 | { 45 | } 46 | ~simple_timer() 47 | { 48 | std::cout << "Elapsed time: " 49 | << std::chrono::duration_cast(std::chrono::high_resolution_clock::now() 50 | - m_start) 51 | .count() 52 | << "ms\n"; 53 | } 54 | 55 | private: 56 | const std::chrono::high_resolution_clock::time_point m_start; 57 | }; 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /benchmarks/symengine_expand2b.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE symengine_expand2b_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include "simple_timer.hpp" 42 | 43 | using namespace piranha; 44 | using math::pow; 45 | 46 | // Test taken from: 47 | // https://github.com/sympy/symengine/blob/master/benchmarks/expand2b.cpp 48 | 49 | BOOST_AUTO_TEST_CASE(symengine_expand2b_test) 50 | { 51 | settings::set_thread_binding(true); 52 | if (boost::unit_test::framework::master_test_suite().argc > 1) { 53 | settings::set_n_threads( 54 | boost::lexical_cast(boost::unit_test::framework::master_test_suite().argv[1u])); 55 | } 56 | using p_type = polynomial; 57 | auto x = p_type{"x"}, y = p_type{"y"}, z = p_type{"z"}, w = p_type{"w"}; 58 | auto f = pow(x + y + z + w, 15); 59 | auto g = f + w; 60 | { 61 | simple_timer t; 62 | BOOST_CHECK_EQUAL((f * g).size(), 6272u); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /cmake_modules/FindDbgEng.cmake: -------------------------------------------------------------------------------- 1 | include(FindPackageHandleStandardArgs) 2 | 3 | if(DbgEng_LIBRARY) 4 | # Already in cache, be silent 5 | set(DbgEng_FIND_QUIETLY TRUE) 6 | endif() 7 | 8 | find_library(DbgEng_LIBRARY NAMES "dbgeng") 9 | 10 | if(NOT DbgEng_LIBRARY) 11 | set(DbgEng_USE_DIRECTLY TRUE) 12 | set(DbgEng_LIBRARY "dbgeng.lib" CACHE FILEPATH "" FORCE) 13 | endif() 14 | 15 | if(DbgEng_USE_DIRECTLY) 16 | message(STATUS "dbgeng.lib will be linked directly.") 17 | endif() 18 | 19 | find_package_handle_standard_args(DbgEng DEFAULT_MSG DbgEng_LIBRARY) 20 | 21 | mark_as_advanced(DbgEng_LIBRARY) 22 | 23 | if(DbgEng_FOUND AND NOT TARGET DbgEng::DbgEng) 24 | message(STATUS "Creating the 'DbgEng::DbgEng' imported target.") 25 | if(DbgEng_USE_DIRECTLY) 26 | # If we are using it directly, we must define an interface library, 27 | # as we do not have the full path to the shared library. 28 | add_library(DbgEng::DbgEng INTERFACE IMPORTED) 29 | set_target_properties(DbgEng::DbgEng PROPERTIES INTERFACE_LINK_LIBRARIES "${DbgEng_LIBRARY}") 30 | else() 31 | # Otherwise, we proceed as usual. 32 | add_library(DbgEng::DbgEng UNKNOWN IMPORTED) 33 | set_target_properties(DbgEng::DbgEng PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" 34 | IMPORTED_LOCATION "${DbgEng_LIBRARY}") 35 | endif() 36 | endif() 37 | -------------------------------------------------------------------------------- /cmake_modules/FindMSGPACK-C.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 Francesco Biscani, 2 | 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions 5 | # are met: 6 | # 7 | # 1. Redistributions of source code must retain the copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. The name of the author may not be used to endorse or promote products 13 | # derived from this software without specific prior written permission. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------ 26 | 27 | # We look only for the header-only version of msgpack-c for C++. 28 | 29 | if(MSGPACK-C_INCLUDE_DIR) 30 | # Already in cache, be silent 31 | set(MSGPACK-C_FIND_QUIETLY TRUE) 32 | endif() 33 | 34 | find_path(MSGPACK-C_INCLUDE_DIR NAMES msgpack.hpp) 35 | 36 | include(FindPackageHandleStandardArgs) 37 | 38 | find_package_handle_standard_args(MSGPACK-C DEFAULT_MSG MSGPACK-C_INCLUDE_DIR) 39 | 40 | mark_as_advanced(MSGPACK-C_INCLUDE_DIR) 41 | 42 | # NOTE: this has been adapted from CMake's FindPNG.cmake. 43 | if(MSGPACK-C_FOUND AND NOT TARGET MSGPACK-C::MSGPACK-C) 44 | add_library(MSGPACK-C::MSGPACK-C INTERFACE IMPORTED) 45 | set_target_properties(MSGPACK-C::MSGPACK-C PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MSGPACK-C_INCLUDE_DIR}") 46 | endif() 47 | -------------------------------------------------------------------------------- /cmake_modules/Findlibbacktrace.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2017 Francesco Biscani, 2 | 3 | # Redistribution and use in source and binary forms, with or without 4 | # modification, are permitted provided that the following conditions 5 | # are met: 6 | # 7 | # 1. Redistributions of source code must retain the copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. The name of the author may not be used to endorse or promote products 13 | # derived from this software without specific prior written permission. 14 | # 15 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | # ------------------------------------------------------------------------------------------ 26 | 27 | if(libbacktrace_INCLUDE_DIR AND libbacktrace_LIBRARY) 28 | # Already in cache, be silent 29 | set(libbacktrace_FIND_QUIETLY TRUE) 30 | endif() 31 | 32 | find_path(libbacktrace_INCLUDE_DIR NAMES backtrace.h) 33 | find_library(libbacktrace_LIBRARY NAMES backtrace) 34 | 35 | include(FindPackageHandleStandardArgs) 36 | 37 | find_package_handle_standard_args(libbacktrace DEFAULT_MSG libbacktrace_INCLUDE_DIR libbacktrace_LIBRARY) 38 | 39 | mark_as_advanced(libbacktrace_INCLUDE_DIR) 40 | mark_as_advanced(libbacktrace_LIBRARY) 41 | 42 | # NOTE: this has been adapted from CMake's FindPNG.cmake. 43 | if(libbacktrace_FOUND AND NOT TARGET libbacktrace::libbacktrace) 44 | add_library(libbacktrace::libbacktrace UNKNOWN IMPORTED) 45 | set_target_properties(libbacktrace::libbacktrace PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${libbacktrace_INCLUDE_DIR}" 46 | IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION "${libbacktrace_LIBRARY}") 47 | endif() 48 | -------------------------------------------------------------------------------- /cmake_modules/PiranhaFindBZip2.cmake: -------------------------------------------------------------------------------- 1 | find_package(BZip2 REQUIRED) 2 | if(NOT TARGET BZip2::BZip2) 3 | # Some older CMake versions do not provide the imported target for bzip2. 4 | message(STATUS "The 'BZip2::BZip2' imported target is missing, creating it.") 5 | add_library(BZip2::BZip2 UNKNOWN IMPORTED) 6 | set_target_properties(BZip2::BZip2 PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") 7 | set_property(TARGET BZip2::BZip2 APPEND PROPERTY IMPORTED_LOCATION "${BZIP2_LIBRARIES}") 8 | endif() 9 | -------------------------------------------------------------------------------- /cmake_modules/PiranhaPlatformSettings.cmake: -------------------------------------------------------------------------------- 1 | if(UNIX) 2 | include(CheckCXXSymbolExists) 3 | check_cxx_symbol_exists("posix_memalign" "cstdlib" _PIRANHA_POSIX_MEMALIGN_TEST) 4 | if(_PIRANHA_POSIX_MEMALIGN_TEST) 5 | message(STATUS "POSIX memalign detected.") 6 | set(PIRANHA_POSIX_MEMALIGN "#define PIRANHA_HAVE_POSIX_MEMALIGN") 7 | else() 8 | message(STATUS "POSIX memalign not detected.") 9 | endif() 10 | endif() 11 | 12 | # Setup for the machinery to detect cache line size in Windows. It's not supported everywhere, so we 13 | # check for the existence of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION type. 14 | # http://msdn.microsoft.com/en-us/library/ms686694(v=vs.85).aspx 15 | if(WIN32) 16 | include(CheckTypeSize) 17 | set(CMAKE_EXTRA_INCLUDE_FILES Windows.h) 18 | check_type_size("SYSTEM_LOGICAL_PROCESSOR_INFORMATION" _PIRANHA_SYSTEM_LOGICAL_PROCESSOR_INFORMATION) 19 | # Clear the variable. 20 | unset(CMAKE_EXTRA_INCLUDE_FILES) 21 | if(_PIRANHA_SYSTEM_LOGICAL_PROCESSOR_INFORMATION) 22 | message(STATUS "SYSTEM_LOGICAL_PROCESSOR_INFORMATION type found.") 23 | set(PIRANHA_SYSTEM_LOGICAL_PROCESSOR_INFORMATION "#define PIRANHA_HAVE_SYSTEM_LOGICAL_PROCESSOR_INFORMATION") 24 | else() 25 | MESSAGE(STATUS "SYSTEM_LOGICAL_PROCESSOR_INFORMATION type not found.") 26 | endif() 27 | endif() 28 | -------------------------------------------------------------------------------- /cmake_modules/yacma/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2018 Francesco Biscani 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /cmake_modules/yacma/README.md: -------------------------------------------------------------------------------- 1 | # yacma 2 | 3 | Yet another CMake modules archive. 4 | -------------------------------------------------------------------------------- /cmake_modules/yacma/YACMAThreadingSetup.cmake: -------------------------------------------------------------------------------- 1 | if(YACMAThreadingSetupIncluded) 2 | return() 3 | endif() 4 | 5 | include(YACMACompilerLinkerSettings) 6 | 7 | # Initial thread setup. See FindThreads.cmake for an explanation. 8 | set(THREADS_PREFER_PTHREAD_FLAG YES) 9 | find_package(Threads REQUIRED) 10 | unset(THREADS_PREFER_PTHREAD_FLAG) 11 | message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") 12 | 13 | # Setup variable for threading-specific flags. 14 | set(YACMA_THREADING_CXX_FLAGS) 15 | 16 | # POSIX thread setup. Intended both for UNIX and Windows (the latter when using some sort of 17 | # pthread emulation/wrapper like pthreads-win32). 18 | if(CMAKE_USE_PTHREADS_INIT) 19 | message(STATUS "POSIX threads detected.") 20 | # Detect affinity setting primitives. 21 | include(CheckCXXSymbolExists) 22 | set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") 23 | CHECK_CXX_SYMBOL_EXISTS("pthread_setaffinity_np" "pthread.h" _YACMA_HAVE_PTHREAD_SETAFFINITY) 24 | CHECK_CXX_SYMBOL_EXISTS("pthread_getaffinity_np" "pthread.h" _YACMA_HAVE_PTHREAD_GETAFFINITY) 25 | unset(CMAKE_REQUIRED_LIBRARIES) 26 | if(_YACMA_HAVE_PTHREAD_SETAFFINITY AND _YACMA_HAVE_PTHREAD_GETAFFINITY) 27 | set(YACMA_HAVE_PTHREAD_AFFINITY YES) 28 | else() 29 | set(YACMA_HAVE_PTHREAD_AFFINITY NO) 30 | endif() 31 | if(YACMA_HAVE_PTHREAD_AFFINITY) 32 | message(STATUS "POSIX threads affinity extensions detected.") 33 | else() 34 | message(STATUS "POSIX threads affinity extensions NOT detected.") 35 | endif() 36 | endif() 37 | 38 | if(MINGW) 39 | message(STATUS "Enabling the '-mthreads' flag for MinGW.") 40 | list(APPEND YACMA_THREADING_CXX_FLAGS "-mthreads") 41 | endif() 42 | 43 | if(YACMA_COMPILER_IS_MSVC) 44 | message(STATUS "Enabling the '_MT' definition for MSVC.") 45 | list(APPEND YACMA_THREADING_CXX_FLAGS "/D_MT") 46 | endif() 47 | 48 | # Check if we have thread_local. 49 | # NOTE: we need to double check what happens with OSX's clang here. 50 | list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_thread_local" YACMA_HAVE_THREAD_LOCAL) 51 | if(${YACMA_HAVE_THREAD_LOCAL} EQUAL -1) 52 | message(STATUS "The 'thread_local' keyword is NOT supported.") 53 | set(YACMA_HAVE_THREAD_LOCAL NO) 54 | else() 55 | message(STATUS "The 'thread_local' keyword is supported.") 56 | set(YACMA_HAVE_THREAD_LOCAL YES) 57 | endif() 58 | 59 | # Final report. 60 | if(YACMA_THREADING_CXX_FLAGS) 61 | message(STATUS "Extra compiler flags for threading: ${YACMA_THREADING_CXX_FLAGS}") 62 | endif() 63 | 64 | # Mark as included. 65 | set(YACMAThreadingSetupIncluded YES) 66 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | ignore: 3 | - tests/.* 4 | 5 | comment: off 6 | -------------------------------------------------------------------------------- /doc/conversions.rst: -------------------------------------------------------------------------------- 1 | .. _conversions: 2 | 3 | Conversions 4 | =========== 5 | 6 | .. toctree:: 7 | :maxdepth: 1 8 | 9 | safe_convert.rst 10 | safe_cast.rst 11 | -------------------------------------------------------------------------------- /doc/index.rst: -------------------------------------------------------------------------------- 1 | .. Piranha documentation master file, created by 2 | sphinx-quickstart on Sun Nov 6 03:43:00 2011. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Piranha's documentation! 7 | =================================== 8 | 9 | Piranha is a computer-algebra library for the symbolic manipulation of sparse 10 | multivariate polynomials and other closely-related symbolic objects 11 | (such as Poisson series). 12 | 13 | Piranha is written in modern C++, with emphasis on portability, correctness 14 | and performance. 15 | 16 | .. warning:: This documentation is a (currently incomplete) work in progress. 17 | 18 | .. toctree:: 19 | :maxdepth: 2 20 | 21 | reference.rst 22 | -------------------------------------------------------------------------------- /doc/key_interface.rst: -------------------------------------------------------------------------------- 1 | .. _key_interface: 2 | 3 | Key interface 4 | ============= 5 | 6 | Comparisons 7 | ----------- 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | key_key_is_zero.rst 13 | key_key_is_one.rst 14 | 15 | Degree and related 16 | ------------------ 17 | 18 | .. toctree:: 19 | :maxdepth: 1 20 | 21 | key_key_degree.rst 22 | key_key_ldegree.rst 23 | -------------------------------------------------------------------------------- /doc/key_key_is_one.rst: -------------------------------------------------------------------------------- 1 | .. _key_key_is_one: 2 | 3 | Detect unitary keys 4 | =================== 5 | 6 | .. todo:: 7 | 8 | Document key specialisations. 9 | 10 | *#include * 11 | 12 | .. cpp:function:: template bool piranha::key_is_one(T &&x, const piranha::symbol_fset &s) 13 | 14 | This function returns ``true`` if the input key *x* is equal to one, ``false`` otherwise. 15 | 16 | The implementation is delegated to the call operator of the :cpp:class:`piranha::key_is_one_impl` function object. 17 | The body of this function is equivalent to: 18 | 19 | .. code-block:: c++ 20 | 21 | return piranha::key_is_one_impl{}(x, s); 22 | 23 | where ``Tp`` is ``T`` after the removal of reference and cv-qualifiers, 24 | and *x* is perfectly forwarded to the call operator of :cpp:class:`piranha::key_is_one_impl`. 25 | 26 | Piranha provides specialisations of :cpp:class:`piranha::key_is_one_impl` for all the available key types. 27 | See the :ref:`implementation ` section below for more details about the available 28 | specialisations. 29 | 30 | :param x: the input key. 31 | :param s: the symbol set associated to *x*. 32 | 33 | :return: ``true`` if *x* is equal to one, ``false`` otherwise. 34 | 35 | :exception unspecified: any exception thrown by the call operator of :cpp:class:`piranha::key_is_one_impl`. 36 | 37 | Concepts 38 | -------- 39 | 40 | .. cpp:concept:: template piranha::KeyIsOneType 41 | 42 | This concept is satisfied if :cpp:func:`piranha::key_is_one()` can be called 43 | with an argument of type ``T``. Specifically, this concept will be satisfied if 44 | 45 | .. code-block:: c++ 46 | 47 | piranha::key_is_one_impl{}(std::declval(), std::declval()) 48 | 49 | (where ``Tp`` is ``T`` after the removal of reference and cv-qualifiers) is a valid expression whose 50 | type is :cpp:concept:`convertible ` to ``bool``. 51 | 52 | .. _key_key_is_one_impls: 53 | 54 | Implementations 55 | --------------- 56 | 57 | .. cpp:class:: template piranha::key_is_one_impl 58 | 59 | Unspecialised version of the function object implementing :cpp:func:`piranha::key_is_one()`. 60 | 61 | This default implementation does not define any call operator, and thus no default implementation 62 | of :cpp:func:`piranha::key_is_one()` is available. 63 | -------------------------------------------------------------------------------- /doc/key_key_is_zero.rst: -------------------------------------------------------------------------------- 1 | .. _key_key_is_zero: 2 | 3 | Detect zero keys 4 | ================ 5 | 6 | .. todo:: 7 | 8 | Document key specialisations. 9 | 10 | *#include * 11 | 12 | .. cpp:function:: template bool piranha::key_is_zero(T &&x, const piranha::symbol_fset &s) 13 | 14 | This function returns ``true`` if the input key *x* is equal to zero, ``false`` otherwise. 15 | 16 | The implementation is delegated to the call operator of the :cpp:class:`piranha::key_is_zero_impl` function object. 17 | The body of this function is equivalent to: 18 | 19 | .. code-block:: c++ 20 | 21 | return piranha::key_is_zero_impl{}(x, s); 22 | 23 | where ``Tp`` is ``T`` after the removal of reference and cv-qualifiers, 24 | and *x* is perfectly forwarded to the call operator of :cpp:class:`piranha::key_is_zero_impl`. 25 | 26 | Piranha provides specialisations of :cpp:class:`piranha::key_is_zero_impl` for all the available key types. 27 | See the :ref:`implementation ` section below for more details about the available 28 | specialisations. 29 | 30 | :param x: the input key. 31 | :param s: the symbol set associated to *x*. 32 | 33 | :return: ``true`` if *x* is equal to zero, ``false`` otherwise. 34 | 35 | :exception unspecified: any exception thrown by the call operator of :cpp:class:`piranha::key_is_zero_impl`. 36 | 37 | Concepts 38 | -------- 39 | 40 | .. cpp:concept:: template piranha::KeyIsZeroType 41 | 42 | This concept is satisfied if :cpp:func:`piranha::key_is_zero()` can be called 43 | with an argument of type ``T``. Specifically, this concept will be satisfied if 44 | 45 | .. code-block:: c++ 46 | 47 | piranha::key_is_zero_impl{}(std::declval(), std::declval()) 48 | 49 | (where ``Tp`` is ``T`` after the removal of reference and cv-qualifiers) is a valid expression whose 50 | type is :cpp:concept:`convertible ` to ``bool``. 51 | 52 | .. _key_key_is_zero_impls: 53 | 54 | Implementations 55 | --------------- 56 | 57 | .. cpp:class:: template piranha::key_is_zero_impl 58 | 59 | Unspecialised version of the function object implementing :cpp:func:`piranha::key_is_zero()`. 60 | 61 | This default implementation returns unconditionally ``false``, regardless of the input arguments. 62 | In other words, keys by default are never considered to be equal to zero. 63 | -------------------------------------------------------------------------------- /doc/kronecker_monomial.rst: -------------------------------------------------------------------------------- 1 | Kronecker monomial 2 | ================== 3 | 4 | .. cpp:class:: template piranha::kronecker_monomial 5 | -------------------------------------------------------------------------------- /doc/math.rst: -------------------------------------------------------------------------------- 1 | .. _math: 2 | 3 | Mathematical functions 4 | ====================== 5 | 6 | Exponentiation 7 | -------------- 8 | 9 | .. toctree:: 10 | :maxdepth: 1 11 | 12 | math_pow.rst 13 | 14 | Number theoretic functions 15 | -------------------------- 16 | 17 | .. toctree:: 18 | :maxdepth: 1 19 | 20 | math_binomial.rst 21 | math_gcd.rst 22 | math_gcd3.rst 23 | 24 | Trigonometry 25 | ------------ 26 | 27 | .. toctree:: 28 | :maxdepth: 1 29 | 30 | math_sin.rst 31 | math_cos.rst 32 | 33 | Comparisons 34 | ----------- 35 | 36 | .. toctree:: 37 | :maxdepth: 1 38 | 39 | math_is_zero.rst 40 | math_is_one.rst 41 | 42 | Degree and related 43 | ------------------ 44 | 45 | .. toctree:: 46 | :maxdepth: 1 47 | 48 | math_degree.rst 49 | math_ldegree.rst 50 | -------------------------------------------------------------------------------- /doc/numerical_types.rst: -------------------------------------------------------------------------------- 1 | .. _numerical_types: 2 | 3 | Fundamental numerical types 4 | =========================== 5 | 6 | Integers 7 | -------- 8 | 9 | *#include * 10 | 11 | .. cpp:type:: piranha::integer = mppp::integer<1> 12 | 13 | This type is the main multiprecision integer type used throughout piranha. 14 | It is an :cpp:class:`mppp::integer ` with a static size of 1 limb. 15 | 16 | .. cpp:function:: piranha::integer piranha::literals::operator"" _z(const char *s) 17 | 18 | This user-defined literal creates a :cpp:type:`piranha::integer` from the input string *s*, 19 | which will be interpreted as the base-10 representation of an integral value. 20 | 21 | :param s: the input string. 22 | 23 | :return: a :cpp:type:`piranha::integer` constructed from *s*. 24 | 25 | :exception unspecified: any exception thrown by the constructor of :cpp:type:`piranha::integer` 26 | from string. 27 | 28 | Rationals 29 | --------- 30 | 31 | *#include * 32 | 33 | .. cpp:type:: piranha::rational = mppp::rational<1> 34 | 35 | This type is the main multiprecision rational type used throughout piranha. 36 | It is an :cpp:class:`mppp::rational ` with a static size of 1 limb. 37 | 38 | .. cpp:function:: piranha::rational piranha::literals::operator"" _q(const char *s) 39 | 40 | This user-defined literal creates a :cpp:type:`piranha::rational` from the input string *s*, 41 | which will be interpreted as the base-10 representation of a rational value. The accepted 42 | input formats are described in the documentation of the constructor of :cpp:type:`piranha::rational` 43 | from string. 44 | 45 | :param s: the input string. 46 | 47 | :return: a :cpp:type:`piranha::rational` constructed from *s*. 48 | 49 | :exception unspecified: any exception thrown by the constructor of :cpp:type:`piranha::rational` 50 | from string. 51 | 52 | Multiprecision reals 53 | -------------------- 54 | 55 | .. note:: 56 | 57 | Multiprecision real numbers are available only if mp++ was configured with the ``MPPP_WITH_MPFR`` option enabled 58 | (see the :ref:`mp++ installation instructions `). 59 | 60 | *#include * 61 | 62 | .. cpp:type:: piranha::real = mppp::real 63 | 64 | This type can be used to represent multiprecision floating-point values. It is an alias 65 | for :cpp:class:`mppp::real `. 66 | -------------------------------------------------------------------------------- /doc/reference.rst: -------------------------------------------------------------------------------- 1 | .. _reference: 2 | 3 | Reference 4 | ========= 5 | 6 | .. toctree:: 7 | :maxdepth: 2 8 | 9 | concepts.rst 10 | numerical_types.rst 11 | symbol_management.rst 12 | math.rst 13 | key_interface.rst 14 | conversions.rst 15 | kronecker_monomial.rst 16 | -------------------------------------------------------------------------------- /doc/symbol_management.rst: -------------------------------------------------------------------------------- 1 | .. _symbol_management: 2 | 3 | Symbol management 4 | ================= 5 | 6 | Types 7 | ----- 8 | 9 | .. cpp:type:: piranha::symbol_fset = boost::container::flat_set 10 | 11 | This data structure represents a collection of symbols as a set of strings ordered 12 | lexicographically. 13 | 14 | This data structure is implemented on top of the 15 | `boost::flat_set `__ class. 16 | 17 | .. cpp:type:: piranha::symbol_idx = piranha::symbol_fset::size_type 18 | 19 | A C++ unsigned integral type representing indices into a :cpp:type:`piranha::symbol_fset`. 20 | 21 | .. cpp:type:: piranha::symbol_idx_fset = boost::container::flat_set 22 | 23 | This data structure represents an ordered set of :cpp:type:`indices ` 24 | into a :cpp:type:`piranha::symbol_fset`. 25 | -------------------------------------------------------------------------------- /include/piranha/detail/atomic_lock_guard.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_ATOMIC_LOCK_GUARD_HPP 30 | #define PIRANHA_DETAIL_ATOMIC_LOCK_GUARD_HPP 31 | 32 | #include 33 | 34 | namespace piranha 35 | { 36 | 37 | namespace detail 38 | { 39 | 40 | // A simple spinlock built on top of std::atomic_flag. See for reference: 41 | // http://en.cppreference.com/w/cpp/atomic/atomic_flag 42 | // http://stackoverflow.com/questions/26583433/c11-implementation-of-spinlock-using-atomic 43 | // The memory order specification is to squeeze out some extra performance with respect to the 44 | // default behaviour of atomic types. 45 | struct atomic_lock_guard { 46 | explicit atomic_lock_guard(std::atomic_flag &af) : m_af(af) 47 | { 48 | while (m_af.test_and_set(std::memory_order_acquire)) { 49 | } 50 | } 51 | ~atomic_lock_guard() 52 | { 53 | m_af.clear(std::memory_order_release); 54 | } 55 | // Delete explicitly all other ctors/assignment operators. 56 | atomic_lock_guard() = delete; 57 | atomic_lock_guard(const atomic_lock_guard &) = delete; 58 | atomic_lock_guard(atomic_lock_guard &&) = delete; 59 | atomic_lock_guard &operator=(const atomic_lock_guard &) = delete; 60 | atomic_lock_guard &operator=(atomic_lock_guard &&) = delete; 61 | // Data members. 62 | std::atomic_flag &m_af; 63 | }; 64 | } 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /include/piranha/detail/cf_mult_impl.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_CF_MULT_IMPL_HPP 30 | #define PIRANHA_DETAIL_CF_MULT_IMPL_HPP 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | namespace piranha 43 | { 44 | 45 | inline namespace impl 46 | { 47 | 48 | // Overload if the coefficient is a rational. 49 | template ::value, int> = 0> 50 | inline void cf_mult_impl(Cf &out_cf, const Cf &cf1, const Cf &cf2) 51 | { 52 | math::mul3(out_cf._get_num(), cf1.get_num(), cf2.get_num()); 53 | } 54 | 55 | // Overload if the coefficient is not a rational. 56 | template ::value, int> = 0> 57 | inline void cf_mult_impl(Cf &out_cf, const Cf &cf1, const Cf &cf2) 58 | { 59 | math::mul3(out_cf, cf1, cf2); 60 | } 61 | } 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/piranha/detail/config_gcc.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_CONFIG_GCC_HPP 30 | #define PIRANHA_CONFIG_GCC_HPP 31 | 32 | #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) 33 | #error The minimum supported GCC version is 4.8.0. 34 | #endif 35 | 36 | #define PIRANHA_COMPILER_IS_GCC 37 | #define PIRANHA_PRETTY_FUNCTION __PRETTY_FUNCTION__ 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/piranha/detail/config_intel.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_CONFIG_INTEL_HPP 30 | #define PIRANHA_CONFIG_INTEL_HPP 31 | 32 | #if __INTEL_COMPILER < 1500 33 | #error The minimum supported Intel compiler version is 15. 34 | #endif 35 | 36 | #define PIRANHA_COMPILER_IS_INTEL 37 | #define PIRANHA_PRETTY_FUNCTION __func__ 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/piranha/detail/debug_access.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_DEBUG_ACCESS_HPP 30 | #define PIRANHA_DETAIL_DEBUG_ACCESS_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | inline namespace impl 36 | { 37 | 38 | // Used to access private and protected class members for debug purposes. 39 | template 40 | class debug_access 41 | { 42 | }; 43 | } 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /include/piranha/detail/demangle.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_DEMANGLE_HPP 30 | #define PIRANHA_DETAIL_DEMANGLE_HPP 31 | 32 | #include 33 | 34 | namespace piranha 35 | { 36 | 37 | inline namespace impl 38 | { 39 | 40 | // Just use mp++'s demangle. 41 | using mppp::demangle; 42 | } 43 | } 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /include/piranha/detail/divisor_series_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DIVISOR_SERIES_FWD_HPP 30 | #define PIRANHA_DIVISOR_SERIES_FWD_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | namespace detail 36 | { 37 | 38 | // Divisor series tag. 39 | struct divisor_series_tag; 40 | } 41 | 42 | // Fwd declaration of divisor series. 43 | template 44 | class divisor_series; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/piranha/detail/poisson_series_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_POISSON_SERIES_FWD_HPP 30 | #define PIRANHA_POISSON_SERIES_FWD_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | namespace detail 36 | { 37 | 38 | // Poisson series tag. 39 | struct poisson_series_tag; 40 | } 41 | 42 | // Forward declaration of Poisson series class. 43 | template 44 | class poisson_series; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /include/piranha/detail/polynomial_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_POLYNOMIAL_FWD_HPP 30 | #define PIRANHA_POLYNOMIAL_FWD_HPP 31 | 32 | #include 33 | 34 | #include 35 | 36 | namespace piranha 37 | { 38 | 39 | namespace detail 40 | { 41 | 42 | // Polynomial tag struct to work around is_instace_of bug in GCC. 43 | struct polynomial_tag; 44 | 45 | // Test if a series type has at least one polynomial 46 | // in the coefficient hierarchy. 47 | template 48 | struct poly_in_cf { 49 | static const bool value = false; 50 | }; 51 | 52 | template 53 | struct poly_in_cf< 54 | T, typename std::enable_if<(series_recursion_index::value > 0u) 55 | && std::is_base_of::value>::type> { 56 | static const bool value = true; 57 | }; 58 | 59 | template 60 | struct poly_in_cf< 61 | T, typename std::enable_if<(series_recursion_index::value > 0u) 62 | && !std::is_base_of::value>::type> { 63 | static const bool value = poly_in_cf::value; 64 | }; 65 | } 66 | 67 | // Forward declaration of polynomial class. 68 | template 69 | class polynomial; 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /include/piranha/detail/prepare_for_print.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_PREPARE_FOR_PRINT_HPP 30 | #define PIRANHA_DETAIL_PREPARE_FOR_PRINT_HPP 31 | 32 | #include 33 | 34 | namespace piranha 35 | { 36 | 37 | namespace detail 38 | { 39 | 40 | // Helper to print char types without displaying garbage. 41 | template 42 | struct pfp_special { 43 | static const bool value 44 | = std::is_same::value || std::is_same::value || std::is_same::value; 45 | }; 46 | 47 | template 48 | inline const T &prepare_for_print(const T &x, typename std::enable_if::value>::type * = nullptr) 49 | { 50 | return x; 51 | } 52 | 53 | template 54 | inline int 55 | prepare_for_print(const T &n, 56 | typename std::enable_if::value && std::is_signed::value>::type * = nullptr) 57 | { 58 | return static_cast(n); 59 | } 60 | 61 | template 62 | inline unsigned 63 | prepare_for_print(const T &n, 64 | typename std::enable_if::value && std::is_unsigned::value>::type * = nullptr) 65 | { 66 | return static_cast(n); 67 | } 68 | } 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /include/piranha/detail/series_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SERIES_FWD_HPP 30 | #define PIRANHA_SERIES_FWD_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | namespace detail 36 | { 37 | 38 | // Tag structure for series. 39 | struct series_tag { 40 | }; 41 | } 42 | 43 | // Forward-declaration of series. 44 | template 45 | class series; 46 | 47 | // Fwd declaration of type trait. 48 | template 49 | class is_series; 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/piranha/detail/series_multiplier_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SERIES_MULTIPLIER_FWD_HPP 30 | #define PIRANHA_SERIES_MULTIPLIER_FWD_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | // Forward-declaration of series_multiplier. 36 | template 37 | class series_multiplier; 38 | } 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /include/piranha/detail/sfinae_types.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SFINAE_TYPES_HPP 30 | #define PIRANHA_SFINAE_TYPES_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | namespace detail 36 | { 37 | 38 | // Types for SFINAE-based type traits. 39 | // Guidelines for usage: 40 | // - decltype-based SFINAE, 41 | // - use std::is_same in the value of the type trait, 42 | // - use (...,void(),yes/no()) in the decltype in order to avoid problems with 43 | // overloads of the comma operator. 44 | struct sfinae_types { 45 | struct yes { 46 | }; 47 | struct no { 48 | }; 49 | }; 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/piranha/detail/small_vector_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SMALL_VECTOR_FWD_HPP 30 | #define PIRANHA_SMALL_VECTOR_FWD_HPP 31 | 32 | namespace piranha 33 | { 34 | 35 | namespace detail 36 | { 37 | 38 | // Fwd declaration of the small vector union. 39 | template 40 | union small_vector_union; 41 | } 42 | 43 | // Fwd declaration of small_vector. 44 | template 45 | class small_vector; 46 | } 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/piranha/detail/vector_hasher.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_DETAIL_VECTOR_HASHER_HPP 30 | #define PIRANHA_DETAIL_VECTOR_HASHER_HPP 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | namespace piranha 37 | { 38 | namespace detail 39 | { 40 | 41 | template 42 | inline std::size_t vector_hasher(const Vector &v) 43 | { 44 | using value_type = typename Vector::value_type; 45 | const auto size = v.size(); 46 | switch (size) { 47 | case 0u: 48 | return 0u; 49 | case 1u: { 50 | std::hash hasher; 51 | return hasher(v[0u]); 52 | } 53 | } 54 | std::hash hasher; 55 | std::size_t retval = hasher(v[0u]); 56 | for (decltype(v.size()) i = 1u; i < size; ++i) { 57 | boost::hash_combine(retval, hasher(v[i])); 58 | } 59 | return retval; 60 | } 61 | } 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /include/piranha/key/key_is_one.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_KEY_KEY_IS_ONE_HPP 30 | #define PIRANHA_KEY_KEY_IS_ONE_HPP 31 | 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | namespace piranha 41 | { 42 | 43 | // Default functor for the implementation of piranha::key_is_one(). 44 | template 50 | class key_is_one_impl 51 | { 52 | }; 53 | 54 | inline namespace impl 55 | { 56 | 57 | // Candidate type for piranha::key_is_one(). 58 | template 59 | using key_is_one_t_ = decltype(key_is_one_impl>{}(std::declval(), std::declval())); 60 | } 61 | 62 | template 63 | using is_key_is_one_type = std::is_convertible, bool>; 64 | 65 | #if defined(PIRANHA_HAVE_CONCEPTS) 66 | 67 | template 68 | concept bool KeyIsOneType = is_key_is_one_type::value; 69 | 70 | #endif 71 | 72 | // One detection for keys. 73 | #if defined(PIRANHA_HAVE_CONCEPTS) 74 | template 75 | #else 76 | template ::value, int> = 0> 77 | #endif 78 | inline bool key_is_one(T &&x, const symbol_fset &s) 79 | { 80 | return key_is_one_impl>{}(std::forward(x), s); 81 | } 82 | } 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /include/piranha/key_is_convertible.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_KEY_IS_CONVERTIBLE_HPP 30 | #define PIRANHA_KEY_IS_CONVERTIBLE_HPP 31 | 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | namespace piranha 40 | { 41 | 42 | /// Detect if a key type is convertible to another key type. 43 | /** 44 | * This type trait will be \p true if the key type \p To can be constructed 45 | * from a const reference to the key type \p From and a const reference to 46 | * piranha::symbol_fset, \p false otherwise. 47 | * 48 | * \p To is considered after the removal of cv/reference qualifiers. \p To and \p From must satisfy 49 | * piranha::is_key (after the removal of cv/reference qualifiers), otherwise a compile-time error will be generated. 50 | */ 51 | template 52 | class key_is_convertible 53 | { 54 | PIRANHA_TT_CHECK(is_key, uncvref_t); 55 | PIRANHA_TT_CHECK(is_key, uncvref_t); 56 | static const bool implementation_defined 57 | = std::is_constructible, const From &, const symbol_fset &>::value; 58 | 59 | public: 60 | /// Value of the type trait. 61 | static const bool value = implementation_defined; 62 | }; 63 | 64 | template 65 | const bool key_is_convertible::value; 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /include/piranha/series_multiplier.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PIRANHA_SERIES_MULTIPLIER_HPP 30 | #define PIRANHA_SERIES_MULTIPLIER_HPP 31 | 32 | #include 33 | 34 | namespace piranha 35 | { 36 | 37 | /// Series multiplier. 38 | /** 39 | * This class is used by the multiplication operators involving two series operands. The class works as follows: 40 | * 41 | * - an instance of series multiplier is created using two series as construction arguments; 42 | * - when operator()() is called, an instance of \p Series is returned, representing 43 | * the result of the multiplication of the two series used for construction. 44 | * 45 | * Any specialisation of this class must respect the protocol described above (i.e., construction from series 46 | * instances and operator()() to compute the result). Note that this class is guaranteed to be used after the symbolic 47 | * arguments of the series used for construction 48 | * have been merged (in other words, the two series have identical symbolic arguments sets). 49 | * 50 | * The default implementation of this class does not define any call operator: any use of this class will thus result in 51 | * a compile-time error. 52 | */ 53 | template 54 | class series_multiplier 55 | { 56 | }; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /piranha-config.cmake.in: -------------------------------------------------------------------------------- 1 | # Get current dir. 2 | get_filename_component(_PIRANHA_CONFIG_SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 3 | 4 | # Find the deps. Alter the cmake module path. 5 | set(_PIRANHA_CONFIG_OLD_MODULE_PATH "${CMAKE_MODULE_PATH}") 6 | list(APPEND CMAKE_MODULE_PATH "${_PIRANHA_CONFIG_SELF_DIR}") 7 | find_package(Threads REQUIRED) 8 | find_package(mp++ @PIRANHA_MINIMUM_MPPP_VERSION@ REQUIRED) 9 | @_PIRANHA_CONFIG_OPTIONAL_DEPS@ 10 | include(PiranhaFindBoost) 11 | 12 | if(PIRANHA_WITH_BOOST_STACKTRACE) 13 | if(WIN32) 14 | find_package(DbgEng REQUIRED) 15 | else() 16 | find_package(libbacktrace REQUIRED) 17 | endif() 18 | endif() 19 | 20 | # Restore original module path. 21 | set(CMAKE_MODULE_PATH "${_PIRANHA_CONFIG_OLD_MODULE_PATH}") 22 | unset(_PIRANHA_CONFIG_OLD_MODULE_PATH) 23 | 24 | include(${_PIRANHA_CONFIG_SELF_DIR}/piranha_export.cmake) 25 | 26 | # Clean up. 27 | unset(_PIRANHA_CONFIG_SELF_DIR) 28 | -------------------------------------------------------------------------------- /pyranha/_version.py.in: -------------------------------------------------------------------------------- 1 | # -*- coding: iso-8859-1 -*- 2 | # Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 3 | # 4 | # This file is part of the Piranha library. 5 | # 6 | # The Piranha library is free software; you can redistribute it and/or modify 7 | # it under the terms of either: 8 | # 9 | # * the GNU Lesser General Public License as published by the Free 10 | # Software Foundation; either version 3 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # or 14 | # 15 | # * the GNU General Public License as published by the Free Software 16 | # Foundation; either version 3 of the License, or (at your option) any 17 | # later version. 18 | # 19 | # or both in parallel, as here. 20 | # 21 | # The Piranha library is distributed in the hope that it will be useful, but 22 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 23 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24 | # for more details. 25 | # 26 | # You should have received copies of the GNU General Public License and the 27 | # GNU Lesser General Public License along with the Piranha library. If not, 28 | # see https://www.gnu.org/licenses/. 29 | 30 | __version__ = "@piranha_VERSION@" 31 | -------------------------------------------------------------------------------- /pyranha/divisor_series_descriptor.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PYRANHA_DIVISOR_SERIES_DESCRIPTOR_HPP 30 | #define PYRANHA_DIVISOR_SERIES_DESCRIPTOR_HPP 31 | 32 | #include "python_includes.hpp" 33 | 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #if defined(MPPP_WITH_MPFR) 47 | #include 48 | #endif 49 | 50 | namespace pyranha 51 | { 52 | struct divisor_series_descriptor { 53 | using d_type = piranha::divisor; 54 | using params = std::tuple< 55 | // Poly double. 56 | std::tuple>, d_type>, 57 | std::tuple>, d_type>, 58 | std::tuple>, d_type>, 59 | // Poly rational. 60 | std::tuple>, d_type>, 61 | std::tuple>, d_type>, 62 | std::tuple>, d_type>>; 63 | using interop_types = std::tuple; 64 | using pow_types = interop_types; 65 | using eval_types = std::tuple; 71 | interop_types it; 72 | pow_types pt; 73 | eval_types et; 74 | }; 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /pyranha/exceptions.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PYRANHA_EXCEPTIONS_HPP 30 | #define PYRANHA_EXCEPTIONS_HPP 31 | 32 | #include "python_includes.hpp" 33 | 34 | #include 35 | 36 | namespace pyranha 37 | { 38 | 39 | namespace bp = boost::python; 40 | 41 | // NOTE: the idea here is to use non-type template parameters to handle generically exceptions. 42 | // The standard Python exceptions are pointers with external linkage and as such they are usable as non-type template 43 | // parameters. 44 | // http://docs.python.org/extending/extending.html#intermezzo-errors-and-exceptions 45 | // http://stackoverflow.com/questions/1655271/explanation-of-pyapi-data-macro 46 | // http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Ftemplate_non-type_arguments.htm 47 | 48 | template 49 | inline void generic_translator(const CppEx &cpp_ex) 50 | { 51 | ::PyErr_SetString(*PyEx, cpp_ex.what()); 52 | } 53 | 54 | template 55 | inline void generic_translate() 56 | { 57 | bp::register_exception_translator(generic_translator); 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PYRANHA_EXPOSE_DIVISOR_SERIES_HPP 30 | #define PYRANHA_EXPOSE_DIVISOR_SERIES_HPP 31 | 32 | #include 33 | 34 | #include "type_system.hpp" 35 | 36 | namespace pyranha 37 | { 38 | 39 | PYRANHA_DECLARE_T_NAME(piranha::divisor_series) 40 | 41 | void expose_divisor_series_0(); 42 | void expose_divisor_series_1(); 43 | void expose_divisor_series_2(); 44 | void expose_divisor_series_3(); 45 | void expose_divisor_series_4(); 46 | void expose_divisor_series_5(); 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_0.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_0() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_1() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_2() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_3() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_4.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_4() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_divisor_series_5.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "divisor_series_descriptor.hpp" 34 | #include "expose_divisor_series.hpp" 35 | #include "expose_utils.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_divisor_series_5() 41 | { 42 | series_exposer ds_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_0.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_0() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_1() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_10.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_10() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_11.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_11() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_2() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_3() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_4.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_4() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_5.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_5() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_6.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_6() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_7.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_7() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_8.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_8() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_poisson_series_9.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_poisson_series.hpp" 34 | #include "expose_utils.hpp" 35 | #include "poisson_series_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_poisson_series_9() 41 | { 42 | series_exposer ps_exposer; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_0.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include 34 | 35 | #include "expose_polynomials.hpp" 36 | #include "expose_utils.hpp" 37 | #include "polynomial_descriptor.hpp" 38 | 39 | namespace pyranha 40 | { 41 | 42 | namespace bp = boost::python; 43 | 44 | void expose_polynomials_0() 45 | { 46 | series_exposer> 47 | poly_exposer; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_1() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_10.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_10() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_2() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_3() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_4.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_4() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_5.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_5() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_6.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_6() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_7.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_7() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_8.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_8() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_polynomials_9.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_polynomials.hpp" 34 | #include "expose_utils.hpp" 35 | #include "polynomial_descriptor.hpp" 36 | 37 | namespace pyranha 38 | { 39 | 40 | void expose_polynomials_9() 41 | { 42 | series_exposer> 43 | poly_exposer; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pyranha/expose_utils.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include "python_includes.hpp" 30 | 31 | #include 32 | 33 | #include "expose_utils.hpp" 34 | 35 | namespace pyranha 36 | { 37 | 38 | std::size_t exposed_types_counter = 0u; 39 | 40 | std::size_t lambdified_counter = 0u; 41 | } 42 | -------------------------------------------------------------------------------- /pyranha/python_includes.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PYRANHA_PYTHON_INCLUDES_HPP 30 | #define PYRANHA_PYTHON_INCLUDES_HPP 31 | 32 | // NOTE: the order of inclusion in the first two items here is forced by these two issues: 33 | // http://mail.python.org/pipermail/python-list/2004-March/907592.html 34 | // http://mail.python.org/pipermail/new-bugs-announce/2011-March/010395.html 35 | // clang-format off 36 | #if defined(_WIN32) 37 | #include 38 | #include 39 | #else 40 | #include 41 | #include 42 | #endif 43 | // clang-format on 44 | 45 | #if PY_MAJOR_VERSION < 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 7) 46 | #error Minimum supported Python version is 2.7. 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /pyranha/types.py: -------------------------------------------------------------------------------- 1 | # -*- coding: iso-8859-1 -*- 2 | # Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 3 | # 4 | # This file is part of the Piranha library. 5 | # 6 | # The Piranha library is free software; you can redistribute it and/or modify 7 | # it under the terms of either: 8 | # 9 | # * the GNU Lesser General Public License as published by the Free 10 | # Software Foundation; either version 3 of the License, or (at your 11 | # option) any later version. 12 | # 13 | # or 14 | # 15 | # * the GNU General Public License as published by the Free Software 16 | # Foundation; either version 3 of the License, or (at your option) any 17 | # later version. 18 | # 19 | # or both in parallel, as here. 20 | # 21 | # The Piranha library is distributed in the hope that it will be useful, but 22 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 23 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24 | # for more details. 25 | # 26 | # You should have received copies of the GNU General Public License and the 27 | # GNU Lesser General Public License along with the Piranha library. If not, 28 | # see https://www.gnu.org/licenses/. 29 | 30 | from __future__ import absolute_import as _ai 31 | 32 | from ._core import types as _t, _with_mpfr 33 | 34 | #: This type generator represents the standard C++ type ``double``. 35 | double = _t.double 36 | 37 | #: This type generator represents a signed integral C++ type whose width is at least 16 bits (it will 38 | #: be exactly 16 bits on most platforms). 39 | int16 = _t.int16 40 | 41 | #: This type generator represents the arbitrary-precision integer type provided by the piranha C++ library. 42 | integer = _t.integer 43 | 44 | #: This type generator represents the arbitrary-precision rational type provided by the piranha C++ library. 45 | rational = _t.rational 46 | 47 | if _with_mpfr: 48 | #: This type generator represents the multiprecision floating-point type provided by the piranha C++ library. 49 | real = _t.real 50 | 51 | #: This type generator represents the Kronecker monomial type (that is, a monomial "compressed" into a single 52 | #: signed integral value). 53 | k_monomial = _t.k_monomial 54 | 55 | #: Type generator template for polynomials. 56 | polynomial = _t.polynomial 57 | 58 | #: Type generator template for monomials. 59 | monomial = _t.monomial 60 | 61 | #: Type generator template for Poisson series. 62 | poisson_series = _t.poisson_series 63 | 64 | #: Type generator template for divisors. 65 | divisor = _t.divisor 66 | 67 | #: Type generator template for divisor series. 68 | divisor_series = _t.divisor_series 69 | -------------------------------------------------------------------------------- /pyranha/utils.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #ifndef PYRANHA_UTILS_HPP 30 | #define PYRANHA_UTILS_HPP 31 | 32 | #include "python_includes.hpp" 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | namespace pyranha 39 | { 40 | 41 | namespace bp = boost::python; 42 | 43 | // Import and return the builtin module. 44 | inline bp::object builtin() 45 | { 46 | #if PY_MAJOR_VERSION < 3 47 | return bp::import("__builtin__"); 48 | #else 49 | return bp::import("builtins"); 50 | #endif 51 | } 52 | 53 | // Check if object has attribute. 54 | inline bool hasattr(const bp::object &o, const char *name) 55 | { 56 | return bp::extract(builtin().attr("hasattr")(o, name)); 57 | } 58 | 59 | // Get string representation. 60 | inline std::string str(const bp::object &o) 61 | { 62 | return bp::extract(builtin().attr("str")(o)); 63 | } 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /tests/demangle.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE demangle_test 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | using namespace piranha; 43 | 44 | struct base_foo { 45 | virtual void f() const {} 46 | virtual ~base_foo() {} 47 | }; 48 | 49 | struct foo : base_foo { 50 | }; 51 | 52 | namespace myns 53 | { 54 | 55 | template 56 | struct bar { 57 | }; 58 | } 59 | 60 | BOOST_AUTO_TEST_CASE(demangle_test) 61 | { 62 | // Likely not a valid mangled name. 63 | std::cout << demangle("helloworld!") << '\n'; 64 | std::cout << demangle("") << '\n'; 65 | std::cout << demangle(std::string("")) << '\n'; 66 | // A few valid types. 67 | std::cout << demangle() << '\n'; 68 | std::cout << demangle>() << '\n'; 69 | std::cout << demangle(std::type_index(typeid(std::vector{}))) << '\n'; 70 | std::cout << demangle(typeid(std::unordered_set{})) << '\n'; 71 | std::cout << demangle(typeid(std::unordered_set{}).name()) << '\n'; 72 | std::cout << demangle(std::string(typeid(std::unordered_set{}).name())) << '\n'; 73 | std::cout << demangle() << '\n'; 74 | std::cout << demangle() << '\n'; 75 | std::cout << demangle>() << '\n'; 76 | // Check with dynamic polymorphism. 77 | std::unique_ptr foo_ptr(new foo{}); 78 | auto ptr = foo_ptr.get(); 79 | BOOST_CHECK_EQUAL(demangle(typeid(*ptr)), demangle()); 80 | } 81 | -------------------------------------------------------------------------------- /tests/print_coefficient.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE print_coefficient_test 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | 41 | #include 42 | #if defined(MPPP_WITH_MPFR) 43 | #include 44 | #endif 45 | 46 | using namespace piranha; 47 | 48 | struct trivial { 49 | }; 50 | 51 | struct trivial_with_stream { 52 | }; 53 | 54 | std::ostream &operator<<(std::ostream &, const trivial_with_stream &); 55 | 56 | struct trivial_with_stream_wrong { 57 | }; 58 | 59 | std::ostream &operator<<(std::ostream &, trivial_with_stream &); 60 | 61 | BOOST_AUTO_TEST_CASE(print_coefficient_main_test) 62 | { 63 | std::ostringstream oss; 64 | print_coefficient(oss, 0); 65 | BOOST_CHECK_EQUAL(oss.str(), "0"); 66 | oss.str(""); 67 | print_coefficient(oss, integer(-5)); 68 | BOOST_CHECK_EQUAL(oss.str(), "-5"); 69 | oss.str(""); 70 | #if defined(MPPP_WITH_MPFR) 71 | print_coefficient(oss, real("1.2345", 23)); 72 | BOOST_CHECK_EQUAL(oss.str(), boost::lexical_cast(real("1.2345", 23))); 73 | #endif 74 | BOOST_CHECK((std::is_same::value)); 75 | BOOST_CHECK((std::is_same::value)); 76 | } 77 | 78 | BOOST_AUTO_TEST_CASE(print_coefficient_has_print_coefficient_test) 79 | { 80 | BOOST_CHECK(has_print_coefficient::value); 81 | BOOST_CHECK(has_print_coefficient::value); 82 | BOOST_CHECK(!has_print_coefficient::value); 83 | BOOST_CHECK(has_print_coefficient::value); 84 | BOOST_CHECK(!has_print_coefficient::value); 85 | } 86 | -------------------------------------------------------------------------------- /tests/runtime_info.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE runtime_info_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | 39 | using namespace piranha; 40 | 41 | BOOST_AUTO_TEST_CASE(runtime_info_print_test) 42 | { 43 | std::cout << "Concurrency: " << runtime_info::get_hardware_concurrency() << '\n'; 44 | std::cout << "Cache line size: " << runtime_info::get_cache_line_size() << '\n'; 45 | std::cout << "Memory alignment primitives: " 46 | << 47 | #if defined(PIRANHA_HAVE_MEMORY_ALIGNMENT_PRIMITIVES) 48 | "available\n"; 49 | #else 50 | "not available\n"; 51 | #endif 52 | } 53 | 54 | BOOST_AUTO_TEST_CASE(runtime_info_settings_test) 55 | { 56 | BOOST_CHECK(runtime_info::get_hardware_concurrency() == settings::get_n_threads() 57 | || runtime_info::get_hardware_concurrency() == 0u); 58 | BOOST_CHECK_EQUAL(runtime_info::get_cache_line_size(), settings::get_cache_line_size()); 59 | } 60 | -------------------------------------------------------------------------------- /tests/thread_barrier.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE thread_barrier_test 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | BOOST_AUTO_TEST_CASE(thread_barrier_test_01) 40 | { 41 | const unsigned n_threads = 100; 42 | piranha::thread_barrier tb(n_threads); 43 | piranha::thread_pool::resize(n_threads); 44 | piranha::future_list f_list; 45 | for (unsigned i = 0; i < n_threads; ++i) { 46 | BOOST_CHECK_NO_THROW(f_list.push_back(piranha::thread_pool::enqueue(i, std::bind( 47 | [&tb](unsigned x, unsigned y) { 48 | tb.wait(); 49 | (void)(x + y); 50 | }, 51 | i, i + 1)))); 52 | } 53 | BOOST_CHECK_NO_THROW(f_list.wait_all()); 54 | BOOST_CHECK_NO_THROW(f_list.wait_all()); 55 | BOOST_CHECK(!std::is_copy_assignable::value); 56 | BOOST_CHECK(!std::is_move_assignable::value); 57 | } 58 | -------------------------------------------------------------------------------- /tests/thread_management.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright 2009-2017 Francesco Biscani (bluescarni@gmail.com) 2 | 3 | This file is part of the Piranha library. 4 | 5 | The Piranha library is free software; you can redistribute it and/or modify 6 | it under the terms of either: 7 | 8 | * the GNU Lesser General Public License as published by the Free 9 | Software Foundation; either version 3 of the License, or (at your 10 | option) any later version. 11 | 12 | or 13 | 14 | * the GNU General Public License as published by the Free Software 15 | Foundation; either version 3 of the License, or (at your option) any 16 | later version. 17 | 18 | or both in parallel, as here. 19 | 20 | The Piranha library is distributed in the hope that it will be useful, but 21 | WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23 | for more details. 24 | 25 | You should have received copies of the GNU General Public License and the 26 | GNU Lesser General Public License along with the Piranha library. If not, 27 | see https://www.gnu.org/licenses/. */ 28 | 29 | #include 30 | 31 | #define BOOST_TEST_MODULE thread_management_test 32 | #include 33 | 34 | #include 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | static std::mutex mutex; 43 | 44 | static inline void test_function() 45 | { 46 | for (unsigned i = 0u; i < piranha::runtime_info::get_hardware_concurrency(); ++i) { 47 | piranha::bind_to_proc(i); 48 | const auto retval = piranha::bound_proc(); 49 | // Lock because Boost unit test is not thread-safe. 50 | std::lock_guard lock(mutex); 51 | BOOST_CHECK_EQUAL(retval.first, true); 52 | BOOST_CHECK_EQUAL(retval.second, i); 53 | } 54 | } 55 | 56 | BOOST_AUTO_TEST_CASE(thread_management_new_threads_bind) 57 | { 58 | for (unsigned i = 0u; i < piranha::runtime_info::get_hardware_concurrency(); ++i) { 59 | auto f = piranha::thread_pool::enqueue(i, []() { test_function(); }); 60 | f.wait(); 61 | try { 62 | f.get(); 63 | } catch (const piranha::not_implemented_error &) { 64 | // If we are getting a NIE it's good, it means the platform does not 65 | // support binding. 66 | } 67 | } 68 | } 69 | 70 | // Check thread-safe binding using thread_pool. 71 | BOOST_AUTO_TEST_CASE(thread_management_task_group_bind) 72 | { 73 | piranha::future_list f_list; 74 | for (unsigned i = 0u; i < piranha::runtime_info::get_hardware_concurrency(); ++i) { 75 | f_list.push_back(piranha::thread_pool::enqueue(0, []() { test_function(); })); 76 | } 77 | f_list.wait_all(); 78 | try { 79 | f_list.get_all(); 80 | } catch (const piranha::not_implemented_error &) { 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /tools/benchmark.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import numpy as np 3 | from scipy import stats 4 | import subprocess as sp 5 | import datetime 6 | import socket 7 | import os 8 | 9 | exec_name = sys.argv[1] 10 | max_t = int(sys.argv[2]) 11 | 12 | ntries = 5 13 | 14 | tot_timings = [] 15 | 16 | for t_idx in range(1,max_t + 1): 17 | cur_timings = [] 18 | for _ in range(ntries): 19 | # Run the process. 20 | p = sp.Popen([exec_name,str(t_idx)],stdout=sp.PIPE,stderr=sp.STDOUT) 21 | # Wait for it to finish and get stdout. 22 | out = p.communicate()[0] 23 | # Parse the stderr in order to find the time. 24 | out = out.split(bytes('\n','ascii'))[1].split()[0][0:-1] 25 | cur_timings.append(float(out)) 26 | tot_timings.append(cur_timings) 27 | 28 | tot_timings = np.array(tot_timings) 29 | 30 | retval = np.array([np.mean(tot_timings,axis=1),stats.sem(tot_timings,axis=1)]) 31 | 32 | fmt='{fname}_%Y%m%d%H%M%S' 33 | filename = datetime.datetime.now().strftime(fmt).format(fname=socket.gethostname() + '_' + os.path.basename(exec_name)) + '.txt' 34 | np.savetxt(filename,retval) 35 | -------------------------------------------------------------------------------- /tools/install_deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Echo each command 4 | set -x 5 | 6 | # Exit on error 7 | set -e 8 | 9 | if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then 10 | wget https://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-x86_64.sh -O miniconda.sh; 11 | else 12 | wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh; 13 | fi 14 | 15 | export deps_dir=$HOME/local 16 | export PATH="$HOME/miniconda/bin:$PATH" 17 | 18 | bash miniconda.sh -b -p $HOME/miniconda 19 | conda config --add channels conda-forge --force 20 | 21 | conda_pkgs="cmake boost-cpp bzip2 zlib msgpack-c mppp" 22 | 23 | if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then 24 | conda_pkgs="$conda_pkgs backtrace" 25 | fi 26 | 27 | if [[ "${PIRANHA_BUILD}" == "Documentation" ]]; then 28 | conda_pkgs="$conda_pkgs pip python=3" 29 | fi 30 | 31 | conda create -q -p $deps_dir -y $conda_pkgs 32 | source activate $deps_dir 33 | 34 | set +e 35 | set +x 36 | -------------------------------------------------------------------------------- /tools/sample_project/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.3.0) 2 | 3 | project(sample_project) 4 | 5 | find_package(piranha REQUIRED) 6 | 7 | add_executable(main main.cpp) 8 | target_link_libraries(main piranha::piranha) 9 | set_property(TARGET main PROPERTY CXX_STANDARD 11) 10 | set_property(TARGET main PROPERTY CXX_STANDARD_REQUIRED YES) 11 | set_property(TARGET main PROPERTY CXX_EXTENSIONS NO) 12 | -------------------------------------------------------------------------------- /tools/sample_project/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace piranha; 4 | 5 | int main() 6 | { 7 | using p_type = polynomial>; 8 | p_type x{"x"}; 9 | save_file(x, "tmp.mpackp.bz2"); 10 | } 11 | --------------------------------------------------------------------------------