744744 else
745745 W = update_coefficients! (W, uprev, p, t; transform = W_transform, dtgamma)
746746 end
747- if W. J != = nothing
747+ if W. J != = nothing && ! (W . J isa AbstractSciMLOperator)
748748 J = islin ? (isode ? f. f : f. f1. f) : calc_J (integrator, cache, next_step)
749749 if ! isdae
750750 integrator. stats. nw += 1
@@ -757,27 +757,15 @@ end
757757 elseif islin
758758 J = isode ? f. f : f. f1. f # unwrap the Jacobian accordingly
759759 W = WOperator {false} (mass_matrix, dtgamma, J, uprev; transform = W_transform)
760- elseif DiffEqBase. has_jac (f)
761- J = f. jac (uprev, p, t)
762- integrator. stats. njacs += 1
763- if J isa StaticArray &&
764- integrator. alg isa OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
765- W = W_transform ? J - mass_matrix * inv (dtgamma) :
766- dtgamma * J - mass_matrix
767- else
768- if ! isa (J, AbstractSciMLOperator) && (! isnewton (nlsolver) ||
769- nlsolver. cache. W. J isa AbstractSciMLOperator)
770- J = MatrixOperator (J)
771- end
772- W = WOperator {false} (mass_matrix, dtgamma, J, uprev, cache. W. jacvec;
773- transform = W_transform)
774- end
775- integrator. stats. nw += 1
776760 else
777761 integrator. stats. nw += 1
778762 J = calc_J (integrator, cache, next_step)
779763 if isdae
780764 W = J
765+ elseif J isa StaticArray &&
766+ integrator. alg isa OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
767+ W = W_transform ? J - mass_matrix * inv (dtgamma) :
768+ dtgamma * J - mass_matrix
781769 else
782770 W_full = W_transform ? J - mass_matrix * inv (dtgamma) :
783771 dtgamma * J - mass_matrix
@@ -912,29 +900,42 @@ function build_J_W(alg, u, uprev, p, t, dt, f::F, ::Type{uEltypeNoUnits},
912900 autodiff = alg_autodiff (alg), tag = OrdinaryDiffEqTag ())
913901 W = WOperator {IIP} (f. mass_matrix, dt, J, u, jacvec)
914902
915- elseif islin || (! IIP && DiffEqBase. has_jac (f))
903+ elseif islin
904+ J = isode ? f. f : f. f1. f # unwrap the Jacobian accordingly
905+ W = WOperator {IIP} (f. mass_matrix, dt, J, u)
906+ elseif DiffEqBase. has_jac (f)
916907 J = islin ? (isode ? f. f : f. f1. f) : f. jac (uprev, p, t) # unwrap the Jacobian accordingly
917- if ! isa (J, AbstractSciMLOperator)
918- J = MatrixOperator (J)
908+ if J isa AbstractSciMLOperator
909+ W = WOperator {IIP} (f. mass_matrix, dt, J, u)
910+ else
911+ W = if alg isa DAEAlgorithm
912+ J
913+ elseif IIP
914+ similar (J)
915+ else
916+ len = StaticArrayInterface. known_length (typeof (J))
917+ if len != = nothing &&
918+ alg isa OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
919+ StaticWOperator (J, false )
920+ else
921+ ArrayInterface. lu_instance (J)
922+ end
923+ end
919924 end
920- W = WOperator {IIP} (f. mass_matrix, dt, J, u)
921925 else
922926 J = if f. jac_prototype === nothing
923927 ArrayInterface. undefmatrix (u)
924928 else
925929 deepcopy (f. jac_prototype)
926930 end
927- isdae = alg isa DAEAlgorithm
928- W = if isdae
931+ W = if alg isa DAEAlgorithm
929932 J
930933 elseif IIP
931934 similar (J)
932935 else
933936 len = StaticArrayInterface. known_length (typeof (J))
934937 if len != = nothing &&
935- alg isa
936- Union{Rosenbrock23, Rodas23W, Rodas3P, Rodas4, Rodas4P,
937- Rodas4P2, Rodas5, Rodas5P, Rodas5Pe, Rodas5Pr}
938+ alg isa OrdinaryDiffEqRosenbrockAdaptiveAlgorithm
938939 StaticWOperator (J, false )
939940 else
940941 ArrayInterface. lu_instance (J)
0 commit comments