vector_difference_matrix
- emmet.core.similarity.vector_difference_matrix(v, noise_floor=1e-14, spread_rows=0, dtype=np.dtype('float64'))
Construct a symmetric matrix of vector differences.
- Return type:
ndarray- Parameters:
v (ndarray)
noise_floor (float)
spread_rows (int)
dtype (dtype)
- Given a list of vectors v, a symmetric matrix D such that:
D_ij = | v_i - v_j | D_ji = D_ij
if spread_rows is a positive int, then this will return only the upper triangle of D_ij, j >= i, and parallelize construction of the rows of D_ij.
Parameters
- vnumpy ndarray
List of vectors. Axis = 0 should indicate distinct vectors, and axis = 1 their components.
- noise_floorfloat = 1e-14
Any values less than noise_floor will be zeroed out. Helps with loss of precision.
- spread_rowsint = 0
The number of parallel processes to use in constructing the rows of D_ij
dtype : the numpy dtype of the arrays used, defaults to float64