1 | |
---|
2 | /**************************************************************************\ |
---|
3 | |
---|
4 | MODULE: mat_zz_pE |
---|
5 | |
---|
6 | SUMMARY: |
---|
7 | |
---|
8 | Defines the class mat_zz_pE. |
---|
9 | |
---|
10 | \**************************************************************************/ |
---|
11 | |
---|
12 | |
---|
13 | #include <NTL/matrix.h> |
---|
14 | #include <NTL/vec_vec_lzz_pE.h> |
---|
15 | |
---|
16 | NTL_matrix_decl(zz_pE,vec_zz_pE,vec_vec_zz_pE,mat_zz_pE) |
---|
17 | NTL_io_matrix_decl(zz_pE,vec_zz_pE,vec_vec_zz_pE,mat_zz_pE) |
---|
18 | NTL_eq_matrix_decl(zz_pE,vec_zz_pE,vec_vec_zz_pE,mat_zz_pE) |
---|
19 | |
---|
20 | void add(mat_zz_pE& X, const mat_zz_pE& A, const mat_zz_pE& B); |
---|
21 | // X = A + B |
---|
22 | |
---|
23 | void sub(mat_zz_pE& X, const mat_zz_pE& A, const mat_zz_pE& B); |
---|
24 | // X = A - B |
---|
25 | |
---|
26 | void negate(mat_zz_pE& X, const mat_zz_pE& A); |
---|
27 | // X = - A |
---|
28 | |
---|
29 | void mul(mat_zz_pE& X, const mat_zz_pE& A, const mat_zz_pE& B); |
---|
30 | // X = A * B |
---|
31 | |
---|
32 | void mul(vec_zz_pE& x, const mat_zz_pE& A, const vec_zz_pE& b); |
---|
33 | // x = A * b |
---|
34 | |
---|
35 | void mul(vec_zz_pE& x, const vec_zz_pE& a, const mat_zz_pE& B); |
---|
36 | // x = a * B |
---|
37 | |
---|
38 | void mul(mat_zz_pE& X, const mat_zz_pE& A, const zz_pE& b); |
---|
39 | void mul(mat_zz_pE& X, const mat_zz_pE& A, const zz_p& b); |
---|
40 | void mul(mat_zz_pE& X, const mat_zz_pE& A, long b); |
---|
41 | // X = A * b |
---|
42 | |
---|
43 | void mul(mat_zz_pE& X, const zz_pE& a, const mat_zz_pE& B); |
---|
44 | void mul(mat_zz_pE& X, const zz_p& a, const mat_zz_pE& B); |
---|
45 | void mul(mat_zz_pE& X, long a, const mat_zz_pE& B); |
---|
46 | // X = a * B |
---|
47 | |
---|
48 | |
---|
49 | void determinant(zz_pE& d, const mat_zz_pE& A); |
---|
50 | zz_pE determinant(const mat_zz_pE& a); |
---|
51 | // d = determinant(A) |
---|
52 | |
---|
53 | |
---|
54 | void transpose(mat_zz_pE& X, const mat_zz_pE& A); |
---|
55 | mat_zz_pE transpose(const mat_zz_pE& A); |
---|
56 | // X = transpose of A |
---|
57 | |
---|
58 | void solve(zz_pE& d, vec_zz_pE& X, |
---|
59 | const mat_zz_pE& A, const vec_zz_pE& b); |
---|
60 | // A is an n x n matrix, b is a length n vector. Computes d = |
---|
61 | // determinant(A). If d != 0, solves x*A = b. |
---|
62 | |
---|
63 | void inv(zz_pE& d, mat_zz_pE& X, const mat_zz_pE& A); |
---|
64 | // A is an n x n matrix. Computes d = determinant(A). If d != 0, |
---|
65 | // computes X = A^{-1}. |
---|
66 | |
---|
67 | void sqr(mat_zz_pE& X, const mat_zz_pE& A); |
---|
68 | mat_zz_pE sqr(const mat_zz_pE& A); |
---|
69 | // X = A*A |
---|
70 | |
---|
71 | void inv(mat_zz_pE& X, const mat_zz_pE& A); |
---|
72 | mat_zz_pE inv(const mat_zz_pE& A); |
---|
73 | // X = A^{-1}; error is raised if A is singular |
---|
74 | |
---|
75 | void power(mat_zz_pE& X, const mat_zz_pE& A, const ZZ& e); |
---|
76 | mat_zz_pE power(const mat_zz_pE& A, const ZZ& e); |
---|
77 | |
---|
78 | void power(mat_zz_pE& X, const mat_zz_pE& A, long e); |
---|
79 | mat_zz_pE power(const mat_zz_pE& A, long e); |
---|
80 | // X = A^e; e may be negative (in which case A must be nonsingular). |
---|
81 | |
---|
82 | void ident(mat_zz_pE& X, long n); |
---|
83 | mat_zz_pE ident_mat_zz_pE(long n); |
---|
84 | // X = n x n identity matrix |
---|
85 | |
---|
86 | long IsIdent(const mat_zz_pE& A, long n); |
---|
87 | // test if A is the n x n identity matrix |
---|
88 | |
---|
89 | void diag(mat_zz_pE& X, long n, const zz_pE& d); |
---|
90 | mat_zz_pE diag(long n, const zz_pE& d); |
---|
91 | // X = n x n diagonal matrix with d on diagonal |
---|
92 | |
---|
93 | long IsDiag(const mat_zz_pE& A, long n, const zz_pE& d); |
---|
94 | // test if X is an n x n diagonal matrix with d on diagonal |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | long gauss(mat_zz_pE& M); |
---|
100 | long gauss(mat_zz_pE& M, long w); |
---|
101 | // Performs unitary row operations so as to bring M into row echelon |
---|
102 | // form. If the optional argument w is supplied, stops when first w |
---|
103 | // columns are in echelon form. The return value is the rank (or the |
---|
104 | // rank of the first w columns). |
---|
105 | |
---|
106 | void image(mat_zz_pE& X, const mat_zz_pE& A); |
---|
107 | // The rows of X are computed as basis of A's row space. X is is row |
---|
108 | // echelon form |
---|
109 | |
---|
110 | void kernel(mat_zz_pE& X, const mat_zz_pE& A); |
---|
111 | // Computes a basis for the kernel of the map x -> x*A. where x is a |
---|
112 | // row vector. |
---|
113 | |
---|
114 | |
---|
115 | |
---|
116 | // miscellaneous: |
---|
117 | |
---|
118 | void clear(mat_zz_pE& a); |
---|
119 | // x = 0 (dimension unchanged) |
---|
120 | |
---|
121 | long IsZero(const mat_zz_pE& a); |
---|
122 | // test if a is the zero matrix (any dimension) |
---|
123 | |
---|
124 | |
---|
125 | // operator notation: |
---|
126 | |
---|
127 | mat_zz_pE operator+(const mat_zz_pE& a, const mat_zz_pE& b); |
---|
128 | mat_zz_pE operator-(const mat_zz_pE& a, const mat_zz_pE& b); |
---|
129 | mat_zz_pE operator*(const mat_zz_pE& a, const mat_zz_pE& b); |
---|
130 | |
---|
131 | mat_zz_pE operator-(const mat_zz_pE& a); |
---|
132 | |
---|
133 | |
---|
134 | // matrix/scalar multiplication: |
---|
135 | |
---|
136 | mat_zz_pE operator*(const mat_zz_pE& a, const zz_pE& b); |
---|
137 | mat_zz_pE operator*(const mat_zz_pE& a, const zz_p& b); |
---|
138 | mat_zz_pE operator*(const mat_zz_pE& a, long b); |
---|
139 | |
---|
140 | mat_zz_pE operator*(const zz_pE& a, const mat_zz_pE& b); |
---|
141 | mat_zz_pE operator*(const zz_p& a, const mat_zz_pE& b); |
---|
142 | mat_zz_pE operator*(long a, const mat_zz_pE& b); |
---|
143 | |
---|
144 | // matrix/vector multiplication: |
---|
145 | |
---|
146 | vec_zz_pE operator*(const mat_zz_pE& a, const vec_zz_pE& b); |
---|
147 | |
---|
148 | vec_zz_pE operator*(const vec_zz_pE& a, const mat_zz_pE& b); |
---|
149 | |
---|
150 | |
---|
151 | // assignment operator notation: |
---|
152 | |
---|
153 | mat_zz_pE& operator+=(mat_zz_pE& x, const mat_zz_pE& a); |
---|
154 | mat_zz_pE& operator-=(mat_zz_pE& x, const mat_zz_pE& a); |
---|
155 | mat_zz_pE& operator*=(mat_zz_pE& x, const mat_zz_pE& a); |
---|
156 | |
---|
157 | mat_zz_pE& operator*=(mat_zz_pE& x, const zz_pE& a); |
---|
158 | mat_zz_pE& operator*=(mat_zz_pE& x, const zz_p& a); |
---|
159 | mat_zz_pE& operator*=(mat_zz_pE& x, long a); |
---|
160 | |
---|
161 | vec_zz_pE& operator*=(vec_zz_pE& x, const mat_zz_pE& a); |
---|
162 | |
---|
163 | |
---|
164 | |
---|