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: Sergei Steshenko
Subject: Re: senseless warning in octave-3.6.2
Date: Sun, 1 Jul 2012 13:09:00 -0700 (PDT)




----- Original Message -----
> From: Francesco Potortì <address@hidden>
> To: Sergei Steshenko <address@hidden>
> Cc: c. <address@hidden>; Octave users list <address@hidden>
> Sent: Sunday, July 1, 2012 11:02 PM
> Subject: Re: senseless warning in octave-3.6.2
> 
>> 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.
> 

If it is a feature, why did it fail ? Is the expected behavior to create a 1e6 
x 1e6 matrix ?

Thanks,
  Sergei.





>


reply via email to

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