Skip to content

Instantly share code, notes, and snippets.

@jasongrout
Created November 3, 2012 15:42
Show Gist options
  • Save jasongrout/4007685 to your computer and use it in GitHub Desktop.
Save jasongrout/4007685 to your computer and use it in GitHub Desktop.
# HG changeset patch
# User Jason Grout <jason.grout@drake.edu>
# Date 1351957330 18000
# Node ID 4ff83ffcda994227824decf218251b98ec5d946d
# Parent ef3d23d8f94ef5fd4911bda6da8174914a8d4ea6
[mq]: lineartransformations.patch
diff --git a/sage/modules/vector_space_homspace.py b/sage/modules/vector_space_homspace.py
--- a/sage/modules/vector_space_homspace.py
+++ b/sage/modules/vector_space_homspace.py
@@ -390,9 +390,6 @@
except (ArithmeticError, TypeError), e:
msg = 'some proposed image is not in the codomain, because\n' + e.args[0]
raise ArithmeticError(msg)
- else:
- msg = 'vector space homspace can only coerce matrices, vector space morphisms, functions or lists, not {0}'
- raise TypeError(msg.format(A))
return vector_space_morphism.VectorSpaceMorphism(self, A)
def _repr_(self):
@@ -409,4 +406,4 @@
'dimension', '3', 'over', 'Rational', 'Field']
"""
msg = 'Set of Morphisms (Linear Transformations) from {0} to {1}'
- return msg.format(self.domain(), self.codomain())
\ No newline at end of file
+ return msg.format(self.domain(), self.codomain())
diff --git a/sage/modules/vector_space_morphism.py b/sage/modules/vector_space_morphism.py
--- a/sage/modules/vector_space_morphism.py
+++ b/sage/modules/vector_space_morphism.py
@@ -852,15 +852,6 @@
raise TypeError, 'homspace must be a vector space hom space, not {0}'.format(homspace)
if isinstance(A, matrix_morphism.MatrixMorphism):
A = A.matrix()
- if not is_Matrix(A):
- msg = 'input must be a matrix representation or another matrix morphism, not {0}'
- raise TypeError(msg.format(A))
- # now have a vector space homspace, and a matrix, check compatibility
-
- if homspace.domain().dimension() != A.nrows():
- raise TypeError('domain dimension is incompatible with matrix size')
- if homspace.codomain().dimension() != A.ncols():
- raise TypeError('codomain dimension is incompatible with matrix size')
A = homspace._matrix_space()(A)
free_module_morphism.FreeModuleMorphism.__init__(self, homspace, A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment