Jim Heffron pointed out this problem with vector space morphisms:
sage: h = linear_transformation(RR^2, RR^2, matrix(RR, [[0, 1], [2, 3]]))
sage: h*3 #works fine
Vector space morphism represented by the matrix:
[0.000000000000000 3.00000000000000]
[ 6.00000000000000 9.00000000000000]
Domain: Vector space of dimension 2 over Real Field with 53 bits of
precision
Codomain: Vector space of dimension 2 over Real Field with 53 bits of
precision
sage: 3*h #doesn't work
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-19-0de6d9e6c19c> in <module>()
----> 1 Integer(3)*h
[snip]
NotImplementedError: please implement _an_element_ for Set of Morphisms
(Linear Transformations) from Vector space of dimension 2 over Real
Field with 53 bits of precision to Vector space of dimension 2 over Real
Field with 53 bits of precision
However, notice that:
sage: h.__rmul__(3)
calling rmul
Vector space morphism represented by the matrix:
[0.000000000000000 3.00000000000000]
[ 6.00000000000000 9.00000000000000]
Domain: Vector space of dimension 2 over Real Field with 53 bits of
precision
Codomain: Vector space of dimension 2 over Real Field with 53 bits of
precision
For some reason, the direct superclass of h works just fine:
sage: phi = (ZZ^2).hom(matrix(ZZ,2,[1..4]))
sage: 3*phi
Free module morphism defined by the matrix
[ 3 6]
[ 9 12]
Domain: Ambient free module of rank 2 over the principal ideal domain
Integer Ring
Codomain: Ambient free module of rank 2 over the principal ideal domain
Integer Ring
The subclassing for h's parent [1] doesn't seem to deal at all with
multiplication or anything like that, so why doesn't h work above?
Notice this minimal example also has the same problem:
sage: from sage.modules.vector_space_homspace import VectorSpaceHomspace
sage: class VSH(sage.modules.free_module_morphism.FreeModuleMorphism): pass
sage: 3*VSH(VectorSpaceHomspace(QQ^3, QQ^2), matrix(QQ, 3, 2, range(6)))
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
[snip]
NotImplementedError: please implement _an_element_ for Set of Morphisms
(Linear Transformations) from Vector space of dimension 3 over Rational
Field to Vector space of dimension 2 over Rational Field
Thanks,
Jason
[1]
http://hg.sagemath.org/sage-main/file/d06cf4b2215d/sage/modules/vector_space_morphism.py#l796
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.