> ## Content Index
> Fetch the complete content index at: https://bioinformatics.ghost.io/llms.txt
> Use this file to discover other available public pages before exploring further.

# Vectorization
- URL: https://bioinformatics.ghost.io/vectorization/
- Published: 2017-12-26T01:05:27.000Z
- Updated: 2017-12-26T01:05:27.000Z
- Author: Aarthi Ramakrishnan
- Tags: programming, #Import 2026-08-27 15:34

In any programming language, vectorization is a much more efficient way of dealing with numbers over writing a for loop. Following is an example in python

```python
x = [1, 2, 3]
y = [4, 5, 6]

def sum_of_product(x, y):
    summation = 0
    for i in range(0, len(x)):
        summation += x[i] * y[i]
    return summation

```

The above for loop can be implemented much more efficiently as follows using numpy:

```python
import numpy as np

x = [1, 2, 3]
y = [4, 5, 6]

def sum_of_product(x, y):     
	summation = np.dot(x,y) 
	return summation

```

This way, the code is efficient as well as concise.