principia_materia.mathematics.tensor_utils module

principia_materia.mathematics.tensor_utils.find_linearly_independent_vectors(vectors, tol=1e-06, return_vectors=False)

Use Gram-Schmidt to find a set of linearly independent vectors.

Parameters:
  • vectors (array of numbers, shape(n, m)) – The set of vectors to be orthonormalized, in row convention.

  • tol (float, optional, default to 1.0E-6) – Error tolerance.

  • return_vectors (bool, optional, default to False) – Whether to return the orthonormalized vectors.

Returns:

  • liv_indices (array of int, shape(rank(vectors), )) – The indicies of the linearly independent vectors.

  • vectors (array of numbers, shape(n, m)) – (if return_vectors == True) The orthonormalized vectors.

principia_materia.mathematics.tensor_utils.find_most_linearly_independent_rows(vectors, tol=1e-06, return_vectors=False)
principia_materia.mathematics.tensor_utils.rotate_tensor(rotation_matricies, tensor, rank)

Rotate a tensor.

\[T^{\prime}_{i^{\prime} j^{\prime} k^{\prime} l^{\prime} \cdots} = % \sum_{i j k l} % a_{i i^{\prime}} b_{j j^{\prime}} c_{i k^{\prime}} d_{i l^{\prime}} % \cdots T_{i j k l \cdots}\]
Parameters:
  • rotation_matricies (list of arrays of float/complex, length of rank) – (Each array must be a square matrix of same shape of i-th index of tensor) Rotation matrices to rotate the tensor.

  • tensor (array of float/complex, shape(n_1, ..., n_{rank}) of shape(n_1, ..., n_{rank + 1})) – The tensor to rotate.

  • rank (int) – The rank of the tensor.