Kernel: Bash (Linux)
Install Discreture
The aim is to install Discreture, a modern C++ library for efficiently and easily iterating through common combinatorial objects, such as combinations, subsets, partitions and more.
The code repository for Discreture is at: https://github.com/mraggi/discreture
Step by step
Boost prerequisites
Check that Boost is present:
In [1]:
boost
In Boost we need iterator functions:
In [2]:
function_output_iterator.hpp
generator_iterator.hpp
iterator
iterator.hpp
iterator_adaptors.hpp
shared_container_iterator.hpp
token_iterator.hpp
More specifically, we need Boost's facade iterator:
In [3]:
iterator_facade.hpp
All Boost prerequisistes are there. Let us proceed.
Clone the github repo
In [4]:
Cloning into 'discreture'...
remote: Counting objects: 1849, done.
remote: Compressing objects: 100% (253/253), done.
remote: Total 1849 (delta 237), reused 232 (delta 117), pack-reused 1477
Receiving objects: 100% (1849/1849), 2.77 MiB | 0 bytes/s, done.
Resolving deltas: 100% (1260/1260), done.
Checking connectivity... done.
In [5]:
In [6]:
Benchmarks README.md cppcheck-helper.sh logoterelimpio.pdf
CMakeLists.txt clang-tidy-helper.sh examples logoterelimpio.png
LICENSE cmake include logoterelimpio.svg
PKGBUILD combvsgsl.png logotere.svg tests
In [7]:
In [8]:
Here we use the flag -DCMAKE_INSTALL_PREFIX=/home/user
.
When installing as root, remove this, and the installation will go to /usr/local
.
In [16]:
-- Boost version: 1.58.0
Installing to /home/user
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/discreture/build
In [17]:
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 16%] Built target combinations_reverse
[ 16%] Built target multisets
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 33%] Built target combinations_tree_reverse
[ 33%] Built target combinations_tree
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 50%] Built target combinations
[ 50%] Built target setpartitions
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 66%] Built target dyck
[ 66%] Built target permutations
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 75%] Built target number_range
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 83%] Built target discreture_benchmark
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 91%] Built target partitions
[100%] Built target motzkin
In [18]:
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 8%] Built target combinations_reverse
[ 16%] Built target multisets
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 25%] Built target combinations_tree
[ 33%] Built target combinations_tree_reverse
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 41%] Built target setpartitions
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 50%] Built target combinations
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 58%] Built target dyck
[ 66%] Built target permutations
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 75%] Built target number_range
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 83%] Built target discreture_benchmark
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
make[2]: warning: -jN forced in submake: disabling jobserver mode.
[ 91%] Built target partitions
[100%] Built target motzkin
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /home/user/include
-- Installing: /home/user/include/Discreture
-- Installing: /home/user/include/Discreture/CombinationsTree.hpp
-- Installing: /home/user/include/Discreture/NaturalNumber.hpp
-- Installing: /home/user/include/Discreture/TimeHelpers.hpp
-- Installing: /home/user/include/Discreture/NumberRange.hpp
-- Installing: /home/user/include/Discreture/old
-- Installing: /home/user/include/Discreture/old/oldstuff.hpp
-- Installing: /home/user/include/Discreture/Misc.hpp
-- Installing: /home/user/include/Discreture/VectorHelpers.hpp
-- Installing: /home/user/include/Discreture/Partitions.hpp
-- Installing: /home/user/include/Discreture/combinations_tree_bf.hpp
-- Installing: /home/user/include/Discreture/SetPartitions.hpp
-- Installing: /home/user/include/Discreture/Combinations.hpp
-- Installing: /home/user/include/Discreture/DyckPaths.hpp
-- Installing: /home/user/include/Discreture/Probability.hpp
-- Installing: /home/user/include/Discreture/Permutations.hpp
-- Installing: /home/user/include/Discreture/Multisets.hpp
-- Installing: /home/user/include/Discreture/combinations_bf.hpp
-- Installing: /home/user/include/Discreture/Sequences.hpp
-- Installing: /home/user/include/Discreture/Motzkin.hpp
-- Installing: /home/user/include/Discreture/CombinationsTreePrunned.hpp
-- Installing: /home/user/include/discreture.hpp
Check that the result whas installed where we asked.
When installing as root, we would instead run:
In [24]:
Discreture discreture.hpp
Everything went well. Done.
Running an example
In [27]:
In [28]:
In [29]:
CMakeCache.txt combinations_tree multisets
CMakeFiles combinations_tree_reverse number_range
Makefile discreture_benchmark partitions
cmake_install.cmake dyck permutations
combinations install_manifest.txt setpartitions
combinations_reverse motzkin
In [30]:
0 1 2
0 1 3
0 2 3
1 2 3
0 1 4
0 2 4
1 2 4
0 3 4
1 3 4
2 3 4
0 1 5
0 2 5
1 2 5
0 3 5
1 3 5
2 3 5
0 4 5
1 4 5
2 4 5
3 4 5
This looks fine.