dhd.utils¶
List of functions of general usage.
Functions¶
-
dhd.utils.
distance
(p1, p2)[source]¶ Function to compute the euclidean distance between the points p1 and p2.
Parameters: - p1 (tuple) – Coordinates of the first point.
- p2 (tuple) – Coordinates of the second point.
Returns: Distance between p1 and p2.
Return type: float
-
dhd.utils.
get_list_transpose
(list)[source]¶ Take the transpose of a list of tuples.
Parameters: list (list) – List of tuples. Ex. [(1,2),(2,3),(3,4)]. Returns: Transpose of the list. Ex [[1,2,3],[2,3,4]]. Return type: list
-
dhd.utils.
get_moment
(data, n)[source]¶ Compute the n moment of the data list data.
Parameters: - data (list) – Data to take the moment of.
- n (int) – Moment number.
Returns: n moment of the data.
Return type: float
-
dhd.utils.
normalized_inner_product
(x, y)[source]¶ Compute the inner product of two vectors and divide by the product of their lengths, namely the cosine of the angle between them.
Parameters: - x (numpy.array) – First vector.
- y (numpy.array) – Second vector.
Returns: Cosine of the angle between the two vectors.
Return type: float