help-octave
[Top][All Lists]
Advanced

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

Re: griddata


From: John W. Eaton
Subject: Re: griddata
Date: Mon, 10 Nov 2003 19:19:21 -0600

On 10-Nov-2003, Paul Kienzle <address@hidden> wrote:

| There is a bug in octave introduced sometime between octave
| 2.1.40 and 2.1.48 where the wrong thing happens if the shape
| of a boolean indexing matrix does not match the shape of the
| matrix being indexed.
| 
| E.g.,
| 
| octave-2.1.40> x=[1,2;3,4]; x(:)'(x!=4)
| ans =
| 
|   1  3  2
| 
| octave-2.1.48> x=[1,2;3,4]; x(:)'(x!=4)
| ans =
| 
|   1  2
|   3  5
| 
| It is still present in octave-2.1.50.

I just checked in the following change to fix this problem.  Because
of the extensive changes that have been made recently to support N-d
arrays, this patch will not apply directly to the 2.1.50 sources, but
it should give you an idea of what to do if you want to fix 2.1.50.
For that version, I think the function to look at should be
Array2<T>::index in Array2-idx.h.

jwe


2003-11-10  John W. Eaton  <address@hidden>

        * Array.cc (Array<T>::index2): Return value has orientation of
        indexed value if indexing a vector with a bool matrix.

Index: liboctave/Array.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/Array.cc,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- liboctave/Array.cc  10 Nov 2003 17:18:48 -0000      1.70
+++ liboctave/Array.cc  11 Nov 2003 01:13:09 -0000      1.71
@@ -1656,7 +1656,8 @@
        }
       else
        {
-         if (idx_orig_rows == 1 || idx_orig_columns == 1)
+         if (idx_arg.one_zero_only ()
+             || idx_orig_rows == 1 || idx_orig_columns == 1)
            {
              if (nr == 1)
                retval = Array<T> (tmp, dim_vector (1, len));



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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