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_FLAGS_H_GUARD_
21 #define LIDIA_MATRIX_FLAGS_H_GUARD_
22
23
24
25 #ifndef LIDIA_ARITH_INL_GUARD_
26 # include "LiDIA/arith.inl"
27 #endif
28
29
30
31 #ifdef LIDIA_NAMESPACE
32 namespace LiDIA {
33 # define IN_NAMESPACE_LIDIA
34 #endif
35
36
37
38 class matrix_flags
39 {
40
41 unsigned long print_mode;
42 unsigned long storage_mode;
43
44 public: // should be removed in LiDIA 1.4
45
46 unsigned long structure_mode;
47 unsigned long info_mode;
48 unsigned long lattice_mode;
49
50 public:
51
52 //
53 // PRINT MODE SETTINGS
54 //
55
56 enum {
57 beauty_mode = 0,
58 lidia_mode = 1,
59 gp_mode = 2,
60 maple_mode = 3,
61 mathematica_mode = 4,
62 kash_mode = 5,
63 latex_mode = 6,
64 magma_mode = 7,
65
66 default_print_mode = beauty_mode
67 };
68
69 //
70 // STORAGE MODE SETTINGS
71 //
72
73 enum {
74 representation = 3,
75 dense_representation = 1,
76 sparse_representation = 2,
77 mixed_representation = 3,
78
79 orientation = 4,
80 row_oriented = 0,
81 column_oriented = 4,
82
83 default_storage_mode = dense_representation | row_oriented
84 };
85
86 //
87 // STRUCTURE MODE SETTINGS
88 //
89
90 enum {
91 diag = 1,
92 upper_diag = 2,
93 lower_diag = 4,
94 upper_tria = 8,
95 lower_tria = 16,
96 columns_linind = 32,
97 rows_linind = 64,
98
99 default_structure_mode = 0
100 };
101
102 //
103 // INFO MODE SETTINGS (Position der Diagonalen)
104 //
105
106 enum {
107 diag_up = 1,
108 diag_right = 4,
109 diag_ld_to_ru = 8,
110
111 default_info_mode = 0
112 };
113
114 //
115 // LATTICE MODE SETTINGS
116 //
117
118 enum {
119 default_lattice_mode = 0
120 };
121
122 //
123 // constructor
124 //
125
matrix_flags()126 matrix_flags()
127 {
128 info_mode = default_info_mode;
129 print_mode = default_print_mode;
130 structure_mode = default_structure_mode;
131 storage_mode = default_storage_mode;
132 lattice_mode = default_lattice_mode;
133 }
134
135 //
136 // destructor
137 //
138
~matrix_flags()139 ~matrix_flags() {}
140
141 //
142 // assignment
143 //
144
145 matrix_flags & operator = (const matrix_flags &v)
146 {
147 info_mode = v.info_mode;
148 print_mode = v.print_mode;
149 structure_mode = v.structure_mode;
150 storage_mode = v.storage_mode;
151 lattice_mode = v.lattice_mode;
152
153 return *this;
154 }
155
156 //
157 // swap
158 //
159
160 friend void swap(matrix_flags &, matrix_flags &);
161
162 //
163 // print_mode
164 //
165
166 public:
167
set_print_mode(unsigned long art)168 void set_print_mode(unsigned long art)
169 {
170 print_mode = art;
171 }
172
get_print_mode()173 unsigned long get_print_mode() const
174 {
175 return print_mode;
176 }
177
178 //
179 // set storage_mode / get storage_mode
180 //
181
182 public:
183
set_storage_mode(unsigned long art)184 void set_storage_mode(unsigned long art)
185 {
186 storage_mode = art;
187 }
188
get_storage_mode()189 unsigned long get_storage_mode() const
190 {
191 return storage_mode;
192 }
193
194 //
195 // set structure_mode / get structure_mode
196 //
197
198 public:
199
set_structure_mode(unsigned long art)200 void set_structure_mode(unsigned long art)
201 {
202 structure_mode = art;
203 }
204
get_structure_mode()205 unsigned long get_structure_mode() const
206 {
207 return structure_mode;
208 }
209
210 //
211 // set info_mode / get info_mode
212 //
213
214 public:
215
set_info_mode(unsigned long art)216 void set_info_mode(unsigned long art)
217 {
218 info_mode = art;
219 }
220
get_info_mode()221 unsigned long get_info_mode() const
222 {
223 return info_mode;
224 }
225
226 //
227 // set lattice_mode / get lattice_mode
228 //
229
230 public:
231
set_lattice_mode(unsigned long art)232 void set_lattice_mode(unsigned long art)
233 {
234 lattice_mode = art;
235 }
236
get_lattice_mode()237 unsigned long get_lattice_mode() const
238 {
239 return lattice_mode;
240 }
241
242
243 //
244 // additional functions for changing storage_mode value
245 //
246
247 //
248 // get_representation
249 //
250
251 public:
252
get_representation()253 unsigned long get_representation() const
254 {
255 return (storage_mode & representation);
256 }
257
set_representation(unsigned long art)258 void set_representation(unsigned long art)
259 {
260 storage_mode = storage_mode - (storage_mode & representation) + art;
261 }
262
263 //
264 // get_orientation // set_orientation
265 //
266
267 public:
268
get_orientation()269 unsigned long get_orientation() const
270 {
271 return (storage_mode & orientation);
272 }
273
set_orientation(unsigned long art)274 void set_orientation(unsigned long art)
275 {
276 storage_mode = storage_mode - (storage_mode & orientation) + art;
277 }
278 };
279
280
281
282 inline void
swap(matrix_flags & w,matrix_flags & v)283 swap(matrix_flags &w, matrix_flags &v)
284 {
285 LiDIA::swap(w.info_mode, v.info_mode);
286 LiDIA::swap(w.print_mode, v.print_mode);
287 LiDIA::swap(w.structure_mode, v.structure_mode);
288 LiDIA::swap(w.storage_mode, v.storage_mode);
289 LiDIA::swap(w.lattice_mode, v.lattice_mode);
290 }
291
292
293
294 #ifdef LIDIA_NAMESPACE
295 } // end of namespace LiDIA
296 # undef IN_NAMESPACE_LIDIA
297 #endif
298
299
300
301 #endif // LIDIA_MATRIX_FLAGS_H_GUARD_
302