help-octave
[Top][All Lists]
Advanced

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

Re: Applying each element of a vector to each row of a matrix


From: Jordi Gutiérrez Hermoso
Subject: Re: Applying each element of a vector to each row of a matrix
Date: Sun, 19 Dec 2010 15:40:48 -0600

On 19 December 2010 14:09, Olaf Till <address@hidden> wrote:
> octave:4> cat (2, cellfun (@ (x) x .^ ones (4, 1), num2cell (ones (4, 3), 1), 
> "UniformOutput", false){:})

Can that really be better than a hypothetical ones(3,4).^ones(4,1) ?

I thought the reason this isn't implemented is that it doesn't map to
a BLAS function or similar, but now I see that elem_xpow is
implemented naïvely (i.e. no dark arts) in the C++ sources using
std::pow (found in src/xpow.cc:812 at hg changeset
11392:757efa1d7e2a).

There must be a reason I'm overlooking for why my proposed extension
to elementwise operators is a bad idea. Bad semantics? Encourages bad
practices? Insufficiently important corner case?

- Jordi G. H.



reply via email to

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