Mercurial > hg > octave-avbm
changeset 3760:735549d1148e
[project @ 2001-01-03 20:26:57 by jwe]
author | jwe |
---|---|
date | Wed, 03 Jan 2001 20:26:59 +0000 |
parents | 110bc441a954 |
children | dfb1bfa12afd |
files | doc/interpreter/func.txi liboctave/CMatrix.cc liboctave/ChangeLog src/ChangeLog src/ov-cx-mat.cc |
diffstat | 5 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -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
--- a/liboctave/CMatrix.cc +++ b/liboctave/CMatrix.cc @@ -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;
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2001-01-02 John W. Eaton <jwe@bevo.che.wisc.edu> + + * CMatrix.cc (operator * (const ComplexMatrix&, const ComplexMatrix&): + Return correct size result for empty matrix case. + 2000-12-15 John W. Eaton <jwe@bevo.che.wisc.edu> * lo-mappers.cc (xmin (const Complex&, const Complex& y):
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-01-02 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ov-cx-mat.cc (octave_complex_matrix::try_narrowing_conversion): + Handle empty matrix dimensions correctly. + 2000-12-14 John W. Eaton <jwe@bevo.che.wisc.edu> * pager.h (octave_pager_buf::diary_skip): New data member.
--- a/src/ov-cx-mat.cc +++ b/src/ov-cx-mat.cc @@ -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));