1 // -*- C++ -*-
2 //==============================================================================================
3 //
4 //	This file is part of LiDIA --- a library for computational number theory
5 //
6 //	Copyright (c) 1994--2001 the LiDIA Group.  All rights reserved.
7 //
8 //	See http://www.informatik.tu-darmstadt.de/TI/LiDIA/
9 //
10 //----------------------------------------------------------------------------------------------
11 //
12 //	$Id$
13 //
14 //	Author	: Patrick Theobald (PT)
15 //	Changes	: See CVS log
16 //
17 //==============================================================================================
18 
19 
20 #ifndef LIDIA_MATRIX_REPRESENTATION_H_GUARD_
21 #define LIDIA_MATRIX_REPRESENTATION_H_GUARD_
22 
23 
24 
25 #ifndef LIDIA_BIGINT_H_GUARD_
26 # include	"LiDIA/bigint.h"
27 #endif
28 #ifndef LIDIA_BIGMOD_H_GUARD_
29 # include	"LiDIA/bigmod.h"
30 #endif
31 #ifndef LIDIA_ARRAY_FUNCTIONS_H_GUARD_
32 # include	"LiDIA/base/array_functions.h"
33 #endif
34 #ifndef LIDIA_MATRIX_FLAGS_H_GUARD_
35 # include	"LiDIA/matrix_flags.h"
36 #endif
37 
38 
39 
40 #ifdef LIDIA_NAMESPACE
41 namespace LiDIA {
42 # define IN_NAMESPACE_LIDIA
43 #endif
44 
45 
46 
47 // type defines
48 #define matrix_representation MR
49 
50 // base defines
51 #define DBMKex DBMK< T >
52 #define SBMKex SBMK< T >
53 
54 // ring defines
55 #define DRMKex DRMK< T >
56 #define SRMKex SRMK< T >
57 
58 // field defines
59 #define DFMKex DFMK< T >
60 #define SFMKex SFMK< T >
61 
62 
63 #define FRIEND_HNF(A) friend class A< T, RODMM< T >, RODMM< bigint > >; \
64                       friend class A< T, CODMM< T >, CODMM< bigint > >; \
65                       friend class A< T, ROSMM< T >, ROSMM< bigint > >; \
66                       friend class A< T, COSMM< T >, COSMM< bigint > >; \
67                       friend class havas_kernel< T, RODMM< T >, RODMM< bigint >, A< T, RODMM< T >, RODMM< bigint > > >; \
68                       friend class havas_kernel< T, COSMM< T >, COSMM< bigint >, A< T, COSMM< T >, COSMM< bigint > > >
69 
70 // base matrix
71 template< class T > class DBMK;
72 template< class T > class SBMK;
73 
74 template< class T, class R1, class R2 > class BMA;
75 
76 template< class T > class base_matrix;
77 
78 // ring matrix
79 template< class T > class DRMK;
80 template< class T > class SRMK;
81 
82 template< class T, class R1, class R2, class R3 > class RMA;
83 
84 template< class T > class ring_matrix;
85 
86 // field matrix
87 template< class T > class DFMK;
88 template< class T > class SFMK;
89 
90 template< class T, class R1, class R2, class R3 > class FMA;
91 
92 // user interface
93 template< class T > class matrix;
94 template< class T > class dense_matrix;
95 
96 
97 // matrix< bigint >
98 template< class T > class RODMM;
99 template< class T > class CODMM;
100 template< class T > class ROSMM;
101 template< class T > class COSMM;
102 
103 template< class T, class R, class R1 > class hermite;
104 template< class T, class R, class R1 > class Bradley;
105 template< class T, class R, class R1 > class Iliopoulos;
106 template< class T, class R, class R1 > class opt;
107 template< class T, class R, class R1 > class Blankinship;
108 template< class T, class R, class R1 > class Best_remainder;
109 template< class T, class R, class R1 > class havas_best_remainder;
110 template< class T, class R, class R1 > class havas_euclidean_norm;
111 template< class T, class R, class R1 > class havas_minimal_norm;
112 template< class T, class R, class R1 > class havas_sorting_gcd;
113 template< class T, class R, class R1 > class havas_min_no_of_elements;
114 
115 template< class T, class R, class R1 > class havas_min_abs_of_row_plus_minimal_euclidean_norm;
116 template< class T, class R, class R1 > class havas_min_abs_of_row_plus_minimal_norm;
117 template< class T, class R, class R1 > class havas_min_abs_of_row_plus_min_no_of_elements;
118 
119 template< class T, class R, class R1 > class havas_minimal_norm_plus_min_abs_of_row;
120 template< class T, class R, class R1 > class havas_minimal_norm_plus_sorting_gcd;
121 template< class T, class R, class R1 > class havas_minimal_norm_plus_min_no_of_elements;
122 
123 template< class T, class R, class R1 > class havas_sorting_gcd_plus_minimal_euclidean_norm;
124 template< class T, class R, class R1 > class havas_sorting_gcd_plus_minimal_norm;
125 template< class T, class R, class R1 > class havas_sorting_gcd_plus_min_no_of_elements;
126 
127 template< class T, class R, class R1 > class havas_min_no_of_elements_plus_min_abs_of_row;
128 template< class T, class R, class R1 > class havas_min_no_of_elements_plus_minimal_euclidean_norm;
129 template< class T, class R, class R1 > class havas_min_no_of_elements_plus_minimal_norm;
130 template< class T, class R, class R1 > class havas_min_no_of_elements_plus_sorting_gcd;
131 
132 template< class T, class R, class R1 > class Storjohann;
133 template< class T, class R, class R1 > class Heuristik;
134 
135 template< class T, class R, class R1 > class havas_best_remainder_ext;
136 template< class T, class R, class R1 > class havas_euclidean_norm_ext;
137 template< class T, class R, class R1 > class nf_conf3e;
138 
139 template< class T, class R, class R1 > class Standard_normalization;
140 template< class T, class R, class R1 > class ChouCollins_normalization;
141 template< class T, class R, class R1 > class Jacobson_normalization;
142 
143 template< class T, class R, class R1, class C > class havas_kernel;
144 template< class T, class R, class R1, class C > class kannan_kernel;
145 template< class T, class R, class R1 > class normalization_kernel;
146 
147 template< class T1, class T2, class T3 > class bigint_matrix_algorithms;
148 template< class T, class S, class M > class modular_arithmetic;
149 template< class T, class S, class M > class modular_bigint_matrix_algorithms;
150 
151 // matrix< fp >
152 template< class T, class M > class dense_fp_matrix_kernel;
153 template< class T, class M > class sparse_fp_matrix_kernel;
154 
155 template< class T, class M > class sparse_fp_matrix_algorithms;
156 
157 template< class T , class M > class solver_kernel;
158 
159 
160 // data structure
161 template< class T >
162 struct matrix_representation
163 {
164 	lidia_size_t rows; // number of rows
165 	lidia_size_t columns; // number of columns
166 
167 	lidia_size_t sparse_rows; // index of the first row in sparse rep.
168 	lidia_size_t sparse_columns; // index of the first column in sparse rep.
169 
170 	T **value;
171 
172 	lidia_size_t **index;
173 
174 	lidia_size_t *value_counter;
175 	lidia_size_t *allocated;
176 
177 	T Zero;
178 
179  	matrix_flags bitfield;
180 };
181 
182 
183 
184 #undef DBMKex
185 #undef SBMKex
186 
187 #undef DRMKex
188 #undef SRMKex
189 
190 #undef DFMKex
191 #undef SFMKex
192 
193 #undef matrix_representation
194 
195 
196 
197 #ifdef LIDIA_NAMESPACE
198 }	// end of namespace LiDIA
199 # undef IN_NAMESPACE_LIDIA
200 #endif
201 
202 
203 
204 #endif	// LIDIA_MATRIX_REPRESENTATION_H_GUARD_
205