Skip to content
Merged
26 changes: 13 additions & 13 deletions ComputeSensitivities/generateFDstep.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@
p_typ = ones(dim_p, 1);
t_typ = 1;

if hasOption(varargin, 'hy'), hy = getOption(varargin, 'hy'); end
if hasOption(varargin, 'hp'), hp = getOption(varargin, 'hp'); end
if hasOption(varargin, 'ht'), ht = getOption(varargin, 'ht'); end
if hasOption(varargin, 'h_dir'), h_dir = getOption(varargin, 'h_dir'); end
if hasOption(varargin, 'hy_rel_flag'), hy_rel_flag = getOption(varargin, 'hy_rel_flag'); end
if hasOption(varargin, 'hp_rel_flag'), hp_rel_flag = getOption(varargin, 'hp_rel_flag'); end
if hasOption(varargin, 'ht_rel_flag'), ht_rel_flag = getOption(varargin, 'ht_rel_flag'); end
if hasOption(varargin, 'y_typ'), y_typ = getOption(varargin, 'y_typ'); end
if hasOption(varargin, 'p_typ'), p_typ = getOption(varargin, 'p_typ'); end
if hasOption(varargin, 't_typ'), t_typ = getOption(varargin, 't_typ'); end
if olHasOption(varargin, 'hy'), hy = olGetOption(varargin, 'hy'); end
if olHasOption(varargin, 'hp'), hp = olGetOption(varargin, 'hp'); end
if olHasOption(varargin, 'ht'), ht = olGetOption(varargin, 'ht'); end
if olHasOption(varargin, 'h_dir'), h_dir = olGetOption(varargin, 'h_dir'); end
if olHasOption(varargin, 'hy_rel_flag'), hy_rel_flag = olGetOption(varargin, 'hy_rel_flag'); end
if olHasOption(varargin, 'hp_rel_flag'), hp_rel_flag = olGetOption(varargin, 'hp_rel_flag'); end
if olHasOption(varargin, 'ht_rel_flag'), ht_rel_flag = olGetOption(varargin, 'ht_rel_flag'); end
if olHasOption(varargin, 'y_typ'), y_typ = olGetOption(varargin, 'y_typ'); end
if olHasOption(varargin, 'p_typ'), p_typ = olGetOption(varargin, 'p_typ'); end
if olHasOption(varargin, 't_typ'), t_typ = olGetOption(varargin, 't_typ'); end

hy_min = y_typ * 1e-10;
hp_min = p_typ * 1e-10;
ht_min = t_typ * 1e-10;

if hasOption(varargin, 'hy_min'), hy_min = getOption(varargin, 'hy_min'); end
if hasOption(varargin, 'hp_min'), hp_min = getOption(varargin, 'hp_min'); end
if hasOption(varargin, 'ht_min'), ht_min = getOption(varargin, 'ht_min'); end
if olHasOption(varargin, 'hy_min'), hy_min = olGetOption(varargin, 'hy_min'); end
if olHasOption(varargin, 'hp_min'), hp_min = olGetOption(varargin, 'hp_min'); end
if olHasOption(varargin, 'ht_min'), ht_min = olGetOption(varargin, 'ht_min'); end


if (length(hy) == 1) && (dim_y > 1)
Expand Down
22 changes: 11 additions & 11 deletions ComputeSensitivities/generateSensitivityFunction.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
method = 'VDE';
save_intermediates = true;

