Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

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 it mean, and what it does? So I'm asking here, what is vectorization, and what does it mean for example, that "a loop is vectorized" ?

Answer*

Draft saved
Draft discarded

Required fields are marked with *

Cancel
4
  • while performing an operation on individual elements of an array which we call scaler coding... - If you're doing a scalar loop over the elements in a high-level language like Python, your code isn't vectorized. Vectorized code is the alternative, where iterating over elements only happens inside the optimized functions, not visible in your source. I assume you know that, but throwing in a definition of "scalar" coding in the middle of that sentence makes it sound like you're talking about compilers turning scalar loops into vector code. Commented Feb 2, 2022 at 10:23
  • (C/C++ compilers do auto-vectorize, but don't invent calls to library functions other than sometimes memcpy.) Commented Feb 2, 2022 at 10:23
  • Thank you for adding your comment but what I mean to say as simply as I can vectorization is refer to all the techniques that convert scaler implementation, in which single operation process single entity at a time to vector implementation in which single operation process multiple entities at the same time. Commented Feb 2, 2022 at 17:45
  • Right, that's correct. I'd recommend you edit your answer to actually say that, instead of sounding like you're saying that "performing an operation on individual elements of an array" magically turns into optimized operations using SIMD, threads, and/or native code (for languages that don't already compile to native code) Commented Feb 3, 2022 at 1:39