forked from diffpy/diffpy.fourigui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
31 lines (25 loc) · 693 Bytes
/
functions.py
File metadata and controls
31 lines (25 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import numpy as np
def dot_product(a, b):
"""Compute the dot product of two vectors of any size.
Ensure that the inputs, a and b, are of the same size.
The supported types are "array_like" objects, which can
be converted to a NumPy array. Examples include lists and tuples.
Parameters
----------
a : array_like
The first input vector.
b : array_like
The second input vector.
Returns
-------
float
The dot product of the two vectors.
Examples
--------
Compute the dot product of two lists:
>>> a = [1, 2, 3]
>>> b = [4, 5, 6]
>>> dot_product(a, b)
32.0
"""
return float(np.dot(a, b))