Skip to content

Commit

Permalink
Fix cblas error for models without solver states in combination with …
Browse files Browse the repository at this point in the history
…forward sensitivities
  • Loading branch information
dweindl committed May 23, 2023
1 parent 4d767e7 commit c3c8296
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,15 +1069,17 @@ void Model::getObservableSensitivity(
// dydx A[ny,nx_solver] * sx B[nx_solver,nplist] = sy C[ny,nplist]
// M K K N M N
// lda ldb ldc
setNaNtoZero(derived_state_.dydx_);
setNaNtoZero(derived_state_.sx_);
amici_dgemm(
BLASLayout::colMajor, BLASTranspose::noTrans, BLASTranspose::noTrans,
ny, nplist(), nx_solver, 1.0, derived_state_.dydx_.data(), ny,
derived_state_.sx_.data(), nx_solver, 1.0, derived_state_.dydp_.data(),
ny
);

if (nx_solver) {
setNaNtoZero(derived_state_.dydx_);
setNaNtoZero(derived_state_.sx_);
amici_dgemm(
BLASLayout::colMajor, BLASTranspose::noTrans,
BLASTranspose::noTrans, ny, nplist(), nx_solver, 1.0,
derived_state_.dydx_.data(), ny, derived_state_.sx_.data(),
nx_solver, 1.0, derived_state_.dydp_.data(), ny
);
}
writeSlice(derived_state_.dydp_, sy);

if (always_check_finite_)
Expand Down

0 comments on commit c3c8296

Please sign in to comment.