diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..8cfed98e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,58 @@ +# Normalise line endings automatically for files detected as text by default. +# That is: let the git installation on a user's machine decide +# which line ending to use when a repository is checked out. +# Subsequent lines may override this setting. +* text=auto + +# recognise file syntax during diff +*.hpp text diff=cpp +*.cpp text diff=cpp +*.tex text diff=tex +*.bib text diff=bibtex +*.md text diff=markdown +*.sh text diff=bash + +# force batch scripts to always use CRLF +*.cmd text eol=crlf +*.bat text eol=crlf + +# force bash scripts & Makefile to always use LF +*.sh text eol=lf +Makefile text eol=lf + +# mark binary files explicitly +# (Git does not try to merge these files) +# binary is a built-in macro attribute == -diff -merge -text +*.png binary + +# specify which files/dirs to ignore on [download ZIP] (not a git repo) +.github export-ignore +.test export-ignore +.docs export-ignore +img export-ignore +.gitattributes export-ignore +.gitignore export-ignore +.gitpod.dockerfile export-ignore +.gitpod.yml export-ignore +.pre-commit-config.yaml export-ignore +CODE_OF_CONDUCT.md export-ignore +codecov.yml export-ignore +CODEOWNERS export-ignore +CONTRIBUTING.md export-ignore +Doxyfile export-ignore +environment.yml export-ignore +meta.yaml export-ignore +paper.bib export-ignore +paper.md export-ignore + +# linguist settings: +# +# Gitpod configuration files +.gitpod.dockerfile -linguist-detectable +.gitpod.yml -linguist-detectable +# Dev Docker/env +Dockerfile -linguist-detectable +entrypoint.sh -linguist-detectable +environment.yml -linguist-detectable +# Catch2 test framework +.test/unit/catch.hpp -linguist-detectable diff --git a/.github/ISSUE_TEMPLATE/BLANK_TEMPLATE.yml b/.github/ISSUE_TEMPLATE/BLANK_TEMPLATE.yml new file mode 100644 index 00000000..a5a05bd3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BLANK_TEMPLATE.yml @@ -0,0 +1,5 @@ +--- +name: "Blank Template ๐Ÿ’ฌ" +about: Empty template for special occasions only +labels: +--- diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT_TEMPLATE.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT_TEMPLATE.yml new file mode 100644 index 00000000..4c2a2bbd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT_TEMPLATE.yml @@ -0,0 +1,92 @@ +name: Bug Report ๐Ÿ› +description: Create a bug report +title: "" +labels: [bug] +body: + - type: markdown + attributes: + value: | + Thank you for your interest in this project! + + Please read the following instructions carefully. + Having detailed, yet not overcomplicated feedback will help us resolve the issue efficiently ๐Ÿš€ + + **Before reporting a bug, please search for a similar problem in the issues section** + - type: checkboxes + id: checks + attributes: + label: Initial check. + description: Please go through the options carefully. + options: + - label: I added a very descriptive title above. + required: true + - label: I searched through the issues in this repository to find a similar problem, but didn't find any. + required: true + - label: I searched the documentation and found no explanation. + required: true + - label: I searched through Google (including the 2nd page of results) and didn't find any relevant information. + required: true + - label: I asked ChatGPT for help but did not get any meaningful response. + required: false + - type: textarea + id: description + attributes: + label: Please describe what triggered the error. + description: Add a self-contained, [minimal, reproducible, example](https://stackoverflow.com/help/minimal-reproducible-example) with your use case. + placeholder: If you can copy it, run it, and see it right away, there's a much higher chance someone will be able to help you. + validations: + required: true + - type: textarea + id: expected + attributes: + label: What did you expect to happen? + description: How should the program behave without the bug? + placeholder: Describe the ideal outcome. + validations: + required: true + - type: textarea + id: error + attributes: + label: What went wrong? + description: What kind of error message did you get? + placeholder: You should add terminal logs. + validations: + required: true + - type: input + id: gpp_version + attributes: + label: Please specify your compiler's version. + placeholder: g++ --version + validations: + required: true + - type: dropdown + id: os_version + attributes: + label: Operating System + options: + - Linux + - macOS + - Microsoft Windows + - Other + validations: + required: true + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + options: + - label: I agree to follow this project's [Code of Conduct](https://github.com/AngryMaciek/hypercomplex/blob/master/CODE_OF_CONDUCT.md) + required: true + - type: textarea + id: context + attributes: + label: Additional information + description: Add any additional context or screenshots you think might be useful or helpful. + validations: + required: false + - type: markdown + attributes: + value: | + + + *Thank you for your contribution!* diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.yml new file mode 100644 index 00000000..88670b3e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.yml @@ -0,0 +1,71 @@ +name: Feature Request ๐Ÿ’ก +description: Suggest an idea for improvement +title: "" +labels: + - enhancement +body: + - type: markdown + attributes: + value: | + Thank you for your interest in this project! + + Please read the following instructions carefully. + Having detailed, yet not overcomplicated feedback will help us implement the idea efficiently ๐Ÿš€ + + **Before suggesting an idea, please search for a similar feature request in the issues section** + - type: checkboxes + id: checks + attributes: + label: Initial check. + description: Please go through the options carefully. + options: + - label: I added a very descriptive title above. + required: true + - label: I searched the documentation and found no similar feature. + required: true + - label: I searched through the issues in this repository to find a similar request, but didn't find any. + required: true + - type: textarea + id: description + attributes: + label: Describe briefly the idea behind the improvement. + description: When would it be useful? What problem would it solve? + placeholder: Try to come up with a use case + validations: + required: true + - type: textarea + id: ideas + attributes: + label: Please specify what would you like to add/change. + description: How would you make your idea come true? + placeholder: You may inclue code snippets + validations: + required: true + - type: textarea + id: alternatives + attributes: + label: Please add other solutions if you considered them. + description: Alternative ways to bring your idea to life. + placeholder: First thought best thought? + validations: + required: false + - type: textarea + id: supplement + attributes: + label: Feel free to provide additional information or more context for your idea. + description: Screenshots or other information you find worth sharing; anything the developers might find useful. + placeholder: + validations: + required: false + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this feature request, you agree to follow our Code of Conduct. + options: + - label: I agree to follow this project's [Code of Conduct](https://github.com/AngryMaciek/hypercomplex/blob/master/CODE_OF_CONDUCT.md) + required: true + - type: markdown + attributes: + value: | + *Keep the ideas coming!* diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea78..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..a58a4397 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,4 @@ +blank_issues_enabled: false +contact_links: + - name: Security or Code of Conduct violation + about: Please report security or behaviour issues to wsciekly.maciek@gmail.com diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..8496d9f6 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,32 @@ +## Proposed changes โคด๏ธ + +Describe the big picture of your changes, add relevant motivation and context. + +**If it fixes a bug or resolves a feature request, please link a corresponding issue:** +Fixes # + +## Types of changes ๐Ÿ”ง + +What type of changes does your code introduce to the project? + +- [ ] Bugfix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Other + +## Checklist โœ… + +If you're unsure about any of those below, ask explicitly. +This is simply a reminder of what needs to be checked before merging your code. + +- [ ] I have read the [CONTRIBUTING](https://github.com/AngryMaciek/hypercomplex/blob/master/CONTRIBUTING.md). +- [ ] I have performed a self-review of my own code. +- [ ] Tests specified with the 'make' framework do not raise any errors. +- [ ] I have added tests that prove my fix is effective or that my feature works. +- [ ] I have added necessary documentation (if appropriate). +- [ ] My changes generate no new warnings. +- [ ] I have commented my code, particularly in hard-to-understand areas. + +## Further comments ๐Ÿง  + +If this is a relatively large or complex change feel free to provide additional information or explanation. diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 00000000..fd4660b7 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,90 @@ +name: pr + +on: + # By default, a workflow only runs when a pull_request's activity type + # is opened, synchronize, or reopened. We explicity override here so that + # PR titles are re-linted when the PR text content is edited. + # _target applies to PR from forks. + pull_request_target: + types: [opened, edited, reopened, synchronize] + +jobs: + + size-label: + runs-on: ubuntu-22.04 + + steps: + + - uses: pascalgn/size-label-action@v0.4.3 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + with: + sizes: > + { + "0": "XS", + "25": "S", + "150": "M", + "500": "L", + "1000": "XL" + } + + conventional-title: + runs-on: ubuntu-22.04 + + steps: + + - uses: morrisoncole/pr-lint-action@v1.7.0 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + title-regex: "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore): .{1,}" + on-failed-regex-fail-action: true + on-failed-regex-create-review: true + on-failed-regex-request-changes: true + on-failed-regex-comment: + "Please stick to Conventional Commits syntax for PR titles ;)" + on-succeeded-regex-dismiss-review-comment: + "Thank you <3" + + version-bump-label: + runs-on: ubuntu-22.04 + env: + LABEL: "" + + steps: + + - name: Checkout Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + token: ${{ secrets.CHANGELOG_TOKEN }} + + - name: Check version bump + run: | + GIT='git --git-dir='$PWD'/.git' + NEW_COMMIT_VERSION="$(cat hypercomplex/VERSION | grep -oE '[0-9.]+')" + $GIT checkout HEAD~1 + PREVIOUS_COMMIT_VERSION="$(cat hypercomplex/VERSION | grep -oE '[0-9.]+')" + $GIT checkout - + if [[ "$NEW_COMMIT_VERSION" !== "$PREVIOUS_COMMIT_VERSION" ]] + then + IFS='.' read -r NEW_MAJOR NEW_MINOR NEW_PATCH <<< "$NEW_COMMIT_VERSION" + IFS='.' read -r PREVIOUS_MAJOR PREVIOUS_MINOR PREVIOUS_PATCH <<< "$PREVIOUS_COMMIT_VERSION" + if [[ "$NEW_PATCH" != "$PREVIOUS_PATCH" ]] + then + echo "LABEL=release:patch" >> $GITHUB_ENV + fi + if [[ "$NEW_MINOR" != "$PREVIOUS_MINOR" ]] + then + echo "LABEL=release:minor" >> $GITHUB_ENV + fi + if [[ "$NEW_MAJOR" != "$PREVIOUS_MAJOR" ]] + then + echo "LABEL=release:major" >> $GITHUB_ENV + fi + fi + + - name: Add version bump label + if: ${{env.LABEL != ''}} + uses: actions-ecosystem/action-add-labels@v1 + with: + labels: "${{ env.LABEL }}" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d5c8092f..6dac14cd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,14 +1,12 @@ name: publish on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + release: + types: [published] jobs: gh-pages: - runs-on: ubuntu-22.04 env: test-directory: .test/docs @@ -81,7 +79,7 @@ jobs: - name: Render version into the build recipe shell: bash -l {0} run: | - VERSION=$( h(A); + double A[] = {0.0}; + Hypercomplex h(A); return 0; } diff --git a/.test/install/test.cpp b/.test/install/test.cpp index 77eb2c88..95092dee 100644 --- a/.test/install/test.cpp +++ b/.test/install/test.cpp @@ -15,7 +15,7 @@ #include int main(void){ - double A[] = {1.0, 2.0, 0.0, -1.0}; - Hypercomplex h(A); + double A[] = {0.0}; + Hypercomplex h(A); return 0; } diff --git a/LICENSE b/LICENSE index 9055785d..00b8b0e9 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2020 Maciej Bak + Copyright 2020 Maciek Bak Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -198,4 +198,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 7728aa4c..00000000 --- a/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,24 +0,0 @@ -## Description - -Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - -Fixes # (issue) - -## Type of change - -Please delete options that are not relevant. - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) -- [ ] Documentation updated - -## Checklist: - -- [ ] My code follows the style guidelines of this project -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas -- [ ] My changes generate no new warnings -- [ ] I have added tests that prove my fix is effective or that my feature works -- [ ] New and existing unit tests pass locally with my changes -- [ ] I have not reduced the existing code coverage \ No newline at end of file diff --git a/README.md b/README.md index 259b2f07..d972b3a5 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ [![CodeFactor](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex/badge)](https://www.codefactor.io/repository/github/angrymaciek/hypercomplex) [![publish](https://github.com/AngryMaciek/hypercomplex/workflows/publish/badge.svg)](https://github.com/AngryMaciek/hypercomplex/actions?query=workflow%3Apublish) [![conda](https://anaconda.org/angrymaciek/hypercomplex/badges/version.svg)](https://anaconda.org/AngryMaciek/hypercomplex) -[![DockerHub](https://badgen.net/badge/icon/2.0.6/docker?icon=docker&label=DockerHub&color=blue)](https://hub.docker.com/r/angrymaciek/capsule) +[![DockerHub](https://badgen.net/badge/icon/2.0.7/docker?icon=docker&label=DockerHub&color=blue)](https://hub.docker.com/r/angrymaciek/capsule) [![DOI](https://joss.theoj.org/papers/10.21105/joss.05272/status.svg)](https://doi.org/10.21105/joss.05272) drawing diff --git a/VERSION b/VERSION deleted file mode 100644 index 52dbd825..00000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -v2.0.6 \ No newline at end of file diff --git a/environment.yml b/environment.yml index 00868ee3..398f03ab 100644 --- a/environment.yml +++ b/environment.yml @@ -23,5 +23,6 @@ - make=4.3 - mpfr=4.2.0 - pre-commit=3.2.1 + - valgrind=3.20.0 ... diff --git a/hypercomplex/Hypercomplex.hpp b/hypercomplex/Hypercomplex.hpp index f20f4aef..3d03c9a1 100644 --- a/hypercomplex/Hypercomplex.hpp +++ b/hypercomplex/Hypercomplex.hpp @@ -1,11 +1,11 @@ -// Copyright 2020 +// Copyright 2020 /*! \file */ /* ############################################################################### # # Hypercomplex header-only library. # -# AUTHOR: Maciej_Bak +# AUTHOR: Maciek_Bak # AFFILIATION: Department_of_Mathematics_City_University_of_London # CONTACT: wsciekly.maciek@gmail.com # CREATED: 22-10-2020 @@ -118,7 +118,7 @@ class Hypercomplex { /** \brief This is the main constructor * \param [in] ARR array of numbers - * + * * Template parameters are: * * base type of numbers in the argument array * * dimensionality of the algebra @@ -127,7 +127,7 @@ class Hypercomplex { /** \brief This is the copy constructor * \param [in] H existing class instance - * + * * Template parameters are: * * base type of numbers in the argument array * * dimensionality of the algebra @@ -145,7 +145,7 @@ class Hypercomplex { /** \brief Calculate Euclidean norm of a number * \return calculated norm - * + * * Note that the return type is the same as * template parameter. */ @@ -158,7 +158,7 @@ class Hypercomplex { /** \brief Cast a number into a higher dimension * \return new class instance - * + * * New dimension is passed as a function template parameter, * as the return class is not the same as the caller's class. */ @@ -184,7 +184,7 @@ class Hypercomplex { /** \brief Access operator (const) * \param [in] i index for the element to access * \return i-th element of the number - * + * * Note that the return type is the same as * template parameter. */ @@ -193,7 +193,7 @@ class Hypercomplex { /** \brief Access operator (non-const) * \param [in] i index for the element to access * \return i-th element of the number - * + * * Note that the return type is the same as * template parameter. */ @@ -785,7 +785,7 @@ class Hypercomplex { /** \brief This is the main constructor * \param [in] ARR array of MPFR numbers - * + * * Template parameters are: * * dimensionality of the algebra */ @@ -806,7 +806,7 @@ class Hypercomplex { /** \brief This is the copy constructor * \param [in] H existing class instance - * + * * Template parameters are: * * dimensionality of the algebra */ @@ -832,7 +832,7 @@ class Hypercomplex { /** \brief Calculate Euclidean norm of a number * \param [in,out] norm MPFR variable for the calculated norm * \return exit status - * + * * Note that the interface of this method is different * than for the fully template class. * Following the MPFR logic: function takes as an @@ -884,7 +884,7 @@ class Hypercomplex { /** \brief Cast a number into a higher dimension * \return new class instance - * + * * New dimension is passed as a function template parameter, * as the return class is not the same as the caller's class. */ @@ -1362,7 +1362,7 @@ class Hypercomplex, dim> { /** \brief This is the main constructor * \param [in] ARR array of Polynomial instances - * + * * Template parameters are: * * dimensionality of the algebra */ @@ -1380,7 +1380,7 @@ class Hypercomplex, dim> { /** \brief This is the copy constructor * \param [in] H existing class instance - * + * * Template parameters are: * * dimensionality of the algebra */ @@ -1416,7 +1416,7 @@ class Hypercomplex, dim> { /** \brief Cast a number into a higher dimension * \return new class instance - * + * * New dimension is passed as a function template parameter, * as the return class is not the same as the caller's class. */ diff --git a/hypercomplex/Makefile b/hypercomplex/Makefile index ae8c2866..21c5509d 100644 --- a/hypercomplex/Makefile +++ b/hypercomplex/Makefile @@ -1,7 +1,7 @@ # # Makefile for installation & development of the library. # -# Maciej Bak +# Maciek Bak # Department of Mathematics, City University of London # 22.10.2019 # @@ -84,7 +84,7 @@ lint: # Docs # ========================================================= -# Generate doxygen documentation +# Generate doxygen documentation docs: cd ..; \ doxygen Doxyfile diff --git a/hypercomplex/Polynomial.hpp b/hypercomplex/Polynomial.hpp index 7c7f433f..3f3a7890 100644 --- a/hypercomplex/Polynomial.hpp +++ b/hypercomplex/Polynomial.hpp @@ -1,11 +1,11 @@ -// Copyright 2022 +// Copyright 2022 /*! \file */ /* ############################################################################### # # Polynomial helper class and functions for the cryptosystems. # -# AUTHOR: Maciej_Bak +# AUTHOR: Maciek_Bak # AFFILIATION: Department_of_Mathematics_City_University_of_London # CONTACT: wsciekly.maciek@gmail.com # CREATED: 02-12-2022 @@ -45,7 +45,7 @@ class Polynomial { public: /** \brief This is the main constructor * \param [in] arr array of integers - * + * * Template parameters are: * * maximum degree of the polynomial */ @@ -55,7 +55,7 @@ class Polynomial { /** \brief This is the copy constructor * \param [in] P existing class instance - * + * * Template parameters are: * * maximum degree of the polynomial */ @@ -64,7 +64,7 @@ class Polynomial { } /** \brief This is the default constructor - * + * * Template parameters are: * * maximum degree of the polynomial */ diff --git a/hypercomplex/VERSION b/hypercomplex/VERSION new file mode 100644 index 00000000..12be384c --- /dev/null +++ b/hypercomplex/VERSION @@ -0,0 +1 @@ +v2.0.7 \ No newline at end of file diff --git a/meta.yaml b/meta.yaml index 422c1121..a8431523 100644 --- a/meta.yaml +++ b/meta.yaml @@ -19,17 +19,21 @@ package: source: path: . +build: + noarch: generic + script: | + mkdir -p $PREFIX/include + cp -r $SRC_DIR/hypercomplex $PREFIX/include/Hypercomplex + requirements: + # Hypercomplex is a library + # we do not build it thus no 'build' and 'host' sections, + # only 'run', which will be compilation of users program run: - compilers - mpfr - sysroot_linux-64=2.28 -build: - script: | - mkdir -p $PREFIX/include - cp -r $SRC_DIR/hypercomplex $PREFIX/include/Hypercomplex - about: home: https://github.com/AngryMaciek/hypercomplex summary: |