if hasOption(varargin, 'integrator'), integrator = getOption(varargin, 'integrator'); end
if hasOption(varargin, 'integrator_options'), integrator_options = getOption(varargin, 'integrator_options'); end
if hasOption(varargin, 'calcGy'), Gy_flag = getOption(varargin, 'calcGy'); end
if hasOption(varargin, 'calcGp'), Gp_flag = getOption(varargin, 'calcGp'); end
if hasOption(varargin, 'method'), method = getOption(varargin, 'method'); end
if hasOption(varargin, 'save_intermediates'), save_intermediates = getOption(varargin, 'save_intermediates'); end
if olHasOption(varargin, 'integrator'), integrator = olGetOption(varargin, 'integrator'); end
if olHasOption(varargin, 'integrator_options'), integrator_options = olGetOption(varargin, 'integrator_options'); end
if olHasOption(varargin, 'calcGy'), Gy_flag = olGetOption(varargin, 'calcGy'); end
if olHasOption(varargin, 'calcGp'), Gp_flag = olGetOption(varargin, 'calcGp'); end
if olHasOption(varargin, 'method'), method = olGetOption(varargin, 'method'); end
if olHasOption(varargin, 'save_intermediates'), save_intermediates = olGetOption(varargin, 'save_intermediates'); end


methodCoded.END_piecewise = 1;
Expand All @@ -60,7 +60,7 @@
% As for the calculation with END_full no intermediate matrices are generated, the flag for the output for the intermediates
% can only be set to true if another method is chosen (END_piecewise or VDE)
if ~(method == methodCoded.END_full)
if hasOption(varargin, 'Gmatrices_intermediate'), Gmatrices_intermediate_flag = getOption(varargin, 'Gmatrices_intermediate'); end
if olHasOption(varargin, 'Gmatrices_intermediate'), Gmatrices_intermediate_flag = olGetOption(varargin, 'Gmatrices_intermediate'); end
end

% switches includes tspan(1) and tspan(end)
Expand Down Expand Up @@ -113,16 +113,16 @@

if Gy_flag
directions_y = 0;
if hasOption(varargin, 'directions_y')
directions_y = getOption(varargin, 'directions_y');
if olHasOption(varargin, 'directions_y')
directions_y = olGetOption(varargin, 'directions_y');
end
sensData.Gy = compute_sensitivity_ENDfull_y(datahandle, sol, t_sort_unique, FDstep, directions_y);
end

if Gp_flag
directions_p = 0;
if hasOption(varargin, 'directions_p')
directions_p = getOption(varargin, 'directions_p');
if olHasOption(varargin, 'directions_p')
directions_p = olGetOption(varargin, 'directions_p');
end
sensData.Gp = compute_sensitivity_ENDfull_p(datahandle, sol, t_sort_unique, FDstep, directions_p);
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

integrator_solveODE = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-6);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS','solver', func2str(integrator_solveODE), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS', 'integrator', func2str(integrator_solveODE), 'options', odeoptionsrhs_test);

return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 118];
initialvalues = [2.48252;0;0];
Expand Down
2 changes: 1 addition & 1 deletion Examples/ParameterEstimation_WhiteCabbage/test_Cabbage.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('whiteCabbageRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 118];
initialvalues = [2.48252;0;0];
Expand Down
2 changes: 1 addition & 1 deletion Examples/bounceball/bounceball_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
odeoptions = odeset( 'AbsTol', 1e-14, 'RelTol', 1e-12);
filename = 'bounceball_rhs';
tic
handlerhs_test = prepareDatahandleForIntegration(filename, 'solver', func2str(integrator), 'options', odeoptions);
handlerhs_test = prepareDatahandleForIntegration(filename, 'integrator', func2str(integrator), 'options', odeoptions);
toc

fprintf('Integration with ifdiff/%s...\n ', func2str(integrator));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 20];
initialvalues = [1;0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 20];
initialvalues = [1;0];
Expand Down
2 changes: 1 addition & 1 deletion Examples/canonicalExample/analyticalSolution.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 20];
initialvalues = [1;0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
filename = 'canonicalExampleRHS_extended';
clc
tic
hdlrhs_test = prepareDatahandleForIntegration(filename, 'solver', func2str(integrator), 'options', options);
hdlrhs_test = prepareDatahandleForIntegration(filename, 'integrator', func2str(integrator), 'options', options);
toc


Expand Down
2 changes: 1 addition & 1 deletion Examples/canonicalExample/canonicalExampleRHS_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
odeoptions = odeset( 'AbsTol', 1e-20, 'RelTol', 1e-12);
filename = 'canonicalExampleRHS';
tic
hdlrhs_test = prepareDatahandleForIntegration(filename, 'solver', func2str(integrator), 'options', odeoptions);
hdlrhs_test = prepareDatahandleForIntegration(filename, 'integrator', func2str(integrator), 'options', odeoptions);
toc

%%
Expand Down
2 changes: 1 addition & 1 deletion Examples/canonicalExample/sensitivities_CanonicalExample.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
initPaths();
integrator = @ode45;
odeoptionsrhs_test = odeset( 'AbsTol', 1e-14,'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS','solver', func2str(integrator), 'options', odeoptionsrhs_test);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'integrator', func2str(integrator), 'options', odeoptionsrhs_test);

