From: <par...@us...> - 2010-12-17 20:34:33
|
Revision: 8025 http://octave.svn.sourceforge.net/octave/?rev=8025&view=rev Author: paramaniac Date: 2010-12-17 20:34:26 +0000 (Fri, 17 Dec 2010) Log Message: ----------- control: improve error messages for Lyapunov equation solvers Modified Paths: -------------- trunk/octave-forge/main/control/inst/dlyap.m trunk/octave-forge/main/control/inst/dlyapchol.m trunk/octave-forge/main/control/inst/lyap.m trunk/octave-forge/main/control/inst/lyapchol.m Modified: trunk/octave-forge/main/control/inst/dlyap.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyap.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/dlyap.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -39,7 +39,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [x, scale] = dlyap (a, b, c, e) @@ -49,11 +49,15 @@ case 2 # Lyapunov equation if (! is_real_square_matrix (a, b)) - error ("dlyap: a, b must be real and square"); + ## error ("dlyap: a, b must be real and square"); + error ("dlyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (rows (a) != rows (b)) - error ("dlyap: a, b must have the same number of rows"); + ## error ("dlyap: a, b must have the same number of rows"); + error ("dlyap: %s, %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [x, scale] = slsb03md (a, -b, true); # AXA' - X = -B @@ -63,11 +67,15 @@ case 3 # Sylvester equation if (! is_real_square_matrix (a, b)) - error ("dlyap: a, b must be real and square"); + ## error ("dlyap: a, b must be real and square"); + error ("dlyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (! is_real_matrix (c) || rows (c) != rows (a) || columns (c) != columns (b)) - error ("dlyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + ## error ("dlyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + error ("dlyap: %s must be a real (%dx%d) matrix", \ + rows (a), columns (b), inputname(3)); endif x = slsb04qd (-a, b, c); # AXB' - X = -C @@ -79,15 +87,21 @@ endif if (! is_real_square_matrix (a, b, e)) - error ("dlyap: a, b, e must be real and square"); + ## error ("dlyap: a, b, e must be real and square"); + error ("dlyap: %s, %s, %s must be real and square", \ + inputname(1), inputname(2), inputname(4)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("dlyap: a, b, e must have the same number of rows"); + ## error ("dlyap: a, b, e must have the same number of rows"); + error ("dlyap: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(4)); endif if (! issymmetric (b)) - error ("dlyap: b must be symmetric"); + ## error ("dlyap: b must be symmetric"); + error ("dlyap: %s must be symmetric", \ + inputname(2)); endif [x, scale] = slsg03ad (a, e, -b, true); # AXA' - EXE' = -B Modified: trunk/octave-forge/main/control/inst/dlyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/dlyapchol.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/dlyapchol.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -36,7 +36,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [u, scale] = dlyapchol (a, b, e) @@ -44,15 +44,21 @@ case 2 if (! is_real_square_matrix (a)) - error ("dlyapchol: a must be real and square"); + ## error ("dlyapchol: a must be real and square"); + error ("dlyapchol: %s must be real and square", \ + inputname(1)); endif if (! is_real_matrix (b)) - error ("dlyapchol: b must be real") + ## error ("dlyapchol: b must be real") + error ("dlyapchol: %s must be real", \ + inputname(2)) endif if (rows (a) != rows (b)) - error ("dlyapchol: a and b must have the same number of rows"); + ## error ("dlyapchol: a and b must have the same number of rows"); + error ("dlyapchol: %s and %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [u, scale] = slsb03od (a.', b.', true); @@ -62,15 +68,21 @@ case 3 if (! is_real_square_matrix (a, e)) - error ("dlyapchol: a, e must be real and square"); + ## error ("dlyapchol: a, e must be real and square"); + error ("dlyapchol: %s, %s must be real and square", \ + inputname(1), inputname(3)); endif if (! is_real_matrix (b)) - error ("dlyapchol: b must be real"); + ## error ("dlyapchol: b must be real"); + error ("dlyapchol: %s must be real", \ + inputname(2)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("dlyapchol: a, b, e must have the same number of rows"); + ## error ("dlyapchol: a, b, e must have the same number of rows"); + error ("dlyapchol: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(3)); endif [u, scale] = slsg03bd (a.', e.', b.', true); Modified: trunk/octave-forge/main/control/inst/lyap.m =================================================================== --- trunk/octave-forge/main/control/inst/lyap.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/lyap.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -39,7 +39,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [x, scale] = lyap (a, b, c, e) @@ -49,11 +49,16 @@ case 2 # Lyapunov equation if (! is_real_square_matrix (a, b)) - error ("lyap: a, b must be real and square"); + ## error ("lyap: a, b must be real and square"); + error ("lyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (rows (a) != rows (b)) - error ("lyap: a, b must have the same number of rows"); + ## error ("lyap: a, b must have the same number of rows"); + error ("lyap: %s, %s must have the same number of rows", \ + inputname(1), inputname(2)); + endif [x, scale] = slsb03md (a, -b, false); # AX + XA' = -B @@ -63,11 +68,15 @@ case 3 # Sylvester equation if (! is_real_square_matrix (a, b)) - error ("lyap: a, b must be real and square"); + ## error ("lyap: a, b must be real and square"); + error ("lyap: %s, %s must be real and square", \ + inputname(1), inputname(2)); endif if (! is_real_matrix (c) || rows (c) != rows (a) || columns (c) != columns (b)) - error ("lyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + ## error ("lyap: c must be a real (%dx%d) matrix", rows (a), columns (b)); + error ("lyap: %s must be a real (%dx%d) matrix", \ + rows (a), columns (b), inputname(3)); endif x = slsb04md (a, b, -c); # AX + XB = -C @@ -79,15 +88,21 @@ endif if (! is_real_square_matrix (a, b, e)) - error ("lyap: a, b, e must be real and square"); + ## error ("lyap: a, b, e must be real and square"); + error ("lyap: %s, %s, %s must be real and square", \ + inputname(1), inputname(2), inputname(4)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("lyap: a, b, e must have the same number of rows"); + ## error ("lyap: a, b, e must have the same number of rows"); + error ("lyap: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(4)); endif if (! issymmetric (b)) - error ("lyap: b must be symmetric"); + ## error ("lyap: b must be symmetric"); + error ("lyap: %s must be symmetric", \ + inputname(2)); endif [x, scale] = slsg03ad (a, e, -b, false); # AXE' + EXA' = -B Modified: trunk/octave-forge/main/control/inst/lyapchol.m =================================================================== --- trunk/octave-forge/main/control/inst/lyapchol.m 2010-12-17 18:30:10 UTC (rev 8024) +++ trunk/octave-forge/main/control/inst/lyapchol.m 2010-12-17 20:34:26 UTC (rev 8025) @@ -36,7 +36,7 @@ ## Author: Lukas Reichlin <luk...@gm...> ## Created: January 2010 -## Version: 0.2 +## Version: 0.2.1 function [u, scale] = lyapchol (a, b, e) @@ -44,15 +44,21 @@ case 2 if (! is_real_square_matrix (a)) - error ("lyapchol: a must be real and square"); + ## error ("lyapchol: a must be real and square"); + error ("lyapchol: %s must be real and square", \ + inputname(1)); endif if (! is_real_matrix (b)) - error ("lyapchol: b must be real") + ## error ("lyapchol: b must be real") + error ("lyapchol: %s must be real", \ + inputname(2)) endif if (rows (a) != rows (b)) - error ("lyapchol: a and b must have the same number of rows"); + ## error ("lyapchol: a and b must have the same number of rows"); + error ("lyapchol: %s and %s must have the same number of rows", \ + inputname(1), inputname(2)); endif [u, scale] = slsb03od (a.', b.', false); @@ -62,15 +68,21 @@ case 3 if (! is_real_square_matrix (a, e)) - error ("lyapchol: a, e must be real and square"); + ## error ("lyapchol: a, e must be real and square"); + error ("lyapchol: %s, %s must be real and square", \ + inputname(1), inputname(3)); endif if (! is_real_matrix (b)) - error ("lyapchol: b must be real"); + ## error ("lyapchol: b must be real"); + error ("lyapchol: %s must be real", \ + inputname(2)); endif if (rows (b) != rows (a) || rows (e) != rows (a)) - error ("lyapchol: a, b, e must have the same number of rows"); + ## error ("lyapchol: a, b, e must have the same number of rows"); + error ("lyapchol: %s, %s, %s must have the same number of rows", \ + inputname(1), inputname(2), inputname(3)); endif [u, scale] = slsg03bd (a.', e.', b.', false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |