Mercurial > hg > octave-nkf
changeset 4982:c0866f89c43d
[project @ 2004-09-10 13:48:18 by jwe]
author | jwe |
---|---|
date | Fri, 10 Sep 2004 13:48:18 +0000 |
parents | 0e7d04102ccf |
children | 13aaef87cf18 |
files | src/ChangeLog src/ov-intx.h |
diffstat | 2 files changed, 46 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2004-09-10 David Bateman <dbateman@free.fr> + + * ov-intx.h (OCTAVE_VALUE_INT_MATRIX_T::double_value, + OCTAVE_VALUE_INT_MATRIX_T::scalar_value, + OCTAVE_VALUE_INT_SCALAR_T::double_value, + OCTAVE_VALUE_INT_SCALAR_T::scalar_value): New functions. + 2004-09-10 John W. Eaton <jwe@octave.org> * ov-base-scalar.h (octave_base_scalar::clone,
--- a/src/ov-intx.h +++ b/src/ov-intx.h @@ -35,6 +35,7 @@ #include "ov-base.h" #include "ov-base-int.h" #include "ov-typeinfo.h" +#include "gripes.h" class OCTAVE_VALUE_INT_MATRIX_T @@ -62,6 +63,32 @@ OCTAVE_VALUE_INT_NDARRAY_EXTRACTOR_FUNCTION (void) const { return matrix; } + double + double_value (bool = false) const + { + double retval = lo_ieee_nan_value (); + + if (numel () > 0) + { + // XXX FIXME XXX -- is warn_fortran_indexing the right variable here? + if (Vwarn_fortran_indexing) + gripe_implicit_conversion (type_name (), "real scalar"); + + retval = double (matrix (0, 0)); + } + else + gripe_invalid_conversion (type_name (), "real scalar"); + + return retval; + + } + + double + scalar_value (bool = false) const + { + return double_value (); + } + NDArray array_value (bool = false) const { @@ -155,6 +182,18 @@ octave_value resize (const dim_vector& dv) const { OCTAVE_INT_NDARRAY_T retval (dv); if (dv.numel()) retval(0) = scalar; return retval; } + double + double_value (bool = false) const + { + return double (scalar); + } + + double + scalar_value (bool = false) const + { + return double (scalar); + } + NDArray array_value (bool = false) const {