util module
- util.add_tuples(a, b)
Method to add 2 tuples together. If lengths of tuples mismatch the last n indices are of the longest tuple are unaffected.
- Parameters
a – Tuple of length i.
b – Tuple of length j.
- Returns
Tuple of length max(i,j).
- util.average_tuples(a, b)
Get the element-wise average of 2 tuples.
- Parameters
a – Tuple of length i
b – Tuple of length i
- Returns
Tuple of length i
- util.create_distance_matrix(points)
Creates a distance matrix of a set of points, using the norm distance.
- Parameters
points – A list or pytorch Tensor of coordinates of points.
- Returns
A pytorch Tensor containing the distance matrix.
- util.multiply_tuple(scalar, tup)
Multiply the contents of a tuple by a scalar.
- Parameters
scalar – The scalar to mupltiply the tuple by.
tup – The tuple to scale.
- Returns
A scaled tuple.