[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:20:46 -0700 (PDT) |
----- Original Message -----
> From: Sergei Steshenko <address@hidden>
> To: Francesco Potortì <address@hidden>
> Cc: c. <address@hidden>; Octave users list <address@hidden>
> Sent: Sunday, July 1, 2012 11:09 PM
> Subject: Re: senseless warning in octave-3.6.2
>
>
>
>
>
> ----- 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.
>
A scaled down example:
"
octave:1> foo = zeros(1, 1e3);
octave:2> bar = ones(1e3, 1);
octave:3> doo = foo + bar;
warning: operator +: automatic broadcasting operation applied
octave:4> size(doo)
ans =
1000 1000
octave:5> size(foo)
ans =
1 1000
octave:6> size(bar)
ans =
1000 1
octave:7>
"
- why the result is a matrix despite the fact that both operands of the '+'
operator are vectors ?
Thanks,
Sergei.
>
- senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2, c., 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2, Francesco Potortì, 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2, Francesco Potortì, 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2,
Sergei Steshenko <=
- Re: senseless warning in octave-3.6.2, Francesco Potortì, 2012/07/01
- Re: senseless warning in octave-3.6.2, Mero, 2012/07/02
- Re: senseless warning in octave-3.6.2, Jordi Gutiérrez Hermoso, 2012/07/02
- Re: senseless warning in octave-3.6.2, Mero, 2012/07/02
- Re: senseless warning in octave-3.6.2, c., 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2, Jordi Gutiérrez Hermoso, 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01
- Re: senseless warning in octave-3.6.2, Ben Abbott, 2012/07/01
- Re: senseless warning in octave-3.6.2, Sergei Steshenko, 2012/07/01