Matrix

Matrix()

A matrix with rational polynomial coefficients.

Methods

Name Description
content Get the content, i.e., the GCD of the coefficients.
det Return the determinant of the matrix.
eye Create a new matrix with the scalars diag on the main diagonal and zeroes elsewhere.
from_linear Create a new matrix from a 1-dimensional vector of scalars.
from_nested Create a new matrix from a 2-dimensional vector of scalars.
identity Create a new square matrix with nrows rows and ones on the main diagonal and zeroes elsewhere.
inv Return the inverse of the matrix, if it exists.
is_diagonal Return true iff every non- main diagonal entry in the matrix is zero.
is_zero Return true iff every entry in the matrix is zero.
map Apply a function f to every entry of the matrix.
ncols Get the number of columns in the matrix.
nrows Get the number of rows in the matrix.
primitive_part Construct the same matrix, but with the content removed.
solve Solve A * x = b for x, where A is the current matrix.
to_latex Convert the matrix into a LaTeX string.
transpose Return the transpose of the matrix.
vec Create a new column vector from a list of scalars.

content

Matrix.content()

Get the content, i.e., the GCD of the coefficients.

det

Matrix.det()

Return the determinant of the matrix.

eye

Matrix.eye(diag)

Create a new matrix with the scalars diag on the main diagonal and zeroes elsewhere.

from_linear

Matrix.from_linear(nrows, ncols, entries)

Create a new matrix from a 1-dimensional vector of scalars.

from_nested

Matrix.from_nested(entries)

Create a new matrix from a 2-dimensional vector of scalars.

identity

Matrix.identity(nrows)

Create a new square matrix with nrows rows and ones on the main diagonal and zeroes elsewhere.

inv

Matrix.inv()

Return the inverse of the matrix, if it exists.

is_diagonal

Matrix.is_diagonal()

Return true iff every non- main diagonal entry in the matrix is zero.

is_zero

Matrix.is_zero()

Return true iff every entry in the matrix is zero.

map

Matrix.map(f)

Apply a function f to every entry of the matrix.

ncols

Matrix.ncols()

Get the number of columns in the matrix.

nrows

Matrix.nrows()

Get the number of rows in the matrix.

primitive_part

Matrix.primitive_part()

Construct the same matrix, but with the content removed.

solve

Matrix.solve(b)

Solve A * x = b for x, where A is the current matrix.

to_latex

Matrix.to_latex()

Convert the matrix into a LaTeX string.

transpose

Matrix.transpose()

Return the transpose of the matrix.

vec

Matrix.vec(entries)

Create a new column vector from a list of scalars.