help-octave
[Top][All Lists]
Advanced

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

Re: Vectorizing a summation


From: Bård Skaflestad
Subject: Re: Vectorizing a summation
Date: Tue, 29 Jan 2013 16:56:18 +0100

On Tue, 2013-01-29 at 07:33 -0800, rdelgado wrote:
> The final calculation is:
> 
> Distance^2 = Sum (from i, j=1...MxN) [ exp(-|Pi-Pj|) * (Xi-Yi) * (Xj-Yj) ]
> 
> As you can see, I am a little confused of the definition.

Okay, so you are actually computing a type of inner product.

        Distance^2 = d' * E * d

in which

        d = reshape(X - Y, [], 1);

Now your task (homework?) is to compute the entries of 'E' in a
vectorised manner.


Sincerely,
-- 
Bård Skaflestad <address@hidden>



reply via email to

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