From 2984f61fe089a6d9ecb31251ab37c6c4218e48f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien.villemot@ens.fr>
Date: Mon, 6 Dec 2010 17:00:46 +0100
Subject: [PATCH] Bugfix at order 3 (hopefully was not affecting final results,
 thanks to Pablo Winant for spotting this): - in the 3rd derivatives matrix,
 among symmetric elements, the first one had the right values but the
 following ones were set to zero - moreover, the k-order DLL was trying to add
 all the symmetric elements in the folded tensor, instead of only keeping one
 value among all the symmetric ones - hopefully, Ondra's tensor library was
 (silently) refusing to add symmetric elements after the first (and right)
 value had been added - so the final result was correct

---
 DynamicModel.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/DynamicModel.cc b/DynamicModel.cc
index c69bb7ef..f071edd8 100644
--- a/DynamicModel.cc
+++ b/DynamicModel.cc
@@ -2137,8 +2137,6 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const
       d3->writeOutput(third_derivatives_output, output_type, temporary_terms);
       third_derivatives_output << ";" << endl;
 
-      k++;
-
       // Compute the column numbers for the 5 other permutations of (id1,id2,id3) and store them in a set (to avoid duplicates if two indexes are equal)
       set<int> cols;
       cols.insert(id1 * hessianColsNbr + id3 * dynJacobianColsNbr + id2);
@@ -2147,7 +2145,7 @@ DynamicModel::writeDynamicModel(ostream &DynamicOutput, bool use_dll) const
       cols.insert(id3 * hessianColsNbr + id1 * dynJacobianColsNbr + id2);
       cols.insert(id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1);
 
-      int k2 = 0; // Keeps the offset of the permutation relative to k
+      int k2 = 1; // Keeps the offset of the permutation relative to k
       for (set<int>::iterator it2 = cols.begin(); it2 != cols.end(); it2++)
         if (*it2 != ref_col)
           {
-- 
GitLab