[Top][All Lists]

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

Re: Incompatable array calculation

From: Przemek Klosowski
Subject: Re: Incompatable array calculation
Date: Tue, 10 Jul 2018 13:32:31 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

On 07/10/2018 10:51 AM, Sergei Steshenko wrote:
There is no problem, this behaviour is called "broadcasting" :

.. which is a logical extension of a behavior that existed in Matlab language from the beginning:  2*[1,2,3] being evaluated to [2 4 6]
This is horrible bug causing a lot of trouble.
I could see it might be puzzling if you don't know about this behavior, or let it happen accidentally---but it is also very useful when used on purpose.
There's no point in complaining about it, though, provided there's a reliable way to print a warning for (1:2) + (1:2)'.

Having said that, I thought I remembered warning('on','Octave:broadcast') but it didn't do anything.
warning('on','Octave:language-extension')  warns about automatic broadcast---is that the recommended way? I don't remember what else it warns about.

octave:8>octave:8> (1:2) + (1:2)'
warning: performing `operator +' automatic broadcasting
ans =

   2   3
   3   4

reply via email to

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