@@ -4,8 +4,11 @@ mutable struct TimeGradientWrapper{iip, fType, uType, P} <: AbstractSciMLFunctio
4
4
p:: P
5
5
end
6
6
7
+ function TimeGradientWrapper {iip} (f:: F , uprev, p) where {F, iip}
8
+ return TimeGradientWrapper {iip, F, typeof(uprev), typeof(p)} (f, uprev, p)
9
+ end
7
10
function TimeGradientWrapper (f:: F , uprev, p) where {F}
8
- return TimeGradientWrapper {isinplace(f, 4), F, typeof(uprev), typeof(p) } (f, uprev, p)
11
+ return TimeGradientWrapper {isinplace(f, 4)} (f, uprev, p)
9
12
end
10
13
11
14
(ff:: TimeGradientWrapper{true} )(t) = (du2 = similar (ff. uprev); ff. f (du2, ff. uprev, ff. p, t); du2)
@@ -19,9 +22,10 @@ mutable struct UJacobianWrapper{iip, fType, tType, P} <: AbstractSciMLFunction{i
19
22
p:: P
20
23
end
21
24
22
- function UJacobianWrapper (f:: F , t, p) where {F}
23
- return UJacobianWrapper {isinplace(f, 4) , F, typeof(t), typeof(p)} (f, t, p)
25
+ function UJacobianWrapper {iip} (f:: F , t, p) where {F, iip }
26
+ return UJacobianWrapper {iip , F, typeof(t), typeof(p)} (f, t, p)
24
27
end
28
+ UJacobianWrapper (f:: F , t, p) where {F} = UJacobianWrapper {isinplace(f, 4)} (f, t, p)
25
29
26
30
(ff:: UJacobianWrapper{true} )(du1, uprev) = ff. f (du1, uprev, ff. p, ff. t)
27
31
(ff:: UJacobianWrapper{true} )(uprev) = (du1 = similar (uprev); ff. f (du1, uprev, ff. p, ff. t); du1)
@@ -37,8 +41,11 @@ mutable struct TimeDerivativeWrapper{iip, F, uType, P} <: AbstractSciMLFunction{
37
41
p:: P
38
42
end
39
43
44
+ function TimeDerivativeWrapper {iip} (f:: F , u, p) where {F, iip}
45
+ return TimeDerivativeWrapper {iip, F, typeof(u), typeof(p)} (f, u, p)
46
+ end
40
47
function TimeDerivativeWrapper (f:: F , u, p) where {F}
41
- return TimeDerivativeWrapper {isinplace(f, 4), F, typeof(u), typeof(p) } (f, u, p)
48
+ return TimeDerivativeWrapper {isinplace(f, 4)} (f, u, p)
42
49
end
43
50
44
51
(ff:: TimeDerivativeWrapper{false} )(t) = ff. f (ff. u, ff. p, t)
@@ -51,9 +58,10 @@ mutable struct UDerivativeWrapper{iip, F, tType, P} <: AbstractSciMLFunction{iip
51
58
p:: P
52
59
end
53
60
54
- function UDerivativeWrapper (f:: F , t, p) where {F}
55
- return UDerivativeWrapper {isinplace(f, 4) , F, typeof(t), typeof(p)} (f, t, p)
61
+ function UDerivativeWrapper {iip} (f:: F , t, p) where {F, iip }
62
+ return UDerivativeWrapper {iip , F, typeof(t), typeof(p)} (f, t, p)
56
63
end
64
+ UDerivativeWrapper (f:: F , t, p) where {F} = UDerivativeWrapper {isinplace(f, 4)} (f, t, p)
57
65
58
66
(ff:: UDerivativeWrapper{false} )(u) = ff. f (u, ff. p, ff. t)
59
67
(ff:: UDerivativeWrapper{true} )(du1, u) = ff. f (du1, u, ff. p, ff. t)
@@ -65,9 +73,10 @@ mutable struct ParamJacobianWrapper{iip, fType, tType, uType} <: AbstractSciMLFu
65
73
u:: uType
66
74
end
67
75
68
- function ParamJacobianWrapper (f:: F , t, u) where {F}
69
- return ParamJacobianWrapper {isinplace(f, 4) , F, typeof(t), typeof(u)} (f, t, u)
76
+ function ParamJacobianWrapper {iip} (f:: F , t, u) where {F, iip }
77
+ return ParamJacobianWrapper {iip , F, typeof(t), typeof(u)} (f, t, u)
70
78
end
79
+ ParamJacobianWrapper (f:: F , t, u) where {F} = ParamJacobianWrapper {isinplace(f, 4)} (f, t, u)
71
80
72
81
(ff:: ParamJacobianWrapper{true} )(du1, p) = ff. f (du1, ff. u, p, ff. t)
73
82
function (ff:: ParamJacobianWrapper{true} )(p)
@@ -82,9 +91,9 @@ mutable struct JacobianWrapper{iip, fType, pType} <: AbstractSciMLFunction{iip}
82
91
p:: pType
83
92
end
84
93
85
- function JacobianWrapper (f:: F , p) where {F}
86
- return JacobianWrapper {isinplace(f, 4), F, typeof(p)} (f, p)
87
- end
94
+ JacobianWrapper {iip} (f:: F , p) where {F, iip} = JacobianWrapper {iip, F, typeof(p)} (f, p)
95
+ JacobianWrapper (f:: F , p) where {F} = JacobianWrapper {isinplace(f, 3)} (f, p)
88
96
89
97
(uf:: JacobianWrapper{false} )(u) = uf. f (u, uf. p)
98
+ (uf:: JacobianWrapper{false} )(res, u) = (vec (res) .= vec (uf. f (u, uf. p)))
90
99
(uf:: JacobianWrapper{true} )(res, u) = uf. f (res, u, uf. p)
0 commit comments