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

REFERENCES:<br />

•[FZ2001] S. Fomin, A. Zelevinsky. Cluster Algebras 1: Foundations, arXiv:math/0104151 (2001).<br />

ncols()<br />

Return the number <strong>of</strong> columns <strong>of</strong> this matrix.<br />

EXAMPLES:<br />

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

sage: A = M([1,2,3, 4,5,6])<br />

sage: A<br />

[1 2 3]<br />

[4 5 6]<br />

sage: A.ncols()<br />

3<br />

sage: A.nrows()<br />

2<br />

AUTHORS:<br />

•Naqi Jaffery (2006-01-24): examples<br />

nonpivots()<br />

Return the list <strong>of</strong> i such that the i-th column <strong>of</strong> self is NOT a pivot column <strong>of</strong> the reduced row echelon<br />

form <strong>of</strong> self.<br />

OUTPUT: sorted tuple <strong>of</strong> (Python) integers<br />

EXAMPLES:<br />

sage: a = matrix(QQ,3,3,range(9)); a<br />

[0 1 2]<br />

[3 4 5]<br />

[6 7 8]<br />

sage: a.echelon_form()<br />

[ 1 0 -1]<br />

[ 0 1 2]<br />

[ 0 0 0]<br />

sage: a.nonpivots()<br />

(2,)<br />

nonzero_positions(copy=True, column_order=False)<br />

Returns the sorted list <strong>of</strong> pairs (i,j) such that self[i,j] != 0.<br />

INPUT:<br />

•copy - (default: True) It is safe to change the resulting list (unless you give the option copy=False).<br />

•column_order - (default: False) If true, returns the list <strong>of</strong> pairs (i,j) such that self[i,j] != 0, but<br />

sorted by columns, i.e., column j=0 entries occur first, then column j=1 entries, etc.<br />

EXAMPLES:<br />

sage: a = matrix(QQ, 2,3, [1,2,0,2,0,0]); a<br />

[1 2 0]<br />

[2 0 0]<br />

sage: a.nonzero_positions()<br />

[(0, 0), (0, 1), (1, 0)]<br />

sage: a.nonzero_positions(copy=False)<br />

[(0, 0), (0, 1), (1, 0)]<br />

sage: a.nonzero_positions(column_order=True)<br />

[(0, 0), (1, 0), (0, 1)]<br />

84 Chapter 5. Base class for matrices, part 0

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

Saved successfully!

Ooh no, something went wrong!