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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<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 />

ALGORITHM:<br />

Use PARI whenever the method self._adjoint is included to do so in an inheriting class. Otherwise,<br />

use a generic division-free algorithm to compute the characteristic polynomial <strong>and</strong> hence the adjoint.<br />

The result is cached.<br />

EXAMPLES:<br />

sage: M = Matrix(ZZ,2,2,[5,2,3,4]) ; M<br />

[5 2]<br />

[3 4]<br />

sage: N = M.adjoint() ; N<br />

[ 4 -2]<br />

[-3 5]<br />

sage: M * N<br />

[14 0]<br />

[ 0 14]<br />

sage: N * M<br />

[14 0]<br />

[ 0 14]<br />

sage: M = Matrix(QQ,2,2,[5/3,2/56,33/13,41/10]) ; M<br />

[ 5/3 1/28]<br />

[33/13 41/10]<br />

sage: N = M.adjoint() ; N<br />

[ 41/10 -1/28]<br />

[-33/13 5/3]<br />

sage: M * N<br />

[7363/1092 0]<br />

[ 0 7363/1092]<br />

AUTHORS:<br />

•Unknown: No author specified in the file from 2009-06-25<br />

•Sebastian Pancratz (2009-06-25): Reflecting the change that _adjoint is now implemented in this<br />

class<br />

as_sum_<strong>of</strong>_permutations()<br />

Returns the current matrix as a sum <strong>of</strong> permutation matrices<br />

According to the Birkh<strong>of</strong>f-von Neumann Theorem, any bistochastic matrix can be written as a positive<br />

sum <strong>of</strong> permutation matrices, which also means that the polytope <strong>of</strong> bistochastic matrices is integer.<br />

As a non-bistochastic matrix can obviously not be written as a sum <strong>of</strong> permutations, this theorem is an<br />

equivalence.<br />

This function, given a bistochastic matrix, returns the corresponding decomposition.<br />

•bistochastic_as_sum_<strong>of</strong>_permutations – for more information on this method.<br />

EXAMPLE:<br />

We create a bistochastic matrix from a convex sum <strong>of</strong> permutations, then try to deduce the decomposition<br />

from the matrix<br />

sage: L = []<br />

sage: L.append((9,Permutation([4, 1, 3, 5, 2])))<br />

sage: L.append((6,Permutation([5, 3, 4, 1, 2])))<br />

sage: L.append((3,Permutation([3, 1, 4, 2, 5])))<br />

sage: L.append((2,Permutation([1, 4, 2, 3, 5])))<br />

sage: M = sum([c * p.to_matrix() for (c,p) in L])<br />

sage: decomp = sage.combinat.permutation.bistochastic_as_sum_<strong>of</strong>_permutations(M)<br />

131

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

Saved successfully!

Ooh no, something went wrong!