Matrices and Spaces of Matrices

Sage provides native support for working with matrices over any commutative or noncommutative ring. The parent object for a matrix is a matrix space MatrixSpace(R, n, m) of all \(n\times m\) matrices over a ring \(R\).

To create a matrix, either use the matrix(...) function or create a matrix space using the MatrixSpace command and coerce an object into it.

Matrices also act on row vectors, which you create using the vector(...) command or by making a VectorSpace and coercing lists into it. The natural action of matrices on row vectors is from the right. Sage currently does not have a column vector class (on which matrices would act from the left), but this is planned.

In addition to native Sage matrices, Sage also includes the following additional ways to compute with matrices:

  • Several math software systems included with Sage have their own native matrix support, which can be used from Sage. E.g., PARI, GAP, Maxima, and Singular all have a notion of matrices.

  • The GSL C-library is included with Sage, and can be used via Cython.

  • The scipy module provides support for sparse numerical linear algebra, among many other things.

  • The numpy module, which you load by typing import numpy is included standard with Sage. It contains a very sophisticated and well developed array class, plus optimized support for numerical linear algebra. Sage’s matrices over RDF and CDF (native floating-point real and complex numbers) use numpy.

Finally, this module contains some data-structures for matrix-like objects like operation tables (e.g. the multiplication table of a group).

Indices and Tables

Bibliography

[AS2011]

R.B.J.T Allenby and A. Slomson, How to count, CRC Press (2011)

[Baer2020]

Christian Bär. The Faddeev-LeVerrier algorithm and the Pfaffian. https://arxiv.org/abs/2008.04247, 2020.

[Bar2006]

