From: <tr...@us...> - 2010-06-01 19:34:13
|
Revision: 7379 http://octave.svn.sourceforge.net/octave/?rev=7379&view=rev Author: treichl Date: 2010-06-01 19:34:07 +0000 (Tue, 01 Jun 2010) Log Message: ----------- Added changes that were sent by Sebastian Schoeps. Modified Paths: -------------- trunk/octave-forge/main/odepkg/inst/odebwe.m trunk/octave-forge/main/odepkg/inst/odeget.m Modified: trunk/octave-forge/main/odepkg/inst/odebwe.m =================================================================== --- trunk/octave-forge/main/odepkg/inst/odebwe.m 2010-06-01 19:00:29 UTC (rev 7378) +++ trunk/octave-forge/main/odepkg/inst/odebwe.m 2010-06-01 19:34:07 UTC (rev 7379) @@ -362,16 +362,19 @@ end vnpds = vnpds + 1; vfulljac = vmass/vthestep - vjac; - % use sparse lu decomposition if possible - [L,U,P] = lu(vfulljac); - vndecomps = vndecomps + 1; + %# one could do a matrix decomposition of vfulljac here, + %# but the choice of decomposition depends on the problem + %# and therefore we use the backslash-operator in row 374 end %# Compute the residual vres = vmass/vthestep*(y(j,:)-y0)' - feval(vfun,vthetime,y(j,:)',vfunarguments{:}); vresnrm(vnewtit+1) = norm(vres,inf); %# Solve the linear system - y(j,:) = U\(L\(P*(-vres+vfulljac*y(j,:)'))); + y(j,:) = vfulljac\(-vres+vfulljac*y(j,:)'); + %# the backslash operator decomposes the matrix + %# and solves the system in a single step. + vndecomps = vndecomps + 1; vnlinsols = vnlinsols + 1; %# Prepare next iteration vnewtit = vnewtit + 1; Modified: trunk/octave-forge/main/odepkg/inst/odeget.m =================================================================== --- trunk/octave-forge/main/odepkg/inst/odeget.m 2010-06-01 19:00:29 UTC (rev 7378) +++ trunk/octave-forge/main/odepkg/inst/odeget.m 2010-06-01 19:34:07 UTC (rev 7379) @@ -76,7 +76,15 @@ %# Run through number of input arguments given for vcntarg = 1:vint.lengtharg - if (vint.odestruct.(vint.arguments{vcntarg}) == vint.otemplate.(vint.arguments{vcntarg})) + if ((... + isempty(vint.odestruct.(vint.arguments{vcntarg})) + )||( ... + ischar(vint.odestruct.(vint.arguments{vcntarg})) && ... + strcmp(vint.odestruct.(vint.arguments{vcntarg}),vint.otemplate.(vint.arguments{vcntarg}))... + )||(... + ~ischar(vint.odestruct.(vint.arguments{vcntarg})) && ... + vint.odestruct.(vint.arguments{vcntarg}) == vint.otemplate.(vint.arguments{vcntarg}) ... + )) if (nargin == 3), vint.returnval{vcntarg} = vint.defaults{vcntarg}; else, vint.returnval{vcntarg} = vint.odestruct.(vint.arguments{vcntarg}); end else, vint.returnval{vcntarg} = vint.odestruct.(vint.arguments{vcntarg}); @@ -87,10 +95,12 @@ if (vint.lengtharg == 1), vret = vint.returnval{1}; else, vret = vint.returnval; end -%!test odeget (odeset, 'RelTol'); -%!test odeget (odeset, 'RelTol', 10); -%!test odeget (odeset, {'RelTol', 'AbsTol'}); -%!test odeget (odeset, {'RelTol', 'AbsTol'}, {10 20}); +%!test assert (odeget (odeset (), 'RelTol'), []); +%!test assert (odeget (odeset (), 'RelTol', 10), 10); +%!test assert (odeget (odeset (), {'RelTol', 'AbsTol'}), {[] []}) +%!test assert (odeget (odeset (), {'RelTol', 'AbsTol'}, {10 20}), {10 20}); +%!test assert (odeget (odeset (), 'Stats'), 'off'); +%!test assert (odeget (odeset (), 'Stats', 'on'), 'on'); %!demo %! # Return the manually changed value RelTol of the OdePkg options This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |