+ sage: from mjo.matrix_vector import basis_representation
+
+ EXAMPLES:
+
+ This function computes the correct coordinate representations (of
+ length 3) for a basis of the space of two-by-two symmetric
+ matrices, the the inverse does indeed invert the process::
+
+ sage: E11 = matrix(QQbar,[ [1,0],
+ ....: [0,0] ])
+ sage: E12 = matrix(QQbar,[ [0, 1/sqrt(2)],
+ ....: [1/sqrt(2), 0] ])
+ sage: E22 = matrix(QQbar,[ [0,0],
+ ....: [0,1] ])
+ sage: basis = [E11, E12, E22]
+ sage: phi, phi_inv = basis_representation(basis)
+ sage: phi(E11); phi(E12); phi(E22)
+ (1, 0, 0)
+ (0, 1, 0)
+ (0, 0, 1)
+ sage: phi_inv(phi(E11)) == E11
+ True
+ sage: phi_inv(phi(E12)) == E12
+ True
+ sage: phi_inv(phi(E22)) == E22
+ True
+
+ MatrixSpace arguments work too::
+
+ sage: M = MatrixSpace(QQ,2)
+ sage: phi, phi_inv = basis_representation(M)
+ sage: X = matrix(QQ, [ [1,2],
+ ....: [3,4] ])
+ sage: phi(X)
+ (1, 2, 3, 4)
+ sage: phi_inv(phi(X)) == X
+ True
+
+ TESTS: