Skip to content
Snippets Groups Projects
Commit 55dd443a authored by patavirt's avatar patavirt
Browse files

Terminal value pinning with identity block in hessian

parent 7b876467
No related branches found
No related tags found
No related merge requests found
...@@ -162,7 +162,7 @@ inline Scalar S_H(const array::ArrayView<const Mask, Shape0>& mask, ...@@ -162,7 +162,7 @@ inline Scalar S_H(const array::ArrayView<const Mask, Shape0>& mask,
Scalar S{0.0}; Scalar S{0.0};
if (alpha == 0) if (alpha == Complex(0))
return S; return S;
for (int i = 0; i < nx-1; ++i) { for (int i = 0; i < nx-1; ++i) {
...@@ -263,16 +263,19 @@ inline Scalar S(const array::ArrayView<const Mask, Shape0>& mask, ...@@ -263,16 +263,19 @@ inline Scalar S(const array::ArrayView<const Mask, Shape0>& mask,
if (mask(i,j) == Mask::VACUUM) { if (mask(i,j) == Mask::VACUUM) {
continue; continue;
} else if (mask(i,j) == Mask::TERMINAL) { } else if (mask(i,j) == Mask::TERMINAL) {
auto Qv = get_Q_matrix(Q.part(i,j)); const Scalar *Qp = Q.part(i,j).data();
for (size_t p = 0; p < 4; ++p) { Array<Scalar,Shape<2,2,2> > Qpart;
for (size_t q = 0; q < 4; ++q) {
auto w = flat_value(Qv(p,q)); for (size_t p = 0; p < Qpart.size(); ++p) {
Qmat(i,j,p,q) = w; auto w = flat_value(Qp[p]);
/* Pin value to the flat value */ Qpart.data()[p] = w;
S = S + (Qv(p,q) - w) * (Qv(p,q) - w);
} /* Pin value to the flat value */
S = S + 0.5 * (Qp[p] - w) * (Qp[p] - w);
} }
Qmat.part(i,j).matrix() = get_Q_matrix(Qpart);
} else { } else {
Qmat.part(i,j).matrix() = get_Q_matrix(Q.part(i,j)); Qmat.part(i,j).matrix() = get_Q_matrix(Q.part(i,j));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment