]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/matrix_vector.py
eja: add another test for element inverses.
[sage.d.git] / mjo / matrix_vector.py
index 49d112a9f832e8849428abab5955a9f779d884d2..2a0e9e8d54a8dd45dd473a04780a63823e5030cd 100644 (file)
@@ -25,11 +25,15 @@ def isomorphism(matrix_space):
                           The inverse mapping ``phi_inverse`` will go
                           the other way.
 
-    EXAMPLES:
+    SETUP::
+
+        sage: from mjo.matrix_vector import isomorphism
+
+    EXAMPLES::
 
         sage: M = MatrixSpace(QQ,4,4)
         sage: (p, p_inv) = isomorphism(M)
-        sage: m = M(range(0,16))
+        sage: m = M(xrange(16))
         sage: p_inv(p(m)) == m
         True
 
@@ -72,6 +76,10 @@ def matrix_of_transformation(T, V):
     matrix that represents ``T`` with respect to the standard basis of
     ``V``.
 
+    SETUP::
+
+        sage: from mjo.matrix_vector import isomorphism, matrix_of_transformation
+
     EXAMPLES:
 
     The matrix of a transformation on a simple vector space should be
@@ -116,7 +124,7 @@ def matrix_of_transformation(T, V):
 
     """
     n = V.dimension()
-    B = V.basis()
+    B = list(V.basis())
 
     def inner_product(v, w):
         # An inner product function that works for both matrices and
@@ -140,8 +148,8 @@ def matrix_of_transformation(T, V):
             return L(x)
 
     entries = []
-    for j in range(0,n):
-        for i in range(0,n):
+    for j in xrange(n):
+        for i in xrange(n):
             entry = inner_product(apply(T,B[i]), B[j])
             entries.append(entry)