X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Fmatrix_vector.py;h=2a0e9e8d54a8dd45dd473a04780a63823e5030cd;hb=852c32e6db3d27310489abd9e23787a1b7d068ad;hp=49d112a9f832e8849428abab5955a9f779d884d2;hpb=5d22f22af29ba8f09a8c66244157e0e04c7bf43d;p=sage.d.git diff --git a/mjo/matrix_vector.py b/mjo/matrix_vector.py index 49d112a..2a0e9e8 100644 --- a/mjo/matrix_vector.py +++ b/mjo/matrix_vector.py @@ -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)