# HG changeset patch # User jwe # Date 978553619 0 # Node ID 735549d1148ecb12635b7d000d2dfaa92045ea63 # Parent 110bc441a9543567ad5fb1dbeedf4cba0feb5d78 [project @ 2001-01-03 20:26:57 by jwe] diff -r 110bc441a954 -r 735549d1148e doc/interpreter/func.txi --- a/doc/interpreter/func.txi Sat Dec 16 01:25:13 2000 +0000 +++ b/doc/interpreter/func.txi Wed Jan 03 20:26:59 2001 +0000 @@ -709,7 +709,7 @@ @{ ColumnVector dx (3); - ColumnVector x = args(0).vector_value (); + ColumnVector x (args(0).vector_value ()); dx(0) = 77.27 * (x(1) - x(0)*x(1) + x(0) - 8.375e-06*pow (x(0), 2)); @@ -763,14 +763,18 @@ differential equation, and the statement @example -ColumnVector x = args(0).vector_value (); +ColumnVector x (args(0).vector_value ()); @end example @noindent -extracts a column vector from the input arguments. The variable -@code{args} is passed to functions defined with @code{DEFUN_DLD} as an -@code{octave_value_list} object, which includes methods for getting the -length of the list and extracting individual elements. +extracts a vector from the first input argument. The +@code{vector_value} method is used so that the user of the function +can pass either a row or column vector. The @code{ColumnVector} +constructor is needed because the ODE class requires a column +vector. The variable @code{args} is passed to functions defined with +@code{DEFUN_DLD} as an @code{octave_value_list} object, which includes +methods for getting the length of the list and extracting individual +elements. In this example, we don't check for errors, but that is not difficult. All of the Octave's built-in functions do some form of checking on their diff -r 110bc441a954 -r 735549d1148e liboctave/CMatrix.cc --- a/liboctave/CMatrix.cc Sat Dec 16 01:25:13 2000 +0000 +++ b/liboctave/CMatrix.cc Wed Jan 03 20:26:59 2001 +0000 @@ -3008,7 +3008,7 @@ else { if (nr == 0 || nc == 0 || a_nc == 0) - retval.resize (nr, nc, 0.0); + retval.resize (nr, a_nc, 0.0); else { int ld = nr; diff -r 110bc441a954 -r 735549d1148e liboctave/ChangeLog --- a/liboctave/ChangeLog Sat Dec 16 01:25:13 2000 +0000 +++ b/liboctave/ChangeLog Wed Jan 03 20:26:59 2001 +0000 @@ -1,3 +1,8 @@ +2001-01-02 John W. Eaton + + * CMatrix.cc (operator * (const ComplexMatrix&, const ComplexMatrix&): + Return correct size result for empty matrix case. + 2000-12-15 John W. Eaton * lo-mappers.cc (xmin (const Complex&, const Complex& y): diff -r 110bc441a954 -r 735549d1148e src/ChangeLog --- a/src/ChangeLog Sat Dec 16 01:25:13 2000 +0000 +++ b/src/ChangeLog Wed Jan 03 20:26:59 2001 +0000 @@ -1,3 +1,8 @@ +2001-01-02 John W. Eaton + + * ov-cx-mat.cc (octave_complex_matrix::try_narrowing_conversion): + Handle empty matrix dimensions correctly. + 2000-12-14 John W. Eaton * pager.h (octave_pager_buf::diary_skip): New data member. diff -r 110bc441a954 -r 735549d1148e src/ov-cx-mat.cc --- a/src/ov-cx-mat.cc Sat Dec 16 01:25:13 2000 +0000 +++ b/src/ov-cx-mat.cc Wed Jan 03 20:26:59 2001 +0000 @@ -68,8 +68,8 @@ else retval = new octave_complex (c); } - else if (nr == 0 && nc == 0) - retval = new octave_matrix (Matrix ()); + else if (nr == 0 || nc == 0) + retval = new octave_matrix (Matrix (nr, nc)); else if (matrix.all_elements_are_real ()) retval = new octave_matrix (::real (matrix));