<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>~/ntl-10.5.0test/doc/mat_ZZ.cpp.html</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim7.4_v2">
<meta name="syntax" content="cpp">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="macvim">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffff; }
body { font-family: monospace; color: #000000; background-color: #ffffff; }
* { font-size: 1em; }
.String { color: #4a708b; }
.PreProc { color: #1874cd; }
.Constant { color: #ff8c00; }
.Statement { color: #b03060; font-weight: bold; }
.Comment { color: #0000ee; font-style: italic; }
.Type { color: #008b00; font-weight: bold; }
-->
</style>
<script type='text/javascript'>
<!--
-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment">/*</span><span class="Comment">*************************************************************************\</span>
<span class="Comment">MODULE: mat_ZZ</span>
<span class="Comment">SUMMARY:</span>
<span class="Comment">Defines the class mat_ZZ.</span>
<span class="Comment">\*************************************************************************</span><span class="Comment">*/</span>
<span class="PreProc">#include </span><span class="String"><NTL/matrix.h></span>
<span class="PreProc">#include </span><span class="String"><NTL/vec_vec_ZZ.h></span>
<span class="Type">typedef</span> Mat<ZZ> mat_ZZ; <span class="Comment">// backward compatibility</span>
<span class="Type">void</span> add(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> mat_ZZ& B);
<span class="Comment">// X = A + B</span>
<span class="Type">void</span> sub(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> mat_ZZ& B);
<span class="Comment">// X = A - B</span>
<span class="Type">void</span> negate(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A);
<span class="Comment">// X = - A</span>
<span class="Type">void</span> mul(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> mat_ZZ& B);
<span class="Comment">// X = A * B</span>
<span class="Type">void</span> mul(vec_ZZ& x, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> vec_ZZ& b);
<span class="Comment">// x = A * b</span>
<span class="Type">void</span> mul(vec_ZZ& x, <span class="Type">const</span> vec_ZZ& a, <span class="Type">const</span> mat_ZZ& B);
<span class="Comment">// x = a * B</span>
<span class="Type">void</span> mul(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> ZZ& b);
<span class="Type">void</span> mul(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> b);
<span class="Comment">// X = A * b</span>
<span class="Type">void</span> mul(mat_ZZ& X, <span class="Type">const</span> ZZ& a, <span class="Type">const</span> mat_ZZ& B);
<span class="Type">void</span> mul(mat_ZZ& X, <span class="Type">long</span> a, <span class="Type">const</span> mat_ZZ& B);
<span class="Comment">// X = a * B</span>
<span class="Type">void</span> determinant(ZZ& d, <span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> deterministic=<span class="Constant">0</span>);
ZZ determinant(<span class="Type">const</span> mat_ZZ& a, <span class="Type">long</span> deterministic=<span class="Constant">0</span>);
<span class="Comment">// d = determinant(A). If !deterministic, a randomized strategy may</span>
<span class="Comment">// be used that errs with probability at most 2^{-80}.</span>
<span class="Type">void</span> solve(ZZ& d, vec_ZZ& x,
<span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> vec_ZZ& b,
<span class="Type">long</span> deterministic=<span class="Constant">0</span>)
<span class="Comment">// computes d = determinant(A) and solves x*A = b*d if d != 0; A must</span>
<span class="Comment">// be a square matrix and have compatible dimensions with b. If</span>
<span class="Comment">// !deterministic, the computation of d may use a randomized strategy</span>
<span class="Comment">// that errs with probability 2^{-80}.</span>
<span class="Type">void</span> solve1(ZZ& d, vec_ZZ& x, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> vec_ZZ& b);
<span class="Comment">// A must be a square matrix.</span>
<span class="Comment">// If A is singular, this routine sets d = 0 and returns.</span>
<span class="Comment">// Otherwise, it computes d, x such that x*A == b*d, </span>
<span class="Comment">// such that d > 0 and minimal.</span>
<span class="Comment">// Note that d is a positive divisor of the determinant,</span>
<span class="Comment">// and is not in general equal to the determinant.</span>
<span class="Comment">// The routine is deterministic, and uses a Hensel lifting strategy.</span>
<span class="Comment">// For backward compatability, there is also a routine called</span>
<span class="Comment">// HenselSolve1 that simply calls solve1.</span>
<span class="Type">void</span> inv(ZZ& d, mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> deterministic=<span class="Constant">0</span>);
<span class="Comment">// computes d = determinant(A) and solves X*A = I*d if d != 0; A must</span>
<span class="Comment">// be a square matrix. If !deterministic, the computation of d may</span>
<span class="Comment">// use a randomized strategy that errs with probability 2^{-80}.</span>
<span class="Comment">// NOTE: See LLL.txt for routines that compute the kernel and</span>
<span class="Comment">// image of an integer matrix.</span>
<span class="Comment">// NOTE: See HNF.txt for a routine that computes Hermite Normal Forms.</span>
<span class="Type">void</span> sqr(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A);
mat_ZZ sqr(<span class="Type">const</span> mat_ZZ& A);
<span class="Comment">// X = A*A </span>
<span class="Type">void</span> inv(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A);
mat_ZZ inv(<span class="Type">const</span> mat_ZZ& A);
<span class="Comment">// X = A^{-1}; error is raised if |det(A)| != 1.</span>
<span class="Type">void</span> power(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> ZZ& e);
mat_ZZ power(<span class="Type">const</span> mat_ZZ& A, <span class="Type">const</span> ZZ& e);
<span class="Type">void</span> power(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> e);
mat_ZZ power(<span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> e);
<span class="Comment">// X = A^e; e may be negative (in which case A must be nonsingular).</span>
<span class="Type">void</span> ident(mat_ZZ& X, <span class="Type">long</span> n);
mat_ZZ ident_mat_ZZ(<span class="Type">long</span> n);
<span class="Comment">// X = n x n identity matrix</span>
<span class="Type">long</span> IsIdent(<span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> n);
<span class="Comment">// test if A is the n x n identity matrix</span>
<span class="Type">void</span> diag(mat_ZZ& X, <span class="Type">long</span> n, <span class="Type">const</span> ZZ& d);
mat_ZZ diag(<span class="Type">long</span> n, <span class="Type">const</span> ZZ& d);
<span class="Comment">// X = n x n diagonal matrix with d on diagonal</span>
<span class="Type">long</span> IsDiag(<span class="Type">const</span> mat_ZZ& A, <span class="Type">long</span> n, <span class="Type">const</span> ZZ& d);
<span class="Comment">// test if X is an n x n diagonal matrix with d on diagonal</span>
<span class="Type">void</span> transpose(mat_ZZ& X, <span class="Type">const</span> mat_ZZ& A);
mat_ZZ transpose(<span class="Type">const</span> mat_ZZ& A);
<span class="Comment">// X = transpose of A</span>
<span class="Type">long</span> CRT(mat_ZZ& a, ZZ& prod, <span class="Type">const</span> mat_zz_p& A);
<span class="Comment">// Incremental Chinese Remaindering: If p is the current zz_p modulus with</span>
<span class="Comment">// (p, prod) = 1; Computes a' such that a' = a mod prod and a' = A mod p,</span>
<span class="Comment">// with coefficients in the interval (-p*prod/2, p*prod/2]; </span>
<span class="Comment">// Sets a := a', prod := p*prod, and returns 1 if a's value changed.</span>
<span class="Comment">// miscellaneous:</span>
<span class="Type">void</span> clear(mat_ZZ& a);
<span class="Comment">// x = 0 (dimension unchanged)</span>
<span class="Type">long</span> IsZero(<span class="Type">const</span> mat_ZZ& a);
<span class="Comment">// test if a is the zero matrix (any dimension)</span>
<span class="Comment">// operator notation:</span>
mat_ZZ <span class="Statement">operator</span>+(<span class="Type">const</span> mat_ZZ& a, <span class="Type">const</span> mat_ZZ& b);
mat_ZZ <span class="Statement">operator</span>-(<span class="Type">const</span> mat_ZZ& a, <span class="Type">const</span> mat_ZZ& b);
mat_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> mat_ZZ& a, <span class="Type">const</span> mat_ZZ& b);
mat_ZZ <span class="Statement">operator</span>-(<span class="Type">const</span> mat_ZZ& a);
<span class="Comment">// matrix/scalar multiplication:</span>
mat_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> mat_ZZ& a, <span class="Type">const</span> ZZ& b);
mat_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> mat_ZZ& a, <span class="Type">long</span> b);
mat_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> ZZ& a, <span class="Type">const</span> mat_ZZ& b);
mat_ZZ <span class="Statement">operator</span>*(<span class="Type">long</span> a, <span class="Type">const</span> mat_ZZ& b);
<span class="Comment">// matrix/vector multiplication:</span>
vec_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> mat_ZZ& a, <span class="Type">const</span> vec_ZZ& b);
vec_ZZ <span class="Statement">operator</span>*(<span class="Type">const</span> vec_ZZ& a, <span class="Type">const</span> mat_ZZ& b);
<span class="Comment">// assignment operator notation:</span>
mat_ZZ& <span class="Statement">operator</span>+=(mat_ZZ& x, <span class="Type">const</span> mat_ZZ& a);
mat_ZZ& <span class="Statement">operator</span>-=(mat_ZZ& x, <span class="Type">const</span> mat_ZZ& a);
mat_ZZ& <span class="Statement">operator</span>*=(mat_ZZ& x, <span class="Type">const</span> mat_ZZ& a);
mat_ZZ& <span class="Statement">operator</span>*=(mat_ZZ& x, <span class="Type">const</span> ZZ& a);
mat_ZZ& <span class="Statement">operator</span>*=(mat_ZZ& x, <span class="Type">long</span> a);
vec_ZZ& <span class="Statement">operator</span>*=(vec_ZZ& x, <span class="Type">const</span> mat_ZZ& a);
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->