octave-maintainers
[Top][All Lists]
Advanced

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

x(idx)=y(idx) for empty idx


From: Paul Kienzle
Subject: x(idx)=y(idx) for empty idx
Date: Wed, 3 Mar 2004 03:30:57 -0500

Consider:

        y = rand(100);
        idx = y>1;
        y(idx) = y(idx)-1;

With warn_fortran_indexing=1, this prints:

        warning: A(idx) = []: expecting A to be row or column vector or scalar

As a result we have a bunch of code like this:

        idx = condition;
        if any ( idx (:))
            A(idx) = f(A(idx));
        end

instead of:

        idx = condition;
        A(idx) = f(A(idx));


For dimension != 2, the simple code seg faults (but only
for empty idx):

  octave:1> y = rand(10,10,10);
  octave:2> idx = y>1;
  octave:3> y(idx) = y(idx)-1;
  panic: Segmentation fault -- stopping myself...

System: Debian, with CVS download from 2004-03-02.

Paul Kienzle
address@hidden



reply via email to

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