32.8 Morphisms defined by a matrix

Module: sage.modules.matrix_morphism

Morphisms defined by a matrix.

A matrix morphism is a morphism that is defined by multiplication by a matrix. Elements of domain must either have a method vector() that returns a vector that the defining matrix can hit from the left, or be coercible into vector space of appropriate dimension.

sage: from sage.modules.matrix_morphism import MatrixMorphism, is_MatrixMorphism
sage: V = QQ^3
sage: T = End(V)
sage: M = MatrixSpace(QQ,3)
sage: I = M.identity_matrix()
sage: m = MatrixMorphism(T, I); m
Morphism defined by the matrix
[1 0 0]
[0 1 0]
[0 0 1]
sage: is_MatrixMorphism(m)
True
sage: m.charpoly('x')
x^3 - 3*x^2 + 3*x - 1
sage: m.base_ring()
Rational Field
sage: m.det()
1
sage: m.fcp('x')
(x - 1)^3
sage: m.matrix()
[1 0 0]
[0 1 0]
[0 0 1]
sage: m.rank()
3
sage: m.trace()
3

Author: - William Stein: initial versions - David Joyner (2005-12-17): added examples - William Stein (2005-01-07): added __reduce__

Module-level Functions

is_MatrixMorphism( x)

Class: MatrixMorphism

class MatrixMorphism
MatrixMorphism( self, parent, A)
INPUT:
            parent -- a homspace
            A -- matrix

sage: from sage.modules.matrix_morphism import MatrixMorphism
sage: T = End(QQ^3)
sage: M = MatrixSpace(QQ,3)
sage: I = M.identity_matrix()
sage: A = MatrixMorphism(T, I)
sage: loads(A.dumps()) == A
True

Functions: base_ring,$  $ charpoly,$  $ decomposition,$  $ det,$  $ fcp,$  $ image,$  $ kernel,$  $ matrix,$  $ rank,$  $ restrict,$  $ restrict_domain,$  $ trace

det( self)
Return the determinant of this endomorphism.

fcp( self, [var=x])
Return the factorization of the characteristic polynomial.

kernel( self)
Compute the kernel of this matrix.

sage: V = VectorSpace(QQ,3)
sage: id = V.Hom(V)(identity_matrix(QQ,3))
sage: null = V.Hom(V)(0*identity_matrix(QQ,3))
sage: id.kernel()
Vector space of degree 3 and dimension 0 over Rational Field
Basis matrix:
[]
sage: phi = V.Hom(V)(matrix(QQ,3,range(9)))
sage: phi.kernel()
Vector space of degree 3 and dimension 1 over Rational Field
Basis matrix:
[ 1 -2  1]

restrict( self, sub)
Restrict this matrix morphism to a subspace sub of the domain.

The codomain and domain of the resulting matrix are both sub.

restrict_domain( self, sub)
Restrict this matrix morphism to a subspace sub of the domain. The subspace sub should have a basis() method and elements of the basis should be coercible into domain.

The resulting morphism has the same codomain as before, but a new domain.

Special Functions: __call__,$  $ __cmp__,$  $ __invert__,$  $ __mul__,$  $ __rmul__,$  $ _add_function,$  $ _mul_function,$  $ _repr_,$  $ _sub_function

__call__( self, x)
Evaluate this matrix morphism at an element that can be coerced into the domain.

sage: V = QQ^3; W = QQ^2
sage: H = Hom(V, W); H
Set of Morphisms from Vector space of dimension 3 over Rational Field to
Vector space of dimension 2 over Rational Field in Category of vector
spaces over Rational Field
sage: phi = H(range(6)); phi
Free module morphism defined by the matrix
[0 1]
[2 3]
[4 5]
Domain: Vector space of dimension 3 over Rational Field
Codomain: Vector space of dimension 2 over Rational Field
sage: phi(V.0)
(0, 1)
sage: phi([1,2,3])
(16, 22)
sage: phi(5)
Traceback (most recent call last):
...
TypeError: 5 must be coercible into Vector space of dimension 3 over
Rational Field
sage: phi([1,1])
Traceback (most recent call last):
...
ArithmeticError: entries must be a list of length 3

See About this document... for information on suggesting changes.