Skip to content

Commit

Permalink
Ensure inline templated func hit with arith types only (#936)
Browse files Browse the repository at this point in the history
### Before submitting

Please complete the following checklist when submitting a PR:

- [x] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      [`tests`](../tests) directory!

- [x] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [x] Ensure that the test suite passes, by running `make test`.

- [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [x] Ensure that code is properly formatted by running `make format`. 

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Context:** Closes
#935

**Description of the Change:** Adds concept restrictions to the
`ConstMult` function definition for scalar-time-complex only
instantiations.

**Benefits:** Removes the given build failure.

**Possible Drawbacks:**

**Related GitHub Issues:**

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Ali Asadi <[email protected]>
  • Loading branch information
3 people authored Oct 8, 2024
1 parent c6f3f3f commit 6062a75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@

### Bug fixes

* Add concept restriction to ensure `ConstMult` inline function only hit with arithmetic-values times complex values. Fixes build failures with the test suite when enabling OpenMP, and disabling BLAS and Python under clang.
[(#936)](https://github.com/PennyLaneAI/pennylane-lightning/pull/936)

* Bug fix for `applyMatrix` in `lightning.tensor`. Matrix operator data is not stored in the `cuGateCache` object to support `TensorProd` obs with multiple `Hermitian` obs.
[(#932)](https://github.com/PennyLaneAI/pennylane-lightning/pull/932)

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.39.0-dev40"
__version__ = "0.39.0-dev41"
2 changes: 2 additions & 0 deletions pennylane_lightning/core/src/utils/Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <set>
#include <type_traits> // is_same_v
#include <vector>
#include <concepts> // integral, floating_point

#include "Error.hpp"
#include "TypeTraits.hpp" // remove_complex_t
Expand All @@ -41,6 +42,7 @@ namespace Pennylane::Util {
* @return constexpr std::complex<T>
*/
template <class T, class U = T>
requires std::integral<U> || std::floating_point<U>
inline static constexpr auto ConstMult(U a, std::complex<T> b)
-> std::complex<T> {
return {a * b.real(), a * b.imag()};
Expand Down

0 comments on commit 6062a75

Please sign in to comment.