Cremona matrices#

class sage.libs.eclib.mat.Matrix[source]#

Bases: object

A Cremona Matrix.

EXAMPLES:

sage: M = CremonaModularSymbols(225)
sage: t = M.hecke_matrix(2)
sage: type(t)
<class 'sage.libs.eclib.mat.Matrix'>
sage: t
61 x 61 Cremona matrix over Rational Field
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(225))
>>> t = M.hecke_matrix(Integer(2))
>>> type(t)
<class 'sage.libs.eclib.mat.Matrix'>
>>> t
61 x 61 Cremona matrix over Rational Field
add_scalar(s)[source]#

Return new matrix obtained by adding s to each diagonal entry of self.

EXAMPLES:

sage: M = CremonaModularSymbols(23, cuspidal=True, sign=1)
sage: t = M.hecke_matrix(2); print(t.str())
[ 0  1]
[ 1 -1]
sage: w = t.add_scalar(3); print(w.str())
[3 1]
[1 2]
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(23), cuspidal=True, sign=Integer(1))
>>> t = M.hecke_matrix(Integer(2)); print(t.str())
[ 0  1]
[ 1 -1]
>>> w = t.add_scalar(Integer(3)); print(w.str())
[3 1]
[1 2]
charpoly(var='x')[source]#

Return the characteristic polynomial of this matrix, viewed as as a matrix over the integers.

ALGORITHM:

Note that currently, this function converts this matrix into a dense matrix over the integers, then calls the charpoly algorithm on that, which I think is LinBox’s.

EXAMPLES:

sage: M = CremonaModularSymbols(33, cuspidal=True, sign=1)
sage: t = M.hecke_matrix(2)
sage: t.charpoly()
x^3 + 3*x^2 - 4
sage: t.charpoly().factor()
(x - 1) * (x + 2)^2
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(33), cuspidal=True, sign=Integer(1))
>>> t = M.hecke_matrix(Integer(2))
>>> t.charpoly()
x^3 + 3*x^2 - 4
>>> t.charpoly().factor()
(x - 1) * (x + 2)^2
ncols()[source]#

Return the number of columns of this matrix.

EXAMPLES:

sage: M = CremonaModularSymbols(1234, sign=1)
sage: t = M.hecke_matrix(3); t.ncols()
156
sage: M.dimension()
156
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(1234), sign=Integer(1))
>>> t = M.hecke_matrix(Integer(3)); t.ncols()
156
>>> M.dimension()
156
nrows()[source]#

Return the number of rows of this matrix.

EXAMPLES:

sage: M = CremonaModularSymbols(19, sign=1)
sage: t = M.hecke_matrix(13); t
2 x 2 Cremona matrix over Rational Field
sage: t.nrows()
2
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(19), sign=Integer(1))
>>> t = M.hecke_matrix(Integer(13)); t
2 x 2 Cremona matrix over Rational Field
>>> t.nrows()
2
sage_matrix_over_ZZ(sparse=True)[source]#

Return corresponding Sage matrix over the integers.

INPUT:

  • sparse – (default: True) whether the return matrix has a sparse representation

EXAMPLES:

sage: M = CremonaModularSymbols(23, cuspidal=True, sign=1)
sage: t = M.hecke_matrix(2)
sage: s = t.sage_matrix_over_ZZ(); s
[ 0  1]
[ 1 -1]
sage: type(s)
<class 'sage.matrix.matrix_integer_sparse.Matrix_integer_sparse'>
sage: s = t.sage_matrix_over_ZZ(sparse=False); s
[ 0  1]
[ 1 -1]
sage: type(s)
<class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(23), cuspidal=True, sign=Integer(1))
>>> t = M.hecke_matrix(Integer(2))
>>> s = t.sage_matrix_over_ZZ(); s
[ 0  1]
[ 1 -1]
>>> type(s)
<class 'sage.matrix.matrix_integer_sparse.Matrix_integer_sparse'>
>>> s = t.sage_matrix_over_ZZ(sparse=False); s
[ 0  1]
[ 1 -1]
>>> type(s)
<class 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
str()[source]#

Return full string representation of this matrix, never in compact form.

EXAMPLES:

sage: M = CremonaModularSymbols(22, sign=1)
sage: t = M.hecke_matrix(13)
sage: t.str()
'[14  0  0  0  0]\n[-4 12  0  8  4]\n[ 0 -6  4 -6  0]\n[ 4  2  0  6 -4]\n[ 0  0  0  0 14]'
>>> from sage.all import *
>>> M = CremonaModularSymbols(Integer(22), sign=Integer(1))
>>> t = M.hecke_matrix(Integer(13))
>>> t.str()
'[14  0  0  0  0]\n[-4 12  0  8  4]\n[ 0 -6  4 -6  0]\n[ 4  2  0  6 -4]\n[ 0  0  0  0 14]'
class sage.libs.eclib.mat.MatrixFactory#

Bases: object