1 /*
2  * Copyright(C) LinBox
3  *
4  * ========LICENCE========
5  * This file is part of the library LinBox.
6  *
7  * LinBox is free software: you can redistribute it and/or modify
8  * it under the terms of the  GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20  * ========LICENCE========
21  *
22  * Written by Clément Pernet
23  */
24 
25 #pragma once
26 
27 #include <linbox/matrix/dense-matrix.h>
28 #include <linbox/matrix/sparse-matrix.h>
29 #include <linbox/solutions/methods.h>
30 namespace LinBox {
31     //
32     // row echelon
33     //
34 
35     /**
36      * \brief rowEchelon specialisation for Auto.
37      */
38     template <class Matrix, class CategoryTag>
rowEchelon(Matrix & E,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)39     size_t rowEchelon (Matrix & E, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
40     {
41         return rowEchelon (E, A, tag, reinterpret_cast<const Method::Elimination&>(m));
42     }
43 
44     /**
45      * \brief rowEchelon specialisation for Auto with DenseMatrix and ModularTag.
46      */
47     template <class Field>
rowEchelon(DenseMatrix<Field> & E,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)48     size_t rowEchelon (DenseMatrix<Field>& E, const DenseMatrix<Field>& A,
49                               const RingCategories::ModularTag& tag, const Method::Auto& m)
50     {
51         return rowEchelon (E, A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
52     }
53 
54     /**
55      * \brief rowEchelon specialisation for Auto.
56      */
57     template <class Matrix, class CategoryTag>
rowEchelon(Matrix & E,Matrix & T,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)58     size_t rowEchelon (Matrix & E, Matrix & T, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
59     {
60         return rowEchelon (E, A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
61     }
62 
63     /**
64      * \brief rowEchelon specialisation for Auto with DenseMatrix and ModularTag.
65      */
66     template <class Field>
rowEchelon(DenseMatrix<Field> & E,DenseMatrix<Field> & T,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)67     size_t rowEchelon (DenseMatrix<Field>& E, DenseMatrix<Field>& T, const DenseMatrix<Field>& A,
68                               const RingCategories::ModularTag& tag, const Method::Auto& m)
69     {
70         return rowEchelon (E, A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
71     }
72 
73     //
74     // row echelonize
75     //
76 
77     /**
78      * \brief rowEchelonize specialisation for Auto.
79      */
80     template <class Matrix, class CategoryTag>
rowEchelonize(Matrix & A,const CategoryTag & tag,const Method::Auto & m)81     size_t rowEchelonize (Matrix & A, const CategoryTag& tag, const Method::Auto& m)
82     {
83         return rowEchelonize (A, tag, reinterpret_cast<const Method::Elimination&>(m));
84     }
85 
86     /**
87      * \brief rowEchelonize specialisation for Auto with DenseMatrix and ModularTag.
88      */
89     template <class Field>
rowEchelonize(DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)90     size_t rowEchelonize (DenseMatrix<Field>& A,
91                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
92     {
93         return rowEchelonize (A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
94     }
95 
96     /**
97      * \brief rowEchelonize specialisation for Auto.
98      */
99     template <class Matrix, class CategoryTag>
rowEchelonize(Matrix & A,Matrix & T,const CategoryTag & tag,const Method::Auto & m)100     size_t rowEchelonize (Matrix & A, Matrix & T, const CategoryTag& tag, const Method::Auto& m)
101     {
102         return rowEchelonize (A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
103     }
104 
105     /**
106      * \brief rowEchelonize specialisation for Auto with DenseMatrix and ModularTag.
107      */
108     template <class Field>
rowEchelonize(DenseMatrix<Field> & A,DenseMatrix<Field> & T,const RingCategories::ModularTag & tag,const Method::Auto & m)109     size_t rowEchelonize (DenseMatrix<Field>& A, DenseMatrix<Field>& T,
110                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
111     {
112         return rowEchelonize (A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
113     }
114 
115     //
116     // reduced row echelon
117     //
118 
119     /**
120      * \brief reducedRowEchelon specialisation for Auto.
121      */
122     template <class Matrix, class CategoryTag>
reducedRowEchelon(Matrix & E,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)123     size_t reducedRowEchelon (Matrix & E, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
124     {
125         return reducedRowEchelon (E, A, tag, reinterpret_cast<const Method::Elimination&>(m));
126     }
127 
128     /**
129      * \brief reducedRowEchelon specialisation for Auto with DenseMatrix and ModularTag.
130      */
131     template <class Field>
reducedRowEchelon(DenseMatrix<Field> & E,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)132     size_t reducedRowEchelon (DenseMatrix<Field>& E, const DenseMatrix<Field>& A,
133                               const RingCategories::ModularTag& tag, const Method::Auto& m)
134     {
135         return reducedRowEchelon (E, A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
136     }
137 
138     /**
139      * \brief reducedRowEchelon specialisation for Auto.
140      */
141     template <class Matrix, class CategoryTag>
reducedRowEchelon(Matrix & E,Matrix & T,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)142     size_t reducedRowEchelon (Matrix & E, Matrix & T, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
143     {
144         return reducedRowEchelon (E, A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
145     }
146 
147     /**
148      * \brief reducedRowEchelon specialisation for Auto with DenseMatrix and ModularTag.
149      */
150     template <class Field>
reducedRowEchelon(DenseMatrix<Field> & E,DenseMatrix<Field> & T,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)151     size_t reducedRowEchelon (DenseMatrix<Field>& E, DenseMatrix<Field>& T, const DenseMatrix<Field>& A,
152                               const RingCategories::ModularTag& tag, const Method::Auto& m)
153     {
154         return reducedRowEchelon (E, A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
155     }
156 
157     //
158     // row echelonize
159     //
160 
161     /**
162      * \brief reducedRowEchelonize specialisation for Auto.
163      */
164     template <class Matrix, class CategoryTag>
reducedRowEchelonize(Matrix & A,const CategoryTag & tag,const Method::Auto & m)165     size_t reducedRowEchelonize (Matrix & A, const CategoryTag& tag, const Method::Auto& m)
166     {
167         return reducedRowEchelonize (A, tag, reinterpret_cast<const Method::Elimination&>(m));
168     }
169 
170     /**
171      * \brief reducedRowEchelonize specialisation for Auto with DenseMatrix and ModularTag.
172      */
173     template <class Field>
reducedRowEchelonize(DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)174     size_t reducedRowEchelonize (DenseMatrix<Field>& A,
175                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
176     {
177         return reducedRowEchelonize (A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
178     }
179 
180     /**
181      * \brief reducedRowEchelonize specialisation for Auto.
182      */
183     template <class Matrix, class CategoryTag>
reducedRowEchelonize(Matrix & A,Matrix & T,const CategoryTag & tag,const Method::Auto & m)184     size_t reducedRowEchelonize (Matrix & A, Matrix & T, const CategoryTag& tag, const Method::Auto& m)
185     {
186         return reducedRowEchelonize (A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
187     }
188 
189     /**
190      * \brief reducedRowEchelonize specialisation for Auto with DenseMatrix and ModularTag.
191      */
192     template <class Field>
reducedRowEchelonize(DenseMatrix<Field> & A,DenseMatrix<Field> & T,const RingCategories::ModularTag & tag,const Method::Auto & m)193     size_t reducedRowEchelonize (DenseMatrix<Field>& A, DenseMatrix<Field>& T,
194                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
195     {
196         return reducedRowEchelonize (A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
197     }
198     //
199     // column echelon
200     //
201 
202     /**
203      * \brief colEchelon specialisation for Auto.
204      */
205     template <class Matrix, class CategoryTag>
colEchelon(Matrix & E,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)206     size_t colEchelon (Matrix & E, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
207     {
208         return colEchelon (E, A, tag, reinterpret_cast<const Method::Elimination&>(m));
209     }
210 
211     /**
212      * \brief colEchelon specialisation for Auto with DenseMatrix and ModularTag.
213      */
214     template <class Field>
colEchelon(DenseMatrix<Field> & E,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)215     size_t colEchelon (DenseMatrix<Field>& E, const DenseMatrix<Field>& A,
216                        const RingCategories::ModularTag& tag, const Method::Auto& m)
217     {
218         return colEchelon (E, A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
219     }
220 
221     /**
222      * \brief colEchelon specialisation for Auto.
223      */
224     template <class Matrix, class CategoryTag>
colEchelon(Matrix & E,Matrix & T,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)225     size_t colEchelon (Matrix & E, Matrix & T, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
226     {
227         return colEchelon (E, A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
228     }
229 
230     /**
231      * \brief colEchelon specialisation for Auto with DenseMatrix and ModularTag.
232      */
233     template <class Field>
colEchelon(DenseMatrix<Field> & E,DenseMatrix<Field> & T,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)234     size_t colEchelon (DenseMatrix<Field>& E, DenseMatrix<Field>& T, const DenseMatrix<Field>& A,
235                               const RingCategories::ModularTag& tag, const Method::Auto& m)
236     {
237         return colEchelon (E, A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
238     }
239 
240     //
241     // col echelonize
242     //
243 
244     /**
245      * \brief colEchelonize specialisation for Auto.
246      */
247     template <class Matrix, class CategoryTag>
colEchelonize(Matrix & A,const CategoryTag & tag,const Method::Auto & m)248     size_t colEchelonize (Matrix & A, const CategoryTag& tag, const Method::Auto& m)
249     {
250         return colEchelonize (A, tag, reinterpret_cast<const Method::Elimination&>(m));
251     }
252 
253     /**
254      * \brief colEchelonize specialisation for Auto with DenseMatrix and ModularTag.
255      */
256     template <class Field>
colEchelonize(DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)257     size_t colEchelonize (DenseMatrix<Field>& A,
258                           const RingCategories::ModularTag& tag, const Method::Auto& m)
259     {
260         return colEchelonize (A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
261     }
262 
263     /**
264      * \brief colEchelonize specialisation for Auto.
265      */
266     template <class Matrix, class CategoryTag>
colEchelonize(Matrix & A,Matrix & T,const CategoryTag & tag,const Method::Auto & m)267     size_t colEchelonize (Matrix & A, Matrix & T, const CategoryTag& tag, const Method::Auto& m)
268     {
269         return colEchelonize (A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
270     }
271 
272     /**
273      * \brief colEchelonize specialisation for Auto with DenseMatrix and ModularTag.
274      */
275     template <class Field>
colEchelonize(DenseMatrix<Field> & A,DenseMatrix<Field> & T,const RingCategories::ModularTag & tag,const Method::Auto & m)276     size_t colEchelonize (DenseMatrix<Field>& A, DenseMatrix<Field>& T,
277                           const RingCategories::ModularTag& tag, const Method::Auto& m)
278     {
279         return colEchelonize (A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
280     }
281 
282     //
283     // reduced col echelon
284     //
285 
286     /**
287      * \brief reducedColEchelon specialisation for Auto.
288      */
289     template <class Matrix, class CategoryTag>
reducedColEchelon(Matrix & E,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)290     size_t reducedColEchelon (Matrix & E, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
291     {
292         return reducedColEchelon (E, A, tag, reinterpret_cast<const Method::Elimination&>(m));
293     }
294 
295     /**
296      * \brief reducedColEchelon specialisation for Auto with DenseMatrix and ModularTag.
297      */
298     template <class Field>
reducedColEchelon(DenseMatrix<Field> & E,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)299     size_t reducedColEchelon (DenseMatrix<Field>& E, const DenseMatrix<Field>& A,
300                               const RingCategories::ModularTag& tag, const Method::Auto& m)
301     {
302         return reducedColEchelon (E, A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
303     }
304 
305     /**
306      * \brief reducedColEchelon specialisation for Auto.
307      */
308     template <class Matrix, class CategoryTag>
reducedColEchelon(Matrix & E,Matrix & T,const Matrix & A,const CategoryTag & tag,const Method::Auto & m)309     size_t reducedColEchelon (Matrix & E, Matrix & T, const Matrix& A, const CategoryTag& tag, const Method::Auto& m)
310     {
311         return reducedColEchelon (E, A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
312     }
313 
314     /**
315      * \brief reducedColEchelon specialisation for Auto with DenseMatrix and ModularTag.
316      */
317     template <class Field>
reducedColEchelon(DenseMatrix<Field> & E,DenseMatrix<Field> & T,const DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)318     size_t reducedColEchelon (DenseMatrix<Field>& E, DenseMatrix<Field>& T, const DenseMatrix<Field>& A,
319                               const RingCategories::ModularTag& tag, const Method::Auto& m)
320     {
321         return reducedColEchelon (E, A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
322     }
323 
324     //
325     // col echelonize
326     //
327 
328     /**
329      * \brief reducedColEchelonize specialisation for Auto.
330      */
331     template <class Matrix, class CategoryTag>
reducedColEchelonize(Matrix & A,const CategoryTag & tag,const Method::Auto & m)332     size_t reducedColEchelonize (Matrix & A, const CategoryTag& tag, const Method::Auto& m)
333     {
334         return reducedColEchelonize (A, tag, reinterpret_cast<const Method::Elimination&>(m));
335     }
336 
337     /**
338      * \brief reducedColEchelonize specialisation for Auto with DenseMatrix and ModularTag.
339      */
340     template <class Field>
reducedColEchelonize(DenseMatrix<Field> & A,const RingCategories::ModularTag & tag,const Method::Auto & m)341     size_t reducedColEchelonize (DenseMatrix<Field>& A,
342                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
343     {
344         return reducedColEchelonize (A, tag, reinterpret_cast<const Method::DenseElimination&>(m));
345     }
346 
347     /**
348      * \brief reducedColEchelonize specialisation for Auto.
349      */
350     template <class Matrix, class CategoryTag>
reducedColEchelonize(Matrix & A,Matrix & T,const CategoryTag & tag,const Method::Auto & m)351     size_t reducedColEchelonize (Matrix & A, Matrix & T, const CategoryTag& tag, const Method::Auto& m)
352     {
353         return reducedColEchelonize (A, T, tag, reinterpret_cast<const Method::Elimination&>(m));
354     }
355 
356     /**
357      * \brief reducedColEchelonize specialisation for Auto with DenseMatrix and ModularTag.
358      */
359     template <class Field>
reducedColEchelonize(DenseMatrix<Field> & A,DenseMatrix<Field> & T,const RingCategories::ModularTag & tag,const Method::Auto & m)360     size_t reducedColEchelonize (DenseMatrix<Field>& A, DenseMatrix<Field>& T,
361                                  const RingCategories::ModularTag& tag, const Method::Auto& m)
362     {
363         return reducedColEchelonize (A, T, tag, reinterpret_cast<const Method::DenseElimination&>(m));
364     }
365 }
366 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
367 // vim:sts=4:sw=4:ts=4:et:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
368 
369