Let k
and j
be vectors.
I need to calculate the value sum(f(j) g(k[i]))
for every i = 1, ..., length(k)
for two functions g
and f
(that are vectorized).
So, in other words, the sum is over each element in j
and I need to calculate that sum for every element in k
, so that I end up with length(k)
different sums.
What is the fastest way to do this in R?