vectorize

Is it possible to vectorize myNum += a[b[i]] * c[i]; on x86_64?

What intrinsics would I use to vectorize the following(if it's even possible to vectorize) on the x86_64? double myNum = 0; for(int i=0;i<n;i++){ myNum += a[b[i]] * c[i]; //b[i] = int, a[b[i]] = double, c[i] = double } ...

Problem: Vectorizing Code with Intel Visual FORTRAN for X64

I'm compiling my fortran90 code using Intel Visual FORTRAN on Windows Server 2003 Enterprise X64 Edition. When I compile the code for 32 bit structure and using automatic and manual vectorizing options. The code will be compiled, vectorized. And when I run it on 8 core system the compiled code uses 70% of CPU that shows me that vectorizi...

[R] how to avoid loops

HI All, I'm new to R. I have two panel data files, with columns "id", "date" and "ret" file A has a lot more data than file B, but i'm primarily working with file B data. Combination of "id" and "date" is unqiue indentifier. Is there an elegent way of looking up for each (id, date) in B, I need to get the past 10 days ret from file...

Using Numpy Vectorize on Functions that Return Vectors

numpy.vectorize takes a function f:a->b and turns it into g:a[]->b[]. This works fine when a and b are scalars, but I can't think of a reason why it wouldn't work with b as an ndarray or list, i.e. f:a->b[] and g:a[]->b[][] For example: import numpy as np def f(x): return np.array([1,1,1,1,1], dtype=np.float32) * x g = np.vectorize(f,...