G. Bard. Accelerating Cryptanalysis with the Method of Four Russians. Cryptography E-Print Archive (http://eprint.iacr.org/2006/251.pdf), 2006.

[BB2009]

Tomas J. Boothby and Robert W. Bradshaw. Bitslicing and the Method of Four Russians Over Larger Finite Fields. https://arxiv.org/abs/0901.1413, 2009.

[Bec1992]

Bernhard Beckermann. A reliable method for computing M-Padé approximants on arbitrary staircases. J. Comput. Appl. Math., 40(1):19-42, 1992. https://doi.org/10.1016/0377-0427(92)90039-Z.

[BecLab2000]

Bernhard Beckermann, George Labahn. Fraction-Free Computation of Matrix Rational Interpolants and Matrix GCDs. SIAM J. Matrix Anal. Appl. 22 (2000) 114-144. https://doi.org/10.1137/S0895479897326912

[Bee]

Robert A. Beezer, A First Course in Linear Algebra, https://linear.pugetsound.edu/. Accessed 15 July 2010.

[BK1977]

James R. Bunch and Linda Kaufman. Some Stable Methods for Calculating Inertia and Solving Symmetric Linear Systems. Mathematics of Computation, 31(137):163-179, 1977.

[BL1994]

Bernhard Beckermann, George Labahn. A Uniform Approach for the Fast Computation of Matrix-Type Padé Approximants. SIAM J. Matrix Anal. Appl. 15 (1994) 804-823. https://doi.org/10.1137/S0895479892230031

[BLV1999]

Bernhard Beckermann, George Labahn, and Gilles Villard. Shifted normal forms of polynomial matrices. In ISSAC’99, pages 189-196. ACM, 1999. https://doi.org/10.1145/309831.309929.

[BLV2006]

Bernhard Beckermann, George Labahn, and Gilles Villard. Normal forms for general polynomial matrices. J. Symbolic Comput., 41(6):708-737, 2006. https://doi.org/10.1016/j.jsc.2006.02.001.

[BP2015]

P. Butera and M. Pernici Sums of permanental minors using Grassmann algebra, International Journal of Graph Theory and its Applications, 1 (2015), 83-96. https://arxiv.org/abs/1406.5337

[CLG1997]

Frank Celler and C. R. Leedham-Green, Calculating the Order of an Invertible Matrix, 1997

[DW1995]

Andreas W.M. Dress and Walter Wenzel, A Simple Proof of an Identity Concerning Pfaffians of Skew Symmetric Matrices, Advances in Mathematics, volume 112, Issue 1, April 1995, pp. 120-134. https://doi.org/10.1006/aima.1995.1029

[FZ2001]

S. Fomin and A. Zelevinsky. Cluster algebras I. Foundations, J. Amer. Math. Soc. 15 (2002), no. 2, pp. 497-529. https://arxiv.org/abs/math/0104151 (2001).

[GL1996]

G. Golub and C. van Loan. Matrix Computations. 3rd edition, Johns Hopkins Univ. Press, 1996.

[GN2018]

Pascal Giorgi and Vincent Neiger. Certification of Minimal Approximant Bases. In ISSAC 2018, pages 167-174. https://doi.org/10.1145/3208976.3208991

[HAM1985]

Hoffman, Alan J., Anthonius Wilhelmus Johannes Kolen, and Michel Sakarovitch. Totally-balanced and greedy matrices. SIAM Journal on Algebraic Discrete Methods 6.4 (1985): 721-730.

[Hig2002]

Nicholas J. Higham. Accuracy and Stability of Numerical Algorithms, Second Edition. Society for Industrial and Applied Mathematics, Philadelphia, 2002.

[HR2016]

Clemens Heuberger and Roswitha Rissner, Computing \(J\)-Ideals of a Matrix Over a Principal Ideal Domain, https://arxiv.org/abs/1611.10308, 2016.

[JNSV2016]

Claude-Pierre Jeannerod, Vincent Neiger, Eric Schost, and Gilles Villard. Fast Computation of Minimal Interpolation Bases in Popov Form for Arbitrary Shifts. In Proceedings ISSAC 2016 (pages 295-302). https://doi.org/10.1145/2930889.2930928

[JNSV2017]

Claude-Pierre Jeannerod, Vincent Neiger, Eric Schost, and Gilles Villard. Computing Minimal Interpolation Bases. J. Symb. Comput. 83, 2017 (pp 272–314). https://doi.org/10.1016/j.jsc.2016.11.015

[Kai1980]

Thomas Kailath. Linear Systems, Prentice-Hall, 1980.

[Knu1995]

Donald E. Knuth, Overlapping Pfaffians, https://arxiv.org/abs/math/9503234v1.

[KP2002b]

James Kuzmanovich; Andrey Pavlichenkov, Finite Groups of Matrices Whose Entries Are Integers, The American Mathematical Monthly, Vol. 109, No. 2. (2002) pp. 173-186

[LieOs1991]

Hans Liebeck and Anthony Osborne. The Generation of All Rational Orthogonal Matrices. The American Mathematical Monthly, 98(2):131-133, 1991.

[Lub1987]

Lubiw, Anna. Doubly Lexical Orderings of Matrices. SIAM Journal on Computing 16.5 (1987): 854-879.

[MS2003]

T. Mulders, A. Storjohann, On lattice reduction for polynomial matrices, J. Symbolic Comput. 35 (2003), no. 4, 377–401

[Or2017]

M. Orlitzky. The Lyapunov rank of an improper cone. Optimization Methods and Software, 32(1):109-125, 2017, https://doi.org/10.1080/10556788.2016.1202246.

[Pop1972]

V. M. Popov. Invariant description of linear, time-invariant controllable systems. SIAM Journal on Control, 10(2):252-264, 1972. https://doi.org/10.1137/0310020

[Rio1958]

J. Riordan, An Introduction to Combinatorial Analysis, Dover Publ. (1958)

[Ris2016]

Roswitha Rissner, Null ideals of matrices over residue class rings of principal ideal domains. Linear Algebra Appl., 494 (2016) 44-69. https://doi.org/10.1016/j.laa.2016.01.004.

[Rot2001]

Gunter Rote, Division-Free Algorithms for the Determinant and the Pfaffian: Algebraic and Combinatorial Approaches, H. Alt (Ed.): Computational Discrete Mathematics, LNCS 2122, pp. 119-135, 2001. https://page.mi.fu-berlin.de/rote/Papers/pdf/Division-free+algorithms.pdf

[SH1995]

C. P. Schnorr and H. H. Hörner. Attacking the Chor-Rivest Cryptosystem by Improved Lattice Reduction. Advances in Cryptology - EUROCRYPT ‘95. LNCS Volume 921, 1995, pp 1-12.

[Sto1998]

A. Storjohann, An O(n^3) algorithm for Frobenius normal form. Proceedings of the International Symposium on Symbolic and Algebraic Computation (ISSAC’98), ACM Press, 1998, pp. 101-104.

[Sto2000]

A. Storjohann, Algorithms for Matrix Canonical Forms. Ph.D. Thesis. Department of Computer Science, Swiss Federal Institute of Technology – ETH, 2000.

[Sto2011]

A. Storjohann, Email Communication. 30 May 2011.

[TB1997]

Lloyd N. Trefethen and David Bau III, Numerical Linear Algebra, SIAM, Philadelphia, 1997.

[VBB1992]

Marc Van Barel and Adhemar Bultheel. “A general module theoretic framework for vector M-Padé and matrix rational interpolation.” Numer. Algorithms, 3:451-462, 1992. https://doi.org/10.1007/BF02141952

[Wat2010]

Watkins, David S. Fundamentals of Matrix Computations, Third Edition. Wiley, Hoboken, New Jersey, 2010.

[Wol1974]

W. A. Wolovich. Linear Multivariable Systems, Applied Mathematical Sciences (volume 11). Springer-Verlag New-York, 1974. https://doi.org/10.1007/978-1-4612-6392-0

[ZL2014]

Wei Zhou and George Labahn. Unimodular completion of polynomial matrices. In Proceedings ISSAC 2014, pages 413-420. ACM, 2014. https://doi.org/10.1145/2608628.2608640