Top "Vectorization" questions

Vectorization refers to a programming paradigm where functions operate on whole arrays in one go.

Is there an R function for finding the index of an element in a vector?

In R, I have an element x and a vector v. I want to find the first index of an …

r indexing match vectorization
Difference between map, applymap and apply methods in Pandas

Can you tell me when to use these vectorization methods with basic examples? I see that map is a Series …

python pandas dataframe vectorization
numpy array TypeError: only integer scalar arrays can be converted to a scalar index

i=np.arange(1,4,dtype=np.int) a=np.arange(9).reshape(3,3) and a >>>array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) a[:,0:1] >>>…

python numpy indexing vectorization
Why are elementwise additions much faster in separate loops than in a combined loop?

Suppose a1, b1, c1, and d1 point to heap memory and my numerical code has the following core loop. const …

c++ performance x86 vectorization compiler-optimization
Efficient evaluation of a function at every cell of a NumPy array

Given a NumPy array A, what is the fastest/most efficient way to apply the same function, f, to every …

python performance function numpy vectorization
How can I apply a function to every row/column of a matrix in MATLAB?

You can apply a function to every item in a vector by saying, for example, v + 1, or you can use …

matlab function matrix vectorization
How do I compare all elements of two arrays?

I have two big arrays with about 1000 rows and 1000 columns. I need to compare each element of these arrays and …

matlab comparison matrix vectorization
What is "vectorization"?

Several times now, I've encountered this term in matlab, fortran ... some other ... but I've never found an explanation what does …

vectorization
How to assign values to a MATLAB matrix on the diagonal?

Suppose I have an NxN matrix A, an index vector V consisting of a subset of the numbers 1:N, and …

matlab vectorization
Vectorized IF statement in R?

x <- seq(0.1,10,0.1) y <- if (x < 5) 1 else 2 I would want the if to operate on every …

r if-statement vectorization