Skip to content

Commit a56005d

Browse files
author
Vitalij Ruge
committed
- improved gradient evaluation
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20652 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 4b7b997 commit a56005d

File tree

1 file changed

+5
-2
lines changed
  • SimulationRuntime/c/optimization/eval_all

1 file changed

+5
-2
lines changed

SimulationRuntime/c/optimization/eval_all/EvalF.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,11 @@ Bool evalfDiffF(Index n, double * vopt, Bool new_x, Number *gradF, void * useDat
133133

134134
int i, ii;
135135

136-
for(i = 0, ii = n - nv; i < nv; ++i, ++ii){
137-
gradF[ii] += gradM[i];
136+
if(la){
137+
for(i = 0, ii = n - nv; i < nv; ++i, ++ii)
138+
gradF[ii] += gradM[i];
139+
}else{
140+
memcpy(gradF + n - nv, gradM, nv*sizeof(modelica_real));
138141
}
139142

140143
}

0 commit comments

Comments
 (0)