Skip to content

Commit 58ff626

Browse files
authored
refactor: small structural changes to the library (#70)
1 parent e8433b8 commit 58ff626

File tree

13 files changed

+894
-862
lines changed

13 files changed

+894
-862
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
3333
- name: Compile Docs Test Program
3434
working-directory: ${{env.test-directory}}
35-
run: g++ --std=c++17 test.cpp -o test -lmpfr -lgmp
35+
run: g++ -DUSEMPFR=1 --std=c++17 test.cpp -o test -lmpfr -lgmp
3636

3737
- name: Execute Test Program
3838
working-directory: ${{env.test-directory}}

.github/workflows/unit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959

6060
- name: Compile Test Program
6161
working-directory: ${{env.working-directory}}
62-
run: g++ -O0 -fprofile-arcs -ftest-coverage -fno-elide-constructors -Wall --std=c++17 --coverage -o test test.cpp -lmpfr -lgmp
62+
run: g++ -DUSEMPFR=1 -O0 -fprofile-arcs -ftest-coverage -fno-elide-constructors -Wall --std=c++17 --coverage -o test test.cpp -lmpfr -lgmp
6363

6464
- name: Execute Test Program
6565
working-directory: ${{env.working-directory}}
@@ -107,7 +107,7 @@ jobs:
107107

108108
- name: Compile Test Program
109109
working-directory: ${{env.working-directory}}
110-
run: g++ -O0 -Wall --std=c++17 -o test test.cpp -lmpfr -lgmp
110+
run: g++ -DUSEMPFR=1 -O0 -Wall --std=c++17 -o test test.cpp -lmpfr -lgmp
111111

112112
- name: Analyze Test Program Exec
113113
working-directory: ${{env.working-directory}}

.github/workflows/user.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ jobs:
1818
- name: Display Compiler Version
1919
run: g++ --version
2020

21-
- name: Install MPFR
22-
run: |
23-
if [ "$RUNNER_OS" == "Linux" ]; then
24-
sudo apt-get update -y
25-
sudo apt-get install -y libmpfr-dev
26-
elif [ "$RUNNER_OS" == "macOS" ]; then
27-
brew update
28-
brew install mpfr
29-
fi
30-
3121
- name: Checkout Repository
3222
uses: actions/checkout@v3
3323

@@ -37,7 +27,7 @@ jobs:
3727

3828
- name: Compile Test Program
3929
working-directory: ${{env.working-directory}}
40-
run: g++ --std=c++17 test.cpp -o test -lmpfr -lgmp
30+
run: g++ --std=c++17 test.cpp -o test
4131

4232
- name: Execute Test Program
4333
working-directory: ${{env.working-directory}}
@@ -57,16 +47,6 @@ jobs:
5747
- name: Display Compiler Version
5848
run: g++ --version
5949

60-
- name: Install MPFR
61-
run: |
62-
if [ "$RUNNER_OS" == "Linux" ]; then
63-
sudo apt-get update -y
64-
sudo apt-get install -y libmpfr-dev
65-
elif [ "$RUNNER_OS" == "macOS" ]; then
66-
brew update
67-
brew install mpfr
68-
fi
69-
7050
- name: Checkout Repository
7151
uses: actions/checkout@v3
7252

@@ -75,7 +55,7 @@ jobs:
7555

7656
- name: Compile Test Program
7757
working-directory: ${{env.test-directory}}
78-
run: g++ --std=c++17 test.cpp -o test -lmpfr -lgmp
58+
run: g++ --std=c++17 test.cpp -o test
7959

8060
- name: Execute Test Program
8161
working-directory: ${{env.test-directory}}
@@ -123,7 +103,7 @@ jobs:
123103

124104
- name: Compile Test Program
125105
shell: bash -l {0}
126-
run: g++ --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib .test/install/test.cpp -o test -lmpfr -lgmp
106+
run: g++ --std=c++17 -I$CONDA_PREFIX/include .test/install/test.cpp -o test
127107

128108
- name: Execute Test Program
129109
shell: bash -l {0}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [v2.0.14] - 2023-08-05
9+
### :memo: Documentation Changes
10+
- [`e8433b8`](https://github.com/AngryMaciek/hypercomplex/commit/e8433b8ac00ebf71a6406bb8836a3c44e9010652) - docs: clean changelog/dev/docs *(PR [#69](https://github.com/AngryMaciek/hypercomplex/pull/69) by [@AngryMaciek](https://github.com/AngryMaciek))*
11+
12+
813
## [v2.0.13] - 2023-08-03
914
### :bug: Bug Fixes
1015
- [`b3ee0dd`](https://github.com/AngryMaciek/hypercomplex/commit/b3ee0dd58feef4e7793afc452e1e5e6f3ebe13e9) - adjust conda pkg options *(PR [#68](https://github.com/AngryMaciek/hypercomplex/pull/68) by [@AngryMaciek](https://github.com/AngryMaciek))*
@@ -23,3 +28,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2328
[v2.0.11]: https://github.com/AngryMaciek/hypercomplex/compare/v2.0.10...v2.0.11
2429
[v2.0.12]: https://github.com/AngryMaciek/hypercomplex/compare/v2.0.11...v2.0.12
2530
[v2.0.13]: https://github.com/AngryMaciek/hypercomplex/compare/v2.0.12...v2.0.13
31+
[v2.0.14]: https://github.com/AngryMaciek/hypercomplex/compare/v2.0.13...v2.0.14

Doxyfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ WARN_LOGFILE =
909909
# Note: If this tag is empty the current directory is searched.
910910

911911
INPUT = hypercomplex/Hypercomplex.hpp \
912+
hypercomplex/Hypercomplex_MPFR.hpp \
912913
hypercomplex/Polynomial.hpp \
913914
docs/mainpage.dox
914915

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
###############################################################################
1111

1212
SRC1 = Hypercomplex.hpp
13-
SRC2 = Polynomial.hpp
13+
SRC2 = Hypercomplex_MPFR.hpp
14+
SRC3 = Polynomial.hpp
1415

1516
UNAME_S := $(shell uname -s)
1617
ifeq ($(UNAME_S),Linux)
@@ -42,7 +43,7 @@ help:
4243
# Install
4344
# =============================================================================
4445

45-
install: $(INCLUDE_PREFIX)/Hypercomplex/$(SRC1) $(INCLUDE_PREFIX)/Hypercomplex/$(SRC2)
46+
install: $(INCLUDE_PREFIX)/Hypercomplex/$(SRC1) $(INCLUDE_PREFIX)/Hypercomplex/$(SRC2) $(INCLUDE_PREFIX)/Hypercomplex/$(SRC3)
4647

4748
# Create a separate directory for the header-only library
4849
$(INCLUDE_PREFIX)/Hypercomplex:
@@ -52,10 +53,14 @@ $(INCLUDE_PREFIX)/Hypercomplex:
5253
$(INCLUDE_PREFIX)/Hypercomplex/$(SRC1): hypercomplex/$(SRC1) $(INCLUDE_PREFIX)/Hypercomplex
5354
@cp $< $@
5455

55-
# Copy the helper library file into the right directory
56+
# Copy the class specialisation file into the right directory
5657
$(INCLUDE_PREFIX)/Hypercomplex/$(SRC2): hypercomplex/$(SRC2) $(INCLUDE_PREFIX)/Hypercomplex
5758
@cp $< $@
5859

60+
# Copy the helper library file into the right directory
61+
$(INCLUDE_PREFIX)/Hypercomplex/$(SRC3): hypercomplex/$(SRC3) $(INCLUDE_PREFIX)/Hypercomplex
62+
@cp $< $@
63+
5964
# =============================================================================
6065
# Uninstall
6166
# =============================================================================
@@ -72,8 +77,9 @@ uninstall:
7277
test:
7378
@mkdir .test/unit/hypercomplex
7479
@cp hypercomplex/Hypercomplex.hpp .test/unit/hypercomplex/Hypercomplex.hpp
80+
@cp hypercomplex/Hypercomplex_MPFR.hpp .test/unit/hypercomplex/Hypercomplex_MPFR.hpp
7581
@cp hypercomplex/Polynomial.hpp .test/unit/hypercomplex/Polynomial.hpp
76-
@g++ -O0 -Wall --std=c++17 -o test .test/unit/test.cpp -lmpfr -lgmp
82+
@g++ -DUSEMPFR=1 -O0 -Wall --std=c++17 -o test .test/unit/test.cpp -lmpfr -lgmp
7783
@./test [unit] -d yes -w NoAssertions --use-colour yes --benchmark-samples 100 --benchmark-resamples 100000
7884
@rm -rf .test/unit/hypercomplex test
7985

@@ -84,6 +90,7 @@ test:
8490
# Run static code analysis
8591
lint:
8692
@cpplint hypercomplex/Hypercomplex.hpp
93+
@cpplint hypercomplex/Hypercomplex_MPFR.hpp
8794
@cpplint hypercomplex/Polynomial.hpp
8895

8996
# =============================================================================

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[![CodeFactor](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex/badge)](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex)
99
[![publish](https://github.com/AngryMaciek/hypercomplex/workflows/publish/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Apublish)
1010
[![conda](https://anaconda.org/angrymaciek/hypercomplex/badges/version.svg)](https://anaconda.org/AngryMaciek/hypercomplex)
11-
[![DockerHub](https://badgen.net/badge/icon/2.0.14/docker?icon=docker&label=DockerHub&color=blue)](https://hub.docker.com/r/angrymaciek/hypercomplex)
11+
[![DockerHub](https://badgen.net/badge/icon/2.0.15/docker?icon=docker&label=DockerHub&color=blue)](https://hub.docker.com/r/angrymaciek/hypercomplex)
1212
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05272/status.svg)](https://doi.org/10.21105/joss.05272)
1313

1414
<img src="img/logo.png" alt="drawing" height="30"/>

docs/DoxygenLayout.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<tab type="mainpage" visible="yes" title=""/>
66
<tab type="usergroup" title="File Reference">
77
<tab type="user" url="_hypercomplex_8hpp.html" title="Hypercomplex"/>
8+
<tab type="user" url="_hypercomplex___m_p_f_r_8hpp.html" title="Hypercomplex_MPFR"/>
89
<tab type="user" url="_polynomial_8hpp.html" title="Polynomial"/>
910
</tab>
1011
</navindex>

docs/mainpage.dox

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,21 @@
1616
*
1717
* \section install_sec Installation
1818
*
19-
* As a prerequisite it is essential to install the
19+
* The following is a _header-only_ library, meaning that the easiest way to use it
20+
* is to copy the core _hpp_ files alongside your main program and include it into the code
21+
* with the directive:
22+
* \code{.cpp}
23+
* #include "Hypercomplex.hpp"
24+
* \endcode
25+
*
26+
* Remember to specify a proper langauge standard and optimisation level
27+
* for the compiler, as in the command below:
28+
* \code
29+
* g++ -O2 --std=c++17 main.cpp -o main
30+
* \endcode
31+
*
32+
* For computations based on high precision arithmetics
33+
* it is essential to install the
2034
* <a href="https://www.mpfr.org/">MPFR library</a> first.
2135
* This should be rather straightforward with the following commands:
2236
* \code
@@ -29,20 +43,13 @@
2943
* brew install mpfr
3044
* \endcode
3145
*
32-
* The following is a _header-only_ library, meaning that the easiest way to use it
33-
* is to copy the core _hpp_ file alongside the main program and include it into the code
34-
* with the directive:
35-
* \code{.cpp}
36-
* #include "Hypercomplex.hpp"
37-
* \endcode
38-
*
39-
* Remember to specify a proper langauge standard for the compiler as well as
40-
* linking with _GNU MP_ and _GNU MPFR_ libraries, as in the command below:
46+
* It is then essential to provide a preprocessor macro specifying the
47+
* use of this library at the compile time as well as
48+
* linking with _GNU MP_ and _GNU MPFR_ as in the command below:
4149
* \code
42-
* g++ -O2 --std=c++17 test.cpp -o test -lmpfr -lgmp
50+
* g++ -O2 -DUSEMPFR=1 --std=c++17 main.cpp -o main -lmpfr -lgmp
4351
* \endcode
4452
*
45-
*
4653
* Alternatively, if you work with conda environments this library is installable with:
4754
* \code
4855
* conda install -c angrymaciek hypercomplex
@@ -53,7 +60,7 @@
5360
*
5461
* The command above would be adjusted to:
5562
* \code
56-
* g++ -O2 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib test.cpp -o test -lmpfr -lgmp
63+
* g++ -O2 -DUSEMPFR=1 --std=c++17 -I$CONDA_PREFIX/include -L$CONDA_PREFIX/lib main.cpp -o main -lmpfr -lgmp
5764
* \endcode
5865
*
5966
*

0 commit comments

Comments
 (0)