This file is indexed.

/usr/include/linbox/algorithms/bbsolve.h is in liblinbox-dev 1.1.6~rc0-4.1.

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
/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */

/* linbox/algorithms/bbsolve.h
 * (was linbox/sollutions/solve.h)
 *  by Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * See COPYING for license information.
 */

#ifndef __BBSOLVE_H
#define __BBSOLVE_H

#include <vector>
#include <algorithm>

// must fix this list...
#include "linbox/algorithms/wiedemann.h"
#include "linbox/algorithms/lanczos.h"
#include "linbox/algorithms/mg-block-lanczos.h"
#include "linbox/blackbox/dense.h"
#include "linbox/util/debug.h"
#include "linbox/vector/vector-domain.h"
#include "linbox/solutions/methods.h"

namespace LinBox 
{

//	/** @name Solvers
//	 * @brief Solving linear system Ax = b over the field F.
//	 */
//	//@{

	/*
	// for specialization on method.
	template <class Field, class Vector, class Blackbox, class MyMethod>
	Vector& solve (const Blackbox&A,
	Vector                          &x,		       
	const Vector                    &b,
	const Field                     &F,
	const MyMethod & m );
	*/

	/** Solve Ax=b over field F using Wiedemann's method, with inconsistency certificate.
	 * 
	 * This is a general interface for the linear system solving
	 * capabilities of LinBox. If the system is nonsingular, it returns
	 * the unique solution, storing it in the vector x. If the system is
	 * consistent and singular, it returns a random solution. Repeated
	 * calls to this function can give a complete description of the
	 * solution manifold. If the system is inconsistent and the
	 * \Ref{SolverTraits} structure supplied requests certification of
	 * inconsistency, it fills in the certificate of
	 * inconsistency. Otherwise, it runs through the number of iterations
	 * specified in @code{traits} and throws a \Ref{SolveFailed} exception
	 * if it cannot find a solution.
	 *
	 * This specialization uses Wiedemann's algorithm and is the default.
	 *
	 * @param A Black box matrix of the system
	 * @param x Place to store solution vector
	 * @param b Right-hand side
	 * @param u Vector in which to store certificate of inconsistency, if required
	 * @param F Field over which to perform computations
	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
	 * @return Reference to solution vector
	 */

	template <class Field, class Vector, class Blackbox>
	typename WiedemannSolver<Field>::ReturnStatus 
	solve (const Blackbox                  &A,
	       Vector                          &x,		       
	       const Vector                    &b,
	       Vector                          &u,
	       const Field                     &F,
	       const WiedemannTraits &traits = WiedemannTraits ())
	{
		WiedemannSolver<Field> solver (F, traits);
		return solver.solve (A, x, b, u);
	}

	/** Solve Ax=b over field F using the Wiedemann method.
	 *
	 * This version differs from the one above in that there is no extra
	 * parameter for the certificate of inconsistency, and it throws
	 * exceptions if the solution fails. It also returns a reference to
	 * the solution vector.
	 */

	template <class Field, class Vector, class Blackbox>
	Vector &solve (const Blackbox                  &A,
		       Vector                          &x,		       
		       const Vector                    &b,
		       const Field                     &F,
		       const WiedemannTraits &traits = WiedemannTraits ())
	{
		Vector u;
		WiedemannSolver<Field> solver (F, traits);

		VectorWrapper::ensureDim (u, A.rowdim ());

		switch (solver.solve (A, x, b, u)) {
		case WiedemannSolver<Field>::OK:
			return x;

		case WiedemannSolver<Field>::FAILED:
			throw SolveFailed ();

		case WiedemannSolver<Field>::SINGULAR:
			throw SolveFailed ();

		case WiedemannSolver<Field>::INCONSISTENT:
			throw InconsistentSystem<Vector> (u);

		default:
			throw LinboxError ("Bad return value from solve");
		}
	}

	/** Solve Ax=b over field F using the Lanczos method.
	 * 
	 * This is a general interface for the linear system solving capabilities of
	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
	 * it in the vector x. If the system is consistent and singular, it returns a
	 * random solution. Repeated calls to this function can give a complete
	 * description of the solution manifold. If the system is inconsistent and the
	 * \Ref{SolverTraits} structure has result checking turned on, it runs through
	 * the number of iterations specified in @code{traits} and throws a
	 * \Ref{SolveFailed} exception if it cannot find a solution.
	 *
	 * This specialization uses the Lanczos algorithm.
	 *
	 * @param A Black box matrix of the system
	 * @param x Place to store solution vector
	 * @param b Right-hand side
	 * @param F Field over which to perform computations
	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
	 * @return Reference to solution vector
	 */

