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__ - Craig Citro (2008-03-18): refactored MatrixMorphism class
Module-level Functions
x) |
Class: MatrixMorphism
self, parent, A) |
Input:
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: matrix
Special Functions: __init__,
_repr_
Class: MatrixMorphism_abstract
self, parent) |
Input:
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_codomain,
restrict_domain,
trace
self) |
Return the base ring of self, that is, the ring over which self is given by a matrix.
sage: sage.modules.matrix_morphism.MatrixMorphism((ZZ**2).endomorphism_ring(), Matrix(ZZ,2,[3..6])).base_ring() Integer Ring
self) |
Return the determinant of this endomorphism.
self, [var=x]) |
Return the factorization of the characteristic polynomial.
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]
self, sub) |
Restrict this matrix morphism to a subspace sub of the domain.
The codomain and domain of the resulting matrix are both sub.
self, sub) |
Restrict this matrix morphism to a subspace sub of the codomain.
The resulting morphism has the same domain as before, but a new codomain.
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: __add__,
__call__,
__cmp__,
__init__,
__invert__,
__mul__,
__neg__,
__rmul__,
__sub__,
_repr_
self, right) |
Sum of morphisms, denoted by +.
sage: phi = (ZZ**2).endomorphism_ring()(Matrix(ZZ,2,[2..5])) ; phi Free module morphism defined by the matrix [2 3] [4 5] Domain: Ambient free module of rank 2 over the principal ideal domain ... Codomain: Ambient free module of rank 2 over the principal ideal domain ... sage: phi + 3 Free module morphism defined by the matrix [5 3] [4 8] Domain: Ambient free module of rank 2 over the principal ideal domain ... Codomain: Ambient free module of rank 2 over the principal ideal domain ... sage: phi + phi Free module morphism defined by the matrix [ 4 6] [ 8 10] Domain: Ambient free module of rank 2 over the principal ideal domain ... Codomain: Ambient free module of rank 2 over the principal ideal domain ... sage: psi = (ZZ**3).endomorphism_ring()(Matrix(ZZ,3,[22..30])) ; psi Free module morphism defined by the matrix [22 23 24] [25 26 27] [28 29 30] Domain: Ambient free module of rank 3 over the principal ideal domain ... Codomain: Ambient free module of rank 3 over the principal ideal domain ... sage: phi + psi Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for '+': 'Full MatrixSpace of 2 by 2 dense matrices over Integer Ring' and 'Full MatrixSpace of 3 by 3 dense matrices over Integer Ring'
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): ... TypeError: [1, 1] must be coercible into Vector space of dimension 3 over Rational Field
self, right) |
Composition of morphisms, denoted by *.
sage: V = QQ**3 sage: E = V.endomorphism_ring() sage: phi = E(Matrix(QQ,3,range(9))) ; phi Free module morphism defined by the matrix [0 1 2] [3 4 5] [6 7 8] Domain: Vector space of dimension 3 over Rational Field Codomain: Vector space of dimension 3 over Rational Field sage: phi*phi Free module morphism defined by the matrix [ 15 18 21] [ 42 54 66] [ 69 90 111] Domain: Vector space of dimension 3 over Rational Field Codomain: Vector space of dimension 3 over Rational Field sage: phi.matrix()**2 [ 15 18 21] [ 42 54 66] [ 69 90 111]
sage: W = QQ**4 sage: E_VW = V.Hom(W) sage: psi = E_VW(Matrix(QQ,3,4,range(12))) ; psi Free module morphism defined by the matrix [ 0 1 2 3] [ 4 5 6 7] [ 8 9 10 11] Domain: Vector space of dimension 3 over Rational Field Codomain: Vector space of dimension 4 over Rational Field sage: psi*phi Free module morphism defined by the matrix [ 20 23 26 29] [ 56 68 80 92] [ 92 113 134 155] Domain: Vector space of dimension 3 over Rational Field Codomain: Vector space of dimension 4 over Rational Field sage: phi*psi Traceback (most recent call last): ... TypeError: unsupported operand parent(s) for '*': 'Full MatrixSpace of 3 by 4 dense matrices over Rational Field' and 'Full MatrixSpace of 3 by 3 dense matrices over Rational Field' sage: phi.matrix()*psi.matrix() [ 20 23 26 29] [ 56 68 80 92] [ 92 113 134 155]
See About this document... for information on suggesting changes.