Closed AndreyAPopov closed 1 year ago
Alright, this seems to be in a good place now. It uses asserts, and fails if anything wrong happens. I also optimised the runtime.
A simpler way to load all the presets:
function presets = getPresets()
presets = arrayfun(@constructPreset, dir('+otp/*/+presets/*.m'), 'UniformOutput', false);
end
function preset = constructPreset(file)
[~, presetName, ~] = fileparts(file.name);
folders = strsplit(file.folder, filesep)
problemName = folders{end-1};
preset = eval(sprintf('otp.%s.presets.%s', problemName(2:end), presetName));
end
A simpler way to load all the presets:
function presets = getPresets() presets = arrayfun(@constructPreset, dir('+otp/*/+presets/*.m'), 'UniformOutput', false); end function preset = constructPreset(file) [~, presetName, ~] = fileparts(file.name); folders = strsplit(file.folder, filesep) problemName = folders{end-1}; preset = eval(sprintf('otp.%s.presets.%s', problemName(2:end), presetName)); end
This doesn't work in general. I'm trying to generalize it to when the working dir is not src
Got it working now
I am in the process of reworking the tests and adding more.
The derivative code is very much a work-in-progress, so it is not much to look at at the moment.