	template <class Field, class Vector, class Blackbox>
	Vector &solve (const Blackbox                  &A,
		       Vector                          &x,		       
		       const Vector                    &b,
		       const Field                     &F,
		       const LanczosTraits        &traits)
	{
		LanczosSolver<Field, Vector> solver (F, traits);
		return solver.solve (A, x, b);
	}

	/** Solve Ax=b over field F using the block Lanczos method.
	 * 
	 * This is a general interface for the linear system solving capabilities of
	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
	 * it in the vector x. If the system is consistent and singular, it returns a
	 * random solution. Repeated calls to this function can give a complete
	 * description of the solution manifold. If the system is inconsistent and the
	 * \Ref{SolverTraits} structure has result checking turned on, it runs through
	 * the number of iterations specified in @code{traits} and throws a
	 * \Ref{SolveFailed} exception if it cannot find a solution.
	 *
	 * This specialization uses the block Lanczos algorithm.
	 *
	 * @param A Black box matrix of the system
	 * @param x Place to store solution vector
	 * @param b Right-hand side
	 * @param F Field over which to perform computations
	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
	 * @return Reference to solution vector
	 */

	template <class Field, class Vector, class Blackbox>
	Vector &solve (const Blackbox                &A,
		       Vector                        &x,		       
		       const Vector                  &b,
		       const Field                   &F,
		       const BlockLanczosTraits &traits)
	{
		MGBlockLanczosSolver<Field> solver (F, traits);
		solver.solve (A, x, b);
		return x;
	}

	/** Solve Ax=b over field F using Gaussian elimination.
	 * 
	 * This is a general interface for the linear system solving capabilities of
	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
	 * it in the vector x. If the system is consistent and singular, it returns a
	 * random solution. Repeated calls to this function can give a complete
	 * description of the solution manifold. If the system is inconsistent and the
	 * \Ref{SolverTraits} structure supplied requests certification of
	 * inconsistency, it throws an \Ref{InconsistentSystem} exception, which
	 * includes a certificate of inconsistency. Otherwise, it runs through the
	 * number of iterations specified in @code{traits} and throws a
	 * \Ref{SolveFailed} exception if it cannot find a solution.
	 *
	 * @param A Black box matrix of the system
	 * @param x Place to store solution vector
	 * @param b Right-hand side
	 * @param F Field over which to perform computations
	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
	 * @return Reference to solution vector
	 */

	template <class Field, class Matrix, class Vector>
	Vector &solve (const Matrix                     &A,
		       Vector                           &x,		       
		       const Vector                     &b,
		       const Field                      &F,
		       const BlasEliminationTraits &traits)
	{
		// N.B. This is a place holder; I am intending to fix this very shortly
		throw LinboxError ("Elimination-based solver not implemented");
		return x;
	}

	/** Enumeration for results of next solver.
	 *
	 * SOLVE_SUCCESSFUL - System solution was succesful, @code{x} holds the solution
	 * vector 
	 * SOLVE_INCONSISTENT - System was inconsistent, @code{u} holds the certificate
	 * of inconsistency and @code{x} is untouched
	 * SOLVE_FAILED - Neither a system solution nor a certificate of inconsistency
	 * could be obtained before the maximum number of trials elapsed. Both @code{x}
	 * and @code{u} are untouched.
	 */

	enum SolveResult {
		SOLVE_SUCCESSFUL, SOLVE_INCONSISTENT, SOLVE_FAILED
	};

	/** Solve Ax=b over field F, returning consistency indicator
	 *
	 * This is a variant of @code{solve} that does not throw any exceptions unless
	 * the user makes an error. It returns a \Ref{SolveResult} enum indicating
	 * whether the solve operation was successful, the system was inconsistent, or
	 * the solve operation failed. The certificate of inconsistency, if requested,
	 * is stored in a reference parameter supplied to this variant.
	 *
	 * @param A Black box matrix of the system
	 * @param x Place to store solution vector
	 * @param b Right-hand side
	 * @param u Place to store certificate of inconsistency
	 * @param F Field over which to perform computations
	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
	 * @return \Ref{SolveResult} indicating whether the solve operation was
	 * successful
	 */

	template <class Field, class Blackbox, class Vector, class MethodTraits>
	SolveResult solve (const Blackbox     &A,
			   Vector             &x,		       
			   const Vector       &b,
			   const Field        &F,
			   Vector             &u,
			   const MethodTraits &traits = MethodTraits ())
	{
		try {
			solve (A, x, b, F, traits);
		}
		catch (SolveFailed) {
			return SOLVE_FAILED;
		}
		catch (InconsistentSystem<Vector> e) {
			VectorDomain<Field> VD (F);
			F.copy (u, e.certificate ());
			return SOLVE_INCONSISTENT;
		}

		return SOLVE_SUCCESSFUL;
	}
//	//@}

}

#endif // __BBSOLVE_H