This file is indexed.

/usr/include/linbox/algorithms/gauss.h is in liblinbox-dev 1.4.2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
/* linbox/algorithms/gauss.h
 * Copyright (C) 1999 Jean-Guillaume Dumas
 *
 * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas@imag.fr>
 *
 * -----------------------------------------------------------
 * 2003-02-02  Bradford Hovinen  <bghovinen@math.uwaterloo.ca>
 *
 * Ported to new matrix archetype; update interface to meet current
 * standards. Rename gauss_foo as foo and gauss_Uin as upperin
 *
 * Move function definitions to gauss.inl
 * -----------------------------------------------------------
 *
 *
 * ========LICENCE========
 * This file is part of the library LinBox.
 *
 * LinBox is free software: you can redistribute it and/or modify
 * it under the terms of the  GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * ========LICENCE========
 *.
 */

// ========================================================================= //
// (C) The Linbox Group 1999
// Calcul de rang par la méthode de Gauss pivot par ligne, sur matrice creuse
// Time-stamp: <03 Nov 00 19:19:06 Jean-Guillaume.Dumas@imag.fr>
// ========================================================================= //

#ifndef __LINBOX_gauss_H
#define __LINBOX_gauss_H

#include "linbox/util/debug.h"
#include "linbox/util/commentator.h"
#include "linbox/field/archetype.h"
#include "linbox/field/gf2.h"
#include "linbox/matrix/sparse-matrix.h"
#include "linbox/matrix/archetype.h"
#include "linbox/solutions/methods.h"

/** @file algorithms/gauss.h
 * @brief  Gauss elimination and applications for sparse matrices.
 * Rank, nullspace, solve...
 * @warning this codes expects SparseSeq matrices
 */

namespace LinBox
{

	/** \brief Repository of functions for rank by elimination on sparse matrices.

	  Several versions allow for adjustment of the pivoting strategy
	  and for choosing in-place elimination or for not modifying the input matrix.
	  Also an LU interface is offered.
	  */
	template <class _Field>
	class GaussDomain {
	public:
		typedef _Field Field;
		typedef typename Field::Element Element;

	private:
		const Field         *_field;

	public:

		/** \brief The field parameter is the domain
		 * over which to perform computations
		 */
		GaussDomain (const Field &F) :
			_field (&F)
		{}

		//Copy constructor
		///
		GaussDomain (const GaussDomain &Mat) :
			_field (Mat._field)
		{}

		/** accessor for the field of computation
		*/
		const Field &field () const { return *_field; }

