Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert SQRT2 definition to v0.31.0 #479

Merged
merged 8 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

### Bug fixes

* Do no import `sqrt2_v` from `<numbers>` 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)

Expand Down
3 changes: 2 additions & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ graphviz
pybind11
sphinx
sphinx-automodapi
pennylane-sphinx-theme
git+https://github.com/PennyLaneAI/pennylane.git@master
vincentmr marked this conversation as resolved.
Show resolved Hide resolved
pennylane-sphinx-theme
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.32.0-dev9"
__version__ = "0.32.0-dev10"
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <algorithm>
#include <numbers>
#include <random>
#include <span>
#include <vector>
Expand Down
9 changes: 4 additions & 5 deletions pennylane_lightning/core/src/utils/Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include <cmath>
#include <complex>
#include <numbers> // sqrt2_v
#include <numeric> // transform_reduce
#include <set>
#include <type_traits> // is_same_v
Expand Down Expand Up @@ -175,7 +174,7 @@ inline static constexpr auto IMAG() -> ComplexT<T> {
* @return constexpr T sqrt(2)
*/
template <class T> inline static constexpr auto SQRT2() -> T {
mlxd marked this conversation as resolved.
Show resolved Hide resolved
return std::numbers::sqrt2_v<T>;
return static_cast<T>(1.414213562373095048801688724209698079L);
}

/**
Expand All @@ -187,7 +186,7 @@ template <class T> inline static constexpr auto SQRT2() -> T {
*/
template <template <class> class ComplexT, class T>
inline static constexpr auto SQRT2() -> ComplexT<T> {
return std::numbers::sqrt2_v<T>;
return static_cast<T>(1.414213562373095048801688724209698079L);
}

/**
Expand All @@ -197,7 +196,7 @@ inline static constexpr auto SQRT2() -> ComplexT<T> {
* @return constexpr T 1/sqrt(2)
*/
template <class T> inline static constexpr auto INVSQRT2() -> T {
return {1 / SQRT2<T>()};
return static_cast<T>(0.707106781186547461715008466853760182L);
}

/**
Expand All @@ -209,7 +208,7 @@ template <class T> inline static constexpr auto INVSQRT2() -> T {
*/
template <template <class> class ComplexT, class T>
inline static constexpr auto INVSQRT2() -> ComplexT<T> {
return {1 / SQRT2<T>()};
return static_cast<T>(0.707106781186547461715008466853760182L);
}

/**
Expand Down
Loading