From 444f69eb8ca4c7ec4a73212715b325db6f3cb420 Mon Sep 17 00:00:00 2001 From: Avik Pal Date: Tue, 29 Aug 2023 11:26:41 -0400 Subject: [PATCH] Error on misspecifying arguments --- src/sensitivity_algorithms.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sensitivity_algorithms.jl b/src/sensitivity_algorithms.jl index 504542fcf..789be4150 100644 --- a/src/sensitivity_algorithms.jl +++ b/src/sensitivity_algorithms.jl @@ -1148,7 +1148,12 @@ function setvjp(sensealg::SteadyStateAdjoint{CJ, CS, AD, FDT, VJP, LS, LM}, end needs_concrete_jac(::SteadyStateAdjoint, ::SSAdjointFullJacobianLinsolve, _) = true -needs_concrete_jac(::SteadyStateAdjoint, ::SSAdjointIterativeVJPLinsolve, _) = false +function needs_concrete_jac(S::SteadyStateAdjoint, ::SSAdjointIterativeVJPLinsolve, _) + if S.linsolve !== nothing && LinearSolve.needs_concrete_A(S.linsolve) + error("$(S.linsolve) requires a concrete Matrix. Cannot be solved using the Iterative VJPs!") + end + return false +end function needs_concrete_jac(S::SteadyStateAdjoint, L::SSAdjointHeuristicLinsolve, u0) return length(u0) ≤ L.auto_switch_threshold end