Skip to content

Commit

Permalink
minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsdev committed Nov 15, 2017
1 parent 22eeb95 commit 04638e6
Showing 7 changed files with 471 additions and 39 deletions.
3 changes: 3 additions & 0 deletions external/symbol.m
Original file line number Diff line number Diff line change
@@ -27,6 +27,9 @@
nList = [nList {'skull' 'sun' 'moon' 'ok' 'Angstrom' '^0' '^1' '^2' '^3' '^-' 'bra' 'ket'}];
cList = [cList char([9760 9788 9789 10004 197 8304 185 178 179 8315 10216 10217])];

nList = [nList {'leq' 'geq' 'equiv' 'll' 'gg' 'propto'}];
cList = [cList char([8818 8819 8801 8810 8811 8733 ])];

nL = numel(nList);

if nargin == 0
4 changes: 2 additions & 2 deletions swfiles/+ndbase/lm.m
Original file line number Diff line number Diff line change
@@ -201,9 +201,9 @@
end

% previous set of parameters
pOld = zeros(1,Np);
pOld = p0(:)';
% previous model values: yOld = func(x,pOld)
yOld = zeros(Nx,1);
yOld = func(dat.x,pOld);
% empty Jacobian matrix
J = zeros(Nx,Np);
% empty output
18 changes: 9 additions & 9 deletions swfiles/+ndbase/pso.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function [pOpt,fVal,stat] = pso(dat,func,p0,varargin)
% minimization via particle swarm optimisation
% particle swarm optimisation
%
% [pOpt,fVal,stat] = NDBASE.PSO([],func,p0,'Option1','Value1',...)
%
@@ -140,10 +140,10 @@
end

% number of free parameters
Nf = sum(UB>LB);
Nv = sum(UB>LB);

if param.autoTune
param.PopulationSize = round(25 + 1.4*Nf);
param.PopulationSize = round(25 + 1.4*Nv);
end

% population size
@@ -199,15 +199,15 @@
stat.redX2 = fVal;
else
% divide R2 with the statistical degrees of freedom
stat.redX2 = fVal/(numel(dat.x)-Np+1);
stat.redX2 = fVal/(numel(dat.x)-Nv+1);
end

stat.Rsq = [];
stat.sigY = [];
stat.corrP = [];
stat.cvgHst = [];
stat.nIter = 0;
stat.nFunEvals = 1;
stat.iterations = 0;
stat.funcCount = 1;
stat.algorithm = 'Particle Swarm Optimization';
if isempty(dat)
stat.func = func;
@@ -384,15 +384,15 @@
stat.redX2 = fVal;
else
% divide R2 with the statistical degrees of freedom
stat.redX2 = fVal/(numel(dat.x)-Np+1);
stat.redX2 = fVal/(numel(dat.x)-Nv+1);
end

stat.Rsq = [];
stat.sigY = [];
stat.corrP = [];
stat.cvgHst = [];
stat.nIter = ii;
stat.nFunEvals = ii*popSize;
stat.iterations = ii;
stat.funcCount = ii*popSize;
stat.algorithm = 'Particle Swarm Optimization';
if isempty(dat)
stat.func = func;
Loading

0 comments on commit 04638e6

Please sign in to comment.