tspan = [0 20];
initialvalues = [1;0];
Expand Down
2 changes: 1 addition & 1 deletion Examples/funfun/funinif_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

% ifdiff
tic
hdl = prepareDatahandleForIntegration(rhs_name, 'solver', func2str(odesolver), 'options', options);
hdl = prepareDatahandleForIntegration(rhs_name, 'integrator', func2str(odesolver), 'options', options);
fprintf('Ifdiff handle preparation took %g seconds.\n', toc());
tic
[solif, dataif] = solveODE(hdl, tspan, x0, []);
Expand Down
2 changes: 1 addition & 1 deletion Examples/sensExampleIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
odeoptions = odeset( 'AbsTol', 1e-06, 'RelTol', 1e-04);

tic
hdlsens = prepareDatahandleForIntegration('sensExample', 'solver', 'ode23', 'options', odeoptions);
hdlsens = prepareDatahandleForIntegration('sensExample', 'integrator', 'ode23', 'options', odeoptions);
preptime = toc

tic
Expand Down
2 changes: 1 addition & 1 deletion Examples/sign/sign_inconsistent_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
filename = 'sign_inconsistent_rhs';
tic
datahandle = prepareDatahandleForIntegration(filename, ...
'solver', func2str(integrator), 'options', odeoptions);
'integrator', func2str(integrator), 'options', odeoptions);
toc

fprintf('Integration with ifdiff/%s...\n ', func2str(integrator));
Expand Down
2 changes: 1 addition & 1 deletion Examples/spiral/spiral_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
odeoptions = odeset( 'AbsTol', 1e-8, 'RelTol', 1e-6, 'MaxStep', 10000);
filename = 'spiral_rhs';
tic
handlerhs_test = prepareDatahandleForIntegration(filename, 'solver', func2str(integrator), 'options', odeoptions);
handlerhs_test = prepareDatahandleForIntegration(filename, 'integrator', func2str(integrator), 'options', odeoptions);
toc

% solution
Expand Down
2 changes: 1 addition & 1 deletion Examples/stickslip/stickslip_inconsistent_test_highfreq.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
filename = 'stickslip_inconsistent_rhs_highfreq';
integrator = @ode45;
odeopts = odeset('RelTol',1e-10, 'AbsTol',1e-12); % defaults
datahandle = prepareDatahandleForIntegration(filename, 'solver', func2str(integrator), 'options', odeopts);
datahandle = prepareDatahandleForIntegration(filename, 'integrator', func2str(integrator), 'options', odeopts);
% integrate with ifdiff
fprintf('Integration with ifdiff/%s...\n ', func2str(integrator));
tic
Expand Down
2 changes: 1 addition & 1 deletion Examples/stickslip/stickslip_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