		/** @name rank
		  Callers of the different rank routines\\
		  -/ The "in" suffix indicates in place computation\\
		  -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse
		  row vectors, NOT storing any zero.\\
		  -/ Calls @link rankinLinearPivoting@endlink (by default) or @link rankinNoReordering@endlink
		  */
		//@{
		///
		template <class Matrix> unsigned long& rankin(unsigned long &rank,
							      Matrix        &A,
							      SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> unsigned long& rankin(unsigned long &rank,
		Matrix        &A,
		unsigned long  Ni,
		unsigned long  Nj,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> unsigned long& rank(unsigned long &rank,
		const Matrix        &A,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> unsigned long& rank(unsigned long &rank,
		const Matrix        &A,
		unsigned long  Ni,
		unsigned long  Nj,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		//@}

		/** @name det
		  Callers of the different determinant routines\\
		  -/ The "in" suffix indicates in place computation\\
		  -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse
		  row vectors, NOT storing any zero.\\
		  -/ Calls @link LinearPivoting@endlink (by default) or @link NoReordering@endlink
		  */
		//@{
		///
		template <class Matrix> Element& detin(Element &determinant,
		Matrix        &A,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> Element& detin(Element &determinant,
		Matrix        &A,
		unsigned long  Ni,
		unsigned long  Nj,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> Element& det(Element &determinant,
		const Matrix        &A,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		///
		template <class Matrix> Element& det(Element &determinant,
		const Matrix        &A,
		unsigned long  Ni,
		unsigned long  Nj,
		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
		//@}


		/** \brief Sparse in place Gaussian elimination with reordering to reduce fill-in.
		 * Pivots are chosen in sparsest column of sparsest row.
		 * This runs in linear overhead.
		 * It is similar in spirit but different from Markovitz' approach.
		 *
		 * \pre Using : SparseFindPivot(..., density) for sparsest column, and
		 * eliminate (..., density)
		 *
		 * The Matrix parameter must meet the LinBox sparse matrix interface.
		 * [check details].
		 * The computedet indicates whether the algorithm must compute the determionant as it goes
		 *
		 * @bib
		 * - Jean-Guillaume Dumas and  Gilles Villard,
		 * <i>Computing the rank of sparse matrices over finite fields</i>.
		 * In Ganzha et~al. CASC'2002, pages 47--62.
		 */
		template <class Matrix, class Perm>
		unsigned long& QLUPin(unsigned long &rank,
				      Element& determinant,
				      Perm          &Q,
				      Matrix	    &L,
				      Matrix        &U,
				      Perm	    &P,
				      unsigned long Ni,
				      unsigned long Nj) const;

		template <class Matrix, class Perm>
		unsigned long& DenseQLUPin(unsigned long &rank,
				      Element& determinant,
				      std::deque<std::pair<size_t,size_t> > &invQ,
				      Matrix	    &L,
				      Matrix        &U,
				      Perm	    &P,
				      unsigned long Ni,
				      unsigned long Nj) const;

		template <class Matrix, class Perm, class Vector1, class Vector2>
		Vector1& solve(Vector1& x, Vector1& w, unsigned long rank, const Perm& Q, const Matrix& L, const Matrix& U, const Perm& P, const Vector2& b)  const;


		template <class Matrix, class Vector1, class Vector2>
		Vector1& solvein(Vector1	&x,
				 Matrix         &A,
				 const Vector2	&b)  const;

		template <class Matrix, class Vector1, class Vector2, class Random>
		Vector1& solvein(Vector1	&x,
				 Matrix         &A,
				 const Vector2	&b, Random& generator)  const;


		template <class Matrix, class Perm, class Block>
		Block& nullspacebasis(Block& x,
				      unsigned long rank,
				      const Matrix& U,
				      const Perm& P)  const ;

		template <class Matrix, class Block>
		Block& nullspacebasisin(Block& x, Matrix& A)  const;

		template <class Matrix, class Block>
		Block& nullspacebasis(Block& x, const Matrix& A)  const;


		// Sparsest method
		//   erases elements while computing rank/det.
		template <class Matrix>
		unsigned long& InPlaceLinearPivoting(unsigned long &rank,
						     Element& determinant,
						     Matrix        &A,
						     unsigned long Ni,
						     unsigned long Nj) const;

		// Same as the latter but keeps trace
		//   of column permutations
		//   of remaining elements in the matrix
		template <class Matrix,class Perm>
		unsigned long& InPlaceLinearPivoting(unsigned long &rank,
						     Element& determinant,
						     Matrix        &A,
						     Perm          &P,
						     unsigned long Ni,
						     unsigned long Nj) const;


		/** \brief Sparse Gaussian elimination without reordering.

		  Gaussian elimination is done on a copy of the matrix.
Using : SparseFindPivot
eliminate

Requirements : SLA is an array of sparse rows
WARNING : NOT IN PLACE, THERE IS A COPY.
Without reordering (Pivot is first non-zero in row)

*/
		template <class Matrix>
		unsigned long& NoReordering (unsigned long &rank, Element& determinant, Matrix &LigneA, unsigned long Ni, unsigned long Nj) const;

		/** \brief Dense in place LU factorization without reordering

Using : FindPivot and LU
*/
		template <class Matrix>
		unsigned long &LUin (unsigned long &rank, Matrix &A) const;


		/** \brief Dense in place Gaussian elimination without reordering

Using : FindPivot and LU
*/
		template <class Matrix>
		unsigned long &upperin (unsigned long &rank, Matrix &A) const;



	protected:

		//-----------------------------------------
		// Sparse elimination using a pivot row :
		// lc <-- lc - lc[k]/lp[0] * lp
		// D is the number of elements per column
		//   it is updated and used for reordering
		// Vector is a vector of Pair (lin_pair.h)
		//-----------------------------------------
		template <class Vector, class D>
		void eliminate (Element             & headpivot,
				Vector              &lignecourante,
				const Vector        &lignepivot,
				const unsigned long indcol,
				const long indpermut,
				const unsigned long npiv,
				D                   &columns) const;

		template <class Vector, class D>
		void eliminate (Vector              &lignecourante,
				const Vector        &lignepivot,
				const unsigned long &indcol,
				const long &indpermut,
				D                   &columns) const;

		template <class Vector>
		void permute (Vector              &lignecourante,
			      const unsigned long &indcol,
			      const long &indpermut) const;
		//-----------------------------------------
		// Sparse elimination using a pivot row :
		// lc <-- lc - lc[k]/lp[0] * lp
		// No density update
		// Vector is a vector of Pair (lin_pair.h)
		//-----------------------------------------
		template <class Vector>
		void eliminate (Vector              &lignecourante,
				const Vector        &lignepivot,
				const unsigned long &indcol,
				const long &indpermut) const;

		//-----------------------------------------
		// Dense elimination using a pivot row :
		// lc <-- lc - lc[k]/lp[0] * lp
		// Computing only for k to n (and not 0 to n in LU)
		//-----------------------------------------
		template<class Vector>
		void Upper (Vector       &lignecur,
			    const Vector &lignepivot,
			    unsigned long indcol,
			    long indpermut) const;

		//-----------------------------------------
		// Dense elimination using a pivot row :
		// lc <-- lc - lc[k]/lp[0] * lp
		//-----------------------------------------
		template <class Vector>
		void LU (Vector       &lignecur,
			 const Vector &lignepivot,
			 unsigned long indcol,
			 long indpermut) const;

		//------------------------------------------
		// Looking for a non-zero pivot in a row
		// Using the column density for reordering
		// Pivot is chosen as to :
		// 1. Row density is minimum
		// 2. Column density is minimum for this row
		//------------------------------------------
		template <class Vector, class D>
		void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, D &columns, Element& determinant) const;

		//------------------------------------------
		// Looking for a non-zero pivot in a row
		// No reordering
		//------------------------------------------
		template <class Vector>
		void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, Element& determinant) const;

		//------------------------------------------
		// Looking for a non-zero pivot in a row
		// Dense search
		//------------------------------------------
		template <class Vector>
		void FindPivot (Vector &lignepivot, unsigned long &k, long &indpermut) const;

		template <class Matrix, class Perm>
		unsigned long& SparseContinuation(unsigned long &rank,
				      Element& determinant,
				      std::deque<std::pair<size_t,size_t> > &invQ,
				      Matrix	    &L,
				      Matrix        &U,
				      Perm	    &P,
				      unsigned long Ni,
				      unsigned long Nj) const;

        
		template <class Matrix, class Perm, bool hasFFLAS>
        struct Continuation {
            unsigned long& operator()(
                unsigned long &rank,
                Element& determinant,
                std::deque<std::pair<size_t,size_t> > &invQ,
                Matrix	    &L,
                Matrix        &U,
                Perm	    &P,
                unsigned long Ni,
                unsigned long Nj, bool) const;
        };
	};


} // namespace LinBox

#include "linbox/algorithms/gauss/gauss.inl"
#include "linbox/algorithms/gauss/gauss-pivot.inl"
#include "linbox/algorithms/gauss/gauss-elim.inl"
#include "linbox/algorithms/gauss/gauss-solve.inl"
#include "linbox/algorithms/gauss/gauss-nullspace.inl"
#include "linbox/algorithms/gauss/gauss-rank.inl"
#include "linbox/algorithms/gauss/gauss-det.inl"

#endif // __LINBOX_gauss_H

// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s
// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End: