Skip to content

Commit

Permalink
Merge pull request #34 from oberbichler/feature/improve-eval
Browse files Browse the repository at this point in the history
Simplify `eval`
  • Loading branch information
oberbichler authored Mar 24, 2021
2 parents 24b648c + d36a1de commit 63f23cf
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions include/hyperjet.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,14 +587,27 @@ class DDScalar {
return result;
}

Scalar t(0);

for (index i = 0; i < size(); i++) {
auto s = Scalar(0);
for (index j = 0; j < size(); j++) {
s += d[j] * h(i, j);
Scalar s(0);

index k = 1 + size() + i;

for (index j = 0; j < i; j++) {
s += d[j] * m_data[k];
k += size() - j - 1;
}

for (index j = i; j < size(); j++) {
s += d[j] * m_data[k++];
}
result += 0.5 * d[i] * s;

t += d[i] * s;
}

result += 0.5 * t;

return result;
}

Expand Down

0 comments on commit 63f23cf

Please sign in to comment.