fprintf('Preparing...\n ');
tic
hdlrhs_test = prepareDatahandleForIntegration('stickslip_rhs', 'solver', func2str(odesolver), 'options', odeoptions);
hdlrhs_test = prepareDatahandleForIntegration('stickslip_rhs', 'integrator', func2str(odesolver), 'options', odeoptions);
toc
%%
fprintf('Solving using ifdiff...\n ');
Expand Down
2 changes: 1 addition & 1 deletion Examples/subway/Sensitivities/Plot_Sensitivities_NewYork.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
parameters = nysscc_getPhysicsParameters_vector();
odeoptionssubwaymodel = odeset( 'AbsTol', 1e-20, 'RelTol', 1e-10);

datahandle = prepareDatahandleForIntegration('newYorkCitySubwayModelRhs_wrapped', 'solver', func2str(integrator), 'options', odeoptionssubwaymodel);
datahandle = prepareDatahandleForIntegration('newYorkCitySubwayModelRhs_wrapped', 'integrator', func2str(integrator), 'options', odeoptionssubwaymodel);
sol = solveODE(datahandle, tspan, initValues, parameters);

sol_ode45 = ode45(@(t,x) newYorkCitySubwayModelRhs(t,x, nysscc_getPhysicsParameters()),tspan, initValues,odeoptionssubwaymodel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
parameters = nysscc_getPhysicsParameters_vector();
odeoptionssubwaymodel = odeset( 'AbsTol', 1e-20, 'RelTol', 1e-10);

datahandle = prepareDatahandleForIntegration('newYorkCitySubwayModelRhs_wrapped', 'solver', func2str(integrator), 'options', odeoptionssubwaymodel);
datahandle = prepareDatahandleForIntegration('newYorkCitySubwayModelRhs_wrapped', 'integrator', func2str(integrator), 'options', odeoptionssubwaymodel);
sol = solveODE(datahandle, tspan, initValues, parameters);

%% Precalculations for sensitivities
Expand Down
2 changes: 1 addition & 1 deletion Examples/subway/newYorkCityExampleIntegrationForThesis.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

tic
hdlnyc = prepareDatahandleForIntegration('newYorkCitySubwayModelRhs', ...
'solver', func2str(integrator), 'options', odeoptionssubwaymodel);
'integrator', func2str(integrator), 'options', odeoptionssubwaymodel);
toc

%%
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ We set ODE solver and its options as usual. If not set, default values are used.
initPaths(); % Initialise the paths for ifdiff
integrator = @ode45;
odeoptions = odeset('AbsTol', 1e-14, 'RelTol', 1e-12);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'solver', func2str(integrator), 'options', odeoptions);
datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', 'integrator', func2str(integrator), 'options', odeoptions);
```


Expand Down
2 changes: 1 addition & 1 deletion Readme_Example.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
odeoptions = odeset('AbsTol', 1e-8, 'RelTol', 1e-6);

datahandle = prepareDatahandleForIntegration('canonicalExampleRHS', ...
'solver', func2str(integrator), ...
'integrator', func2str(integrator), ...
'options', odeoptions);
tspan = [0 20];
initialvalues = [1; 0];
Expand Down
47 changes: 0 additions & 47 deletions Tools/isOptionlist.m

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function answer = assertOptionlist(object)
% assertOptionlist(object);
function answer = olAssertOptionlist(object)
% olAssertOptionlist(object);
%
% Asserts that the given object is an optionlist and returns true.
% Otherwise, an error is thrown.
Expand All @@ -8,12 +8,14 @@
%
% OUTPUT: answer - true if object is a valid optionlist.
%
% Copyright (c) 2016, Andreas Sommer
% Author: Andreas Sommer, 2016
% andreas.sommer@iwr.uni-heidelberg.de
% mail@andreas-sommer.eu
% code@andreas-sommer.eu
%
% History: Jul2024 --> renamed to ol* scheme

% ensure optionlist is an optionlist
[passed, problem] = isOptionlist(object);
[passed, problem] = olIsOptionlist(object);
if ~passed
error('Not a valid optionlist! Problem: %s', problem);
end
Expand Down
Loading