diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index f0f2c41a66..32719b3aa8 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -21,6 +21,9 @@ ### Bug fixes +* Do no import `sqrt2_v` from `` in `Util.hpp` to resolve issue with Lightning-GPU builds. + [(#479)](https://github.com/PennyLaneAI/pennylane-lightning/pull/479) + * Update the CMake internal references to enable sub-project compilation with affecting the parent package. [(#478)](https://github.com/PennyLaneAI/pennylane-lightning/pull/478) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index b218438407..3a4a0472e8 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.32.0-dev9" +__version__ = "0.32.0-dev10" diff --git a/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/Test_VectorJacobianProduct.cpp b/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/Test_VectorJacobianProduct.cpp index 8af2d4bb7b..e64a1c5014 100644 --- a/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/Test_VectorJacobianProduct.cpp +++ b/pennylane_lightning/core/src/simulators/lightning_qubit/algorithms/tests/Test_VectorJacobianProduct.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. #include +#include #include #include #include diff --git a/pennylane_lightning/core/src/utils/Util.hpp b/pennylane_lightning/core/src/utils/Util.hpp index 4eb82aacf4..71799535d3 100644 --- a/pennylane_lightning/core/src/utils/Util.hpp +++ b/pennylane_lightning/core/src/utils/Util.hpp @@ -20,7 +20,7 @@ #include #include -#include // sqrt2_v +#include #include // transform_reduce #include #include // is_same_v @@ -175,7 +175,15 @@ inline static constexpr auto IMAG() -> ComplexT { * @return constexpr T sqrt(2) */ template inline static constexpr auto SQRT2() -> T { +#if __cpp_lib_math_constants >= 201907L return std::numbers::sqrt2_v; +#else + if constexpr (std::is_same_v) { + return 0x1.6a09e6p+0F; // NOLINT: To be replaced in C++20 + } else { + return 0x1.6a09e667f3bcdp+0; // NOLINT: To be replaced in C++20 + } +#endif } /** @@ -187,7 +195,15 @@ template inline static constexpr auto SQRT2() -> T { */ template