:py:mod:`matrix_ops.vectors_to_gram_matrix` =========================================== .. py:module:: matrix_ops.vectors_to_gram_matrix .. autoapi-nested-parse:: Gram matrix from list of vectors. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: matrix_ops.vectors_to_gram_matrix.vectors_to_gram_matrix .. py:function:: vectors_to_gram_matrix(vectors) Construct the Gram matrix from a list of vectors :cite:`WikiGram`. The Gram matrix is a matrix of inner products, where the entry G[i, j] is the inner product of vectors[i] and vectors[j]. This function computes the Gram matrix for a given list of vectors. .. rubric:: Examples >>> # Example with real vectors: >>> import numpy as np >>> from toqito.matrix_ops import vectors_to_gram_matrix >>> vectors = [np.array([1, 2]), np.array([3, 4])] >>> gram_matrix = vectors_to_gram_matrix(vectors) >>> gram_matrix array([[ 5, 11], [11, 25]]) >>> # Example with complex vectors: >>> import numpy as np >>> from toqito.matrix_ops import vectors_to_gram_matrix >>> vectors = [np.array([1+1j, 2+2j]), np.array([3+3j, 4+4j])] >>> gram_matrix = vectors_to_gram_matrix(vectors) >>> gram_matrix array([[10.+0.j, 22.+0.j], [22.+0.j, 50.+0.j]]) .. rubric:: References .. bibliography:: :filter: docname in docnames :raises ValueError: If the vectors are not all of the same length. :param vectors: A list of vectors (1D numpy arrays). All vectors must be of the same length. :return: A list of vectors corresponding to the ensemble of states.