Skip to content

Commit

Permalink
Merge pull request #294 from ICB-DCM/fixes_ff
Browse files Browse the repository at this point in the history
bugfix #293
  • Loading branch information
Fabian Fröhlich authored Mar 15, 2018
2 parents da77083 + b2261df commit 7e4e208
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
23 changes: 16 additions & 7 deletions src/rdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,33 @@ void ReturnData::applyChainRuleFactorToSimulationResults(const Model *model) {
std::vector<realtype> pcoefficient(nplist, 1.0);
std::vector<realtype> unscaledParameters(np);
model->unscaleParameters(unscaledParameters.data());
std::vector<realtype> augcoefficient(np);
std::vector<realtype> augcoefficient(np, 1.0);

if (sensi == AMICI_SENSI_ORDER_SECOND && o2mode == AMICI_O2MODE_FULL) {
for (int ip = 0; ip < np; ++ip) {
switch (pscale[ip]) {
case AMICI_SCALING_LOG10:
augcoefficient.at(ip) = unscaledParameters.at(ip) * log(10);
break;
case AMICI_SCALING_LN:
augcoefficient.at(ip) = unscaledParameters.at(ip);
break;
case AMICI_SCALING_NONE:
break;
}
}
}

for (int ip = 0; ip < nplist; ++ip) {
switch (pscale[model->plist(ip)]) {
case AMICI_SCALING_LOG10:
coefficient.at(ip) = log(10.0);
pcoefficient.at(ip) = unscaledParameters.at(model->plist(ip)) * log(10);
if (sensi == AMICI_SENSI_ORDER_SECOND && o2mode == AMICI_O2MODE_FULL)
augcoefficient.at(ip) = unscaledParameters.at(ip) * log(10);
break;
case AMICI_SCALING_LN:
coefficient.at(ip) = 1.0;
pcoefficient.at(ip) = unscaledParameters.at(model->plist(ip));
if (sensi == AMICI_SENSI_ORDER_SECOND && o2mode == AMICI_O2MODE_FULL)
augcoefficient.at(ip) = unscaledParameters.at(ip);
break;
case AMICI_SCALING_NONE:
coefficient.at(ip) = 1.0;
break;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/returndata_matlab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ void writeMatlabField0(mxArray *matlabStruct, const char *fieldName,

double *array = initAndAttachArray(matlabStruct, fieldName, dim);

/* transform rowmajor (c++) to colmajor (matlab) */
array[0] = static_cast<double>(fielddata);
}

Expand All @@ -200,7 +199,6 @@ void writeMatlabField1(mxArray *matlabStruct, const char *fieldName,

double *array = initAndAttachArray(matlabStruct, fieldName, dim);

/* transform rowmajor (c++) to colmajor (matlab) */
for(int i = 0; i < dim0; i++)
array[i] = static_cast<double>(fieldData[i]);
}
Expand Down

0 comments on commit 7e4e208

Please sign in to comment.