help-octave
[Top][All Lists]
Advanced

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

Re: senseless warning in octave-3.6.2


From: Francesco Potortì
Subject: Re: senseless warning in octave-3.6.2
Date: Sun, 01 Jul 2012 22:02:21 +0200

>Here is a small test case:
>
>"
>octave:1> foo = zeros(1, 1e6);
>octave:2> bar = ones(1e6, 1);
>octave:3> doo = foo + bar;
>warning: operator +: automatic broadcasting operation applied
>error: memory exhausted or requested size too large for range of Octave's 
>index type -- trying to return to prompt
>octave:3> doo = foo' + bar;
>octave:4>     
>"
>
>which illustrates the problem
>
>Is it a bug or a feature ?

This is a feature.  Excerpt from the 3.6 NEWS:

 ** Many of Octave's binary operators (.*, .^, +, -, ...) now perform
    automatic broadcasting for array operations which allows you to use
    operator notation instead of calling bsxfun or expanding arrays (and
    unnecessarily wasting memory) with repmat or similar idioms.  For
    example, to scale the columns of a matrix by the elements of a row
    vector, you may now write

      rv .* M

    In this expression, the number of elements of rv must match the
    number of columns of M.  The following operators are affected:

      plus      +  .+
      minus     -  .-
      times     .*
      rdivide   ./
      ldivide   .\
      power     .^  .**
      lt        <
      le        <=
      eq        ==
      gt        >
      ge        >=
      ne        !=  ~=
      and       &
      or        |
      atan2
      hypot
      max
      min
      mod
      rem
      xor

    additionally, since the A op= B assignment operators are equivalent
    to A = A op B, the following operators are also affected:

      +=  -=  .+=  .-=  .*=  ./=  .\=  .^=  .**=  &=  |=

    See the "Broadcasting" section in the new "Vectorization and Faster
    Code Execution" chapter of the manual for more details.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

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