summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2023-04-04 12:25:36 +0200
committerJaron Kent-Dobias <jaron@kent-dobias.com>2023-04-04 12:25:36 +0200
commit383c5e41a33b17d49e7524089eea3b940008bade (patch)
tree1a779630f446d1ae83a4f240ef2b891954506122
parent94b6ed7d9c591ae2df0957a25e73bd2e5c69f6e1 (diff)
downloadcode-383c5e41a33b17d49e7524089eea3b940008bade.tar.gz
code-383c5e41a33b17d49e7524089eea3b940008bade.tar.bz2
code-383c5e41a33b17d49e7524089eea3b940008bade.zip
Changed constructor specialization to use concepts.
Formally, the constructor for pSpinModel specialized using a partially evaluated template, a syntax that did not compile in g++. Changed to use a new method from concepts.
-rw-r--r--p-spin.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/p-spin.hpp b/p-spin.hpp
index dee6273..267ab91 100644
--- a/p-spin.hpp
+++ b/p-spin.hpp
@@ -2,6 +2,7 @@
#include <eigen3/Eigen/Dense>
#include <iterator>
+#include<type_traits>
#include "types.hpp"
#include "tensor.hpp"
@@ -36,7 +37,7 @@ private:
template <int p, int... qs>
std::tuple<Scalar, Vector<Scalar>, Matrix<Scalar>, Tensor<Scalar, 3>> hamGradHessHelper(const Vector<Scalar>& z, const Tensor<Scalar, p>& J, const Tensor<Scalar, qs>& ...Js) const {
auto [Jz, J3] = hamGradTensorHelper(z, J);
-
+
Vector<Scalar> Jzz = Jz * z;
Scalar Jzzz = Jzz.transpose() * z;
@@ -66,7 +67,7 @@ public:
pSpinModel(const std::tuple<Tensor<Scalar, ps>...>& Js) : Js(Js) {}
template <class Generator, typename... T>
- pSpinModel<Real>(unsigned N, Generator& r, T... μs) {
+ pSpinModel(unsigned N, Generator& r, T... μs) requires(std::is_same_v<Scalar, Real>) {
Js = std::make_tuple(μs * generateRealPSpinCouplings<Real, ps>(N, r)...);
}