08.02.2015 Views

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

Sage Reference Manual: Matrices and Spaces of Matrices - Mirrors

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Matrices</strong> <strong>and</strong> <strong>Spaces</strong> <strong>of</strong> <strong>Matrices</strong>, Release 6.1.1<br />

<strong>and</strong> j, we denote the (i, j)-th entry <strong>of</strong> A by a i,j . Let M denote the set <strong>of</strong> all perfect matchings <strong>of</strong> the<br />

set {1, 2, . . . , 2n} (see sage.combinat.perfect_matching.PerfectMatchings ). For every<br />

matching m ∈ M, define the sign sign(m) <strong>of</strong> m by writing m as {{i 1 , j 1 }, {i 2 , j 2 }, . . . , {i n , j n }} with<br />

i k < j k for all k, <strong>and</strong> setting sign(m) to be the sign <strong>of</strong> the permutation (i 1 , j 1 , i 2 , j 2 , . . . , i n , j n ) (written<br />

here in one-line notation). For every matching m ∈ M, define the weight w(m) <strong>of</strong> m by writing m as<br />

{{i 1 , j 1 }, {i 2 , j 2 }, . . . , {i n , j n }} with i k < j k for all k, <strong>and</strong> setting w(m) = a i1,j 1<br />

a i2,j 2<br />

· · · a in,j n<br />

. Now,<br />

the Pfaffian <strong>of</strong> the matrix A is defined to be the sum<br />

∑<br />

sign(m)w(m).<br />

m∈M<br />

The Pfaffian <strong>of</strong> A is commonly denoted by Pf(A). It is well-known that (Pf(A)) 2 = det A for every<br />

alternating matrix A, <strong>and</strong> that Pf(U T AU) = det U · Pf(A) for any n × n matrix U <strong>and</strong> any alternating<br />

n × n matrix A.<br />

See [Kn95], [DW95] <strong>and</strong> [Rote2001], just to name three sources, for further properties <strong>of</strong> Pfaffians.<br />

ALGORITHM:<br />

The current implementation uses the definition given above. It checks alternatingness <strong>of</strong> the matrix self<br />

only if check is True (this is important because even if self is alternating, a non-discrete base ring<br />

might prevent <strong>Sage</strong> from being able to check this).<br />

REFERENCES:<br />

Todo<br />

Implement faster algorithms, including a division-free one. Does [Rote2001], section 3.3 give one<br />

Check the implementation <strong>of</strong> the matchings used here for performance<br />

EXAMPLES:<br />

A 3 × 3 alternating matrix has Pfaffian 0 independently <strong>of</strong> its entries:<br />

sage: MSp = MatrixSpace(Integers(27), 3)<br />

sage: A = MSp([0, 2, -3, -2, 0, 8, 3, -8, 0])<br />

sage: A.pfaffian()<br />

0<br />

sage: parent(A.pfaffian())<br />

Ring <strong>of</strong> integers modulo 27<br />

The Pfaffian <strong>of</strong> a 2 × 2 alternating matrix is just its northeast entry:<br />

sage: MSp = MatrixSpace(QQ, 2)<br />

sage: A = MSp([0, 4, -4, 0])<br />

sage: A.pfaffian()<br />

4<br />

sage: parent(A.pfaffian())<br />

Rational Field<br />

The Pfaffian <strong>of</strong> a 0 × 0 alternating matrix is 1:<br />

sage: MSp = MatrixSpace(ZZ, 0)<br />

sage: A = MSp([])<br />

sage: A.pfaffian()<br />

1<br />

sage: parent(A.pfaffian())<br />

Integer Ring<br />

Let us compute the Pfaffian <strong>of</strong> a generic 4 × 4 alternating matrix:<br />

221

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!