help-octave
[Top][All Lists]
Advanced

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

Re: Incompatable array calculation


From: Sergei Steshenko
Subject: Re: Incompatable array calculation
Date: Wed, 11 Jul 2018 05:23:37 +0000 (UTC)



On Tuesday, July 10, 2018, 8:34:22 PM GMT+3, Przemek Klosowski <address@hidden> wrote:


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

https://octave.org/doc/v4.4.0/Broadcasting.html

.. 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

 
Your reply is self-contradictory.

I never needed this automatic broadcasting. I'm still using octave-3.6.4, and in ti I can't turn the warning into error.

It's a horrible bug.

--Sergei.

reply via email to

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