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

sage: a = MatrixSpace(ZZ,3)(2); a<br />

[2 0 0]<br />

[0 2 0]<br />

[0 0 2]<br />

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

[ 1 2 -3]<br />

sage: a = MatrixSpace(ZZ,2,4)(2); a<br />

Traceback (most recent call last):<br />

...<br />

TypeError: nonzero scalar matrix must be square<br />

BKZ(delta=None, fp=’rr’, block_size=10, prune=0, use_givens=False)<br />

Block Korkin-Zolotarev reduction.<br />

INPUT:<br />

•fp - ‘fp’ - double precision: NTL’s FP or fpLLL’s double<br />

•’qd’ - quad doubles: NTL’s QP<br />

•’qd1’ - quad doubles: uses quad_float precision to compute Gram-Schmidt, but uses double precision<br />

in the search phase <strong>of</strong> the block reduction algorithm. This seems adequate for most purposes,<br />

<strong>and</strong> is faster than ‘qd’, which uses quad_float precision uniformly throughout.<br />

•’xd’ - extended exponent: NTL’s XD<br />

•’rr’ - arbitrary precision (default)<br />

•block_size - specifies the size <strong>of</strong> the blocks in the reduction. High values yield shorter vectors,<br />

but the running time increases exponentially with block_size. block_size should be between<br />

2 <strong>and</strong> the number <strong>of</strong> rows <strong>of</strong> self (default: 10)<br />

•prune - The optional parameter prune can be set to any positive number to invoke the Volume<br />

Heuristic from [Schnorr <strong>and</strong> Horner, Eurocrypt ‘95]. This can significantly reduce the running time,<br />

<strong>and</strong> hence allow much bigger block size, but the quality <strong>of</strong> the reduction is <strong>of</strong> course not as good in<br />

general. Higher values <strong>of</strong> prune mean better quality, <strong>and</strong> slower running time. When prune == 0,<br />

pruning is disabled. Recommended usage: for block_size = 30, set 10 = prune = 15.<br />

•use_givens - use Given’s orthogonalization. This is a bit slower, but generally much more stable,<br />

<strong>and</strong> is really the preferred orthogonalization strategy. For a nice description <strong>of</strong> this, see Chapter 5 <strong>of</strong><br />

[G. Golub <strong>and</strong> C. van Loan, Matrix Computations, 3rd edition, Johns Hopkins Univ. Press, 1996].<br />

EXAMPLE:<br />

sage: A = Matrix(ZZ,3,3,range(1,10))<br />

sage: A.BKZ()<br />

[ 0 0 0]<br />

[ 2 1 0]<br />

[-1 1 3]<br />

sage: A = Matrix(ZZ,3,3,range(1,10))<br />

sage: A.BKZ(use_givens=True)<br />

[ 0 0 0]<br />

[ 2 1 0]<br />

[-1 1 3]<br />

sage: A = Matrix(ZZ,3,3,range(1,10))<br />

sage: A.BKZ(fp="fp")<br />

[ 0 0 0]<br />

[ 2 1 0]<br />

[-1 1 3]<br />

314 Chapter 17. Dense matrices over the integer ring

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

Saved successfully!

Ooh no, something went wrong!