octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reason for removing code to convert to scalar when doing numeric co


From: Jaroslav Hajek
Subject: Re: reason for removing code to convert to scalar when doing numeric conversion?
Date: Wed, 1 Apr 2009 09:18:11 +0200

On Wed, Apr 1, 2009 at 1:14 AM, John W. Eaton <address@hidden> wrote:
> In this changeset:
>
>  # HG changeset patch
>  # User Jaroslav Hajek <address@hidden>
>  # Date 1227618295 -3600
>  # Node ID c777f3ce02d87e6ddd0818b0b3a02efd82c502b9
>  # Parent  b5f10b12344021c1c2b708d4d27437cb61b15870
>  smarter conversion lookup
>
> the following change was made to the
> octave_default_numeric_conversion_function:
>
>  diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc
>  --- a/src/ov-str-mat.cc
>  +++ b/src/ov-str-mat.cc
>  @@ -66,21 +66,16 @@
>
>     NDArray nda = v.array_value (true);
>
>  -  if (! error_state)
>  -    {
>  -      if (nda.numel () == 1)
>  -     retval = new octave_scalar (nda(0));
>  -      else
>  -     retval = new octave_matrix (nda);
>  -    }
>  +  if (! error_state) retval = new octave_matrix (nda);
>
>     return retval;
>   }
>
> What is the reason for this change?  It breaks things like
>
>  [97, 98] == 'a'
>
> because without the conversion to a scalar type the comparison fails
> with a nonconformant argument error.
>

I don't know anymore, but I guess I thought that there is a separate
"scalar character" class.

> Is there any reason not to revert this change?
>

No. I reverted it.

regards

-- 
RNDr. Jaroslav Hajek
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]