help-octave
[Top][All Lists]
Advanced

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

Re: Difference of columns


From: Ismael Núñez-Riboni
Subject: Re: Difference of columns
Date: Thu, 29 Aug 2013 21:45:34 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5


On 08/29/2013 05:14 PM, Jordi Gutiérrez Hermoso wrote:
> On Thu, 2013-08-29 at 13:30 +0200, Ismael Núñez-Riboni wrote:
>>>> Suppose that we have N columns in a matrix, how we can perform a
>>>> program that take into account all possible differences between these
>>>> N columns.
>>
>> You need a double loop, I see no other (easy) way, if your matrix is A:
>
> I wish broadcasting were more well-known, because it is supposed to be
> precisely this easy way.

Seldom I answer a query in the help list but it is amazing how every time I do I get more than what I give... Indeed, I was actually thinking on a complicated use of permute to build tensors and subtract them along a particular dimension... I had no idea that what was behind of an obscure warning popping up when I made an error with vector dimensions ("automatic broadcasting operation applied") was actually such a powerful tool. Thanks a lot for this. To your very illustrating explanation I would add what I found in Internet:

http://www.gnu.org/software/octave/doc/interpreter/Broadcasting.html

I'll give it a try the next time I need a double loop. Obviously, broadcasting is faster that nested loops, isn't it? Cheers, I.


reply via email to

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