Skip to content

Commit 3f9dcc8

Browse files
committed
Added Jacobian and JVP support to decomposing the RHS
1 parent 7dccb49 commit 3f9dcc8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/+otp/RHS.m

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,21 @@
3838
if strcmp(vs(1).type, '()')
3939
objF = obj.F;
4040
newF = @(t, y) subsref(objF(t, y), vs);
41-
newRHS = otp.RHS(newF);
41+
newJac = [];
42+
if ~isempty(obj.Jacobian)
43+
newJac = @(t, y) subsref(obj.Jacobian(t, y), vs);
44+
end
45+
newJacvp = [];
46+
if ~isempty(obj.JacobianVectorProduct)
47+
newJacvp = @(t, y, v) subsref(obj.JacobianVectorProduct(t, y, v), vs);
48+
end
49+
50+
vectorized = obj.Vectorized;
51+
52+
newRHS = otp.RHS(newF, ...
53+
'Jacobian', newJac, ...
54+
'JacobianVectorProduct', newJacvp, ...
55+
'Vectorized', vectorized);
4256
else
4357
newRHS = builtin('subsref', obj, vs);
4458
end

0 commit comments

Comments
 (0)