Skip to content

Fix docstring errors and operator+ signature in TensorCommon. Fixes gyselax #562#563

Merged
EmilyBourne merged 4 commits into
gyselax:develfrom
Quntized:fix-tensor-bugs
Mar 2, 2026
Merged

Fix docstring errors and operator+ signature in TensorCommon. Fixes gyselax #562#563
EmilyBourne merged 4 commits into
gyselax:develfrom
Quntized:fix-tensor-bugs

Conversation

@Quntized

@Quntized Quntized commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Fix docstring errors and operator+ signature in TensorCommon. Fixes #562

Several bugs found in src/data_types/tensor_common.hpp :

**Code bug **

  • operator+ for tensor addition uses Oelement_type (scalar type) instead of TensorType , for the operator+ 2nd parameter , inconsistent with operator- .

//Current
template <..>
TensorType operator+(TensorType const& tensor, Oelement_type val)

//should match operator-
template<..>
TensorType operator+(TensorType const& tensor, TensorType const& val)

Docstring Bugs:

  • operator/= : says "multiplied " instead of divided;
  • operator- (Coord): brief says "add" instead of "subtract"
  • operator -=(Coord) : brief says "add" instead of "subtract"
  • operator/ : says "multiplied/ multiplication" instead of "divided/division"
  • operator* (first): says "multiply all a tensor" instead of "multiply all elements of a tensor"
  • Move constructor: says "copying" instead of "moving"
  • Move assign: says "copied" instead of "moved"

Please complete the checklist to ensure that all tasks are completed before marking your pull request as ready for review.

All Submissions

  • Have you ensured that all lines changed in this PR are justified by a comment found in the description ?
  • Have you updated the CHANGELOG.md ?
  • Have you linked any issues that should be closed when this PR is merged (using closing keywords) ?
  • Have you checked that the AUTHORS file is up to date ?
  • Have you checked that the copyright information in the LICENCE file is up to date (including dates) ?
  • Do you follow the conventions specified in our coding standards ?

New Feature Submissions

  • Have you added tests for the new functionalities ?
  • Have you documented the new functionalities:
    • API documentation describing the available methods, when each should be used and how to use them ?
    • User-friendly documentation in README files (which may link to the API documentation).
    • If the new functionality is non-trivial to use, provide a tutorial or example ? (optional)

Changes to Existing Features

  • Have you checked that existing tests cover all code after the changes ?
  • Have you checked that existing tests are still passing ?
  • Have you checked that the existing documentation is still accurate (API and README files) ?

Changes to the CI

  • Have you made the same changes to both the GitHub CI and the GitLab CI (for the private fork) ?

@codecov

codecov Bot commented Mar 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Comment thread src/data_types/tensor_common.hpp Outdated
Co-authored-by: Emily Bourne <louise.bourne@gmail.com>
@Quntized Quntized requested a review from EmilyBourne March 1, 2026 17:51
@EmilyBourne EmilyBourne merged commit 108c2cd into gyselax:devel Mar 2, 2026
24 of 26 checks passed
EmilyBourne added a commit that referenced this pull request Mar 5, 2026
…yselax #562 (#563)

Fix docstring errors and operator+ signature in TensorCommon. Fixes
#562

Several bugs found in `src/data_types/tensor_common.hpp` : 

**Code bug **
- `operator+` for tensor addition uses `Oelement_type` (scalar type)
instead of `TensorType` , for the `operator+` 2nd parameter ,
inconsistent with `operator-` .


//Current
template <..>
TensorType operator+(TensorType const& tensor, Oelement_type val)

//should match operator-
template<..>
TensorType operator+(TensorType const& tensor, TensorType const& val)


**Docstring Bugs:**
- `operator/=` : says "multiplied " instead of divided;
- `operator-` (Coord): brief says "add" instead of "subtract"
- `operator -=`(Coord) : brief says "add" instead of "subtract"
- `operator/` : says "multiplied/ multiplication" instead of
"divided/division"
- `operator*` (first): says "multiply all a tensor" instead of "multiply
all elements of a tensor"
- Move constructor: says "copying" instead of "moving"
- Move assign: says "copied" instead of "moved"

---------

Co-authored-by: Emily Bourne <emily.bourne@epfl.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bugs in TensorCommon : incorrect operator+ signature and docstring errors

2 participants