octave-maintainers
[Top][All Lists]
Advanced

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

reason for removing code to convert to scalar when doing numeric convers


From: John W. Eaton
Subject: reason for removing code to convert to scalar when doing numeric conversion?
Date: Tue, 31 Mar 2009 16:14:16 -0700

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.

Is there any reason not to revert this change?

Thanks,

jwe


reply via email to

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