I am quite a beginner at using Julia and this is my first post, so apologies if there is an obvious answer! I would like to find out if there is an easy way to perform the sumproduct excel function in Julia.
As an example, I currently have the following vectors:
vec_1 = [a,b,c]
vec_2 = [e,f,g]
I would like to end up with a vector containing:
vec_3 = [ae, (ae) + (bf), (ae) + (bf) + (cg)]
I would be able to do this manually, but am quite interested if there is a streamlined way
This is an inner product (a dot product). vec_1' * vec_2 (or just vec_1'vec_2) will do what you want. Sorry, I misread your question; this iscumsum(vec_1 .* vec_2).
(Technically, if your vectors are complex numbers, then vec_1' * vec_2 will also conjugate the elements of vec_1 in the product. If you needed an “unconjugated” dot product for complex vectors, you could do transpose(vec_2) * vec_2.)