Dense matrices over the Real Double Field using NumPy

EXAMPLES:

sage: b=Mat(RDF,2,3).basis()
sage: b[0]
[1.0 0.0 0.0]
[0.0 0.0 0.0]

We deal with the case of zero rows or zero columns:

sage: m = MatrixSpace(RDF,0,3)
sage: m.zero_matrix()
[]

TESTS:

sage: a = matrix(RDF,2,range(4), sparse=False)
sage: TestSuite(a).run()
sage: MatrixSpace(RDF,0,0).zero_matrix().inverse()
[]

AUTHORS:

  • Jason Grout (2008-09): switch to NumPy backend, factored out the Matrix_double_dense class
  • Josh Kantor
  • William Stein: many bug fixes and touch ups.
class sage.matrix.matrix_real_double_dense.Matrix_real_double_dense

Bases: sage.matrix.matrix_double_dense.Matrix_double_dense

Class that implements matrices over the real double field. These are supposed to be fast matrix operations using C doubles. Most operations are implemented using numpy which will call the underlying BLAS on the system.

EXAMPLES:

sage: m = Matrix(RDF, [[1,2],[3,4]])
sage: m**2
[ 7.0 10.0]
[15.0 22.0]
sage: n= m^(-1); n
[-2.0  1.0]
[ 1.5 -0.5]

To compute eigenvalues the use the functions left_eigenvectors or right_eigenvectors

sage: p,e = m.right_eigenvectors()

the result of eigen is a pair (p,e), where p is a list of eigenvalues and the e is a matrix whose columns are the eigenvectors.

To solve a linear system Ax = b where A = [[1,2],[3,4]] and b = [5,6].

sage: b = vector(RDF,[5,6])
sage: m.solve_left(b)
(-4.0, 4.5)

See the commands qr, lu, and svd for QR, LU, and singular value decomposition.

Previous topic

Dense matrices over the rational field.

Next topic

Dense matrices over the Complex Double Field using NumPy

This Page