help-octave
[Top][All Lists]
Advanced

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

Re: R rep equivalent in octave


From: Francesco Potortì
Subject: Re: R rep equivalent in octave
Date: Mon, 11 Jul 2011 14:01:30 +0200

>forkandwait wrote:
>> repmat is the most idiomatic in the matlab world, as far as I know.
>> 
>> For more fun, though, 'help kron' for kronecker multiplication.
>> 
>I have to disagree with you. When repmat appeared, I substitued in my code
>'kron' by 'repmat', the two main advantages are:
>- predictibility. With kron, the shape of the output depends from the shape
>of both inputs. Getting the right repetition (rowise vs. columnwise) is not
>self-evident
>- performances. Basically, kron is a multiplicative framework. You waste CPU
>cycles computing values whose result is known.

As for performance, that is not necessarily true.  In Octave 2.1 repmat
was implemented using kron.  Now repmat uses kron only for the case of
sparse matrices, because the indexing code has been optimised and is now
faster than using kron.

-- 
Francesco Potortì (ricercatore)        Voice:  +39.050.315.3058 (op.2111)
ISTI - Area della ricerca CNR          Mobile: +39.348.8283.107
via G. Moruzzi 1, I-56124 Pisa         Fax:    +39.050.315.2040  
(entrance 20, 1st floor, room C71)     Web:    http://fly.isti.cnr.it


reply via email to

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