This file is indexed.

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

/* linbox/field/unparametric.h
 * Copyright (C) 1999-2005 William J Turner,
 *               2001 Bradford Hovinen
 *
 * Written by W. J. Turner <wjturner@acm.org>,
 *            Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * This library 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 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., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
 
#ifndef __FIELD_UNPARAMETRIC_H
#define __FIELD_UNPARAMETRIC_H

#include <string>
#include <algorithm>

#include "linbox/integer.h"
#include <linbox/field/field-interface.h>
#include "linbox/randiter/unparametric.h"
#include "linbox/linbox-config.h"
#include <linbox/field/field-traits.h>

namespace LinBox 
{
	/** \brief Unparameterized field adapter.
	\ingroup field

	A field having an interface similar to that of floats is adapted to LinBox.

	Used to generate efficient field classes for unparameterized fields (or hidden parameter fields).
	 
	Some fields are implemented by definition of the C++ arithmetic operators, such as z = x*y, 
	for z, y, z instances of a type K.   The LinBox field 
	Unparametric<K> is the adaptation to LinBox.

	For a typical unparametric field, some of the methods must be defined in a specialization. 

	*/

	template <class Ring>
	struct ClassifyRing;

	template <class K>
	class UnparametricField;

	template <class K>
	struct ClassifyRing<UnparametricField<K> > { 
		typedef RingCategories::GenericTag categoryTag;
	};

	template <class K>
	class UnparametricField : public FieldInterface
	{
	    protected: integer _p; integer _card;
	    public:
    
		/** @name Common Object Interface for a LinBox Field.
		 * These methods and member types are required of all LinBox fields.
		 * See \ref{FieldArchetype} for detailed specifications.
		 */
		//@{
    
		/** The field's element type.
		 * Type K must provide a default constructor, 
		 * a copy constructor, a destructor, and an assignment operator.
		 */

		typedef K Element;    

		/// Type of random field element generators.
		typedef UnparametricRandIter<K> RandIter;

		/** @name Field Object Basics.
		 */
		//@{
    
		/** Builds this field to have characteristic q and cardinality q<sup>e</sup>.
		 *  This constructor must be defined in a specialization.
		 */
		UnparametricField(integer q = 0, size_t e = 1)
		: _p(q), _card(q == 0 ? integer(-1) : pow(q, e) ) {}  // assuming q is a prime or zero.

		/// construct this field as copy of F.
		UnparametricField (const UnparametricField &F) : _p(F._p), _card(F._card){}
    
		/// 
		~UnparametricField () {}
    
		/* Assignment operator.
		 * Assigns UnparametricField object F to field.
		 * @param  F UnparametricField object.
		 */
		 // I believe this should be virtual -bds
		///
		const UnparametricField &operator=(const UnparametricField &F) const { return *this; }
		//@} Field Object Basics.
    
		/** @name Data Object Management.
		 * first argument is set and the value is also returned.
		 */
	        //@{

		/// x := y.  Caution: it is via cast to long.  Good candidate for specialization.
		Element &init (Element &x, const integer &y=0) const 
			{ return x = static_cast<const Element&> (static_cast<const long&> (y)); }

    
		/// x :=  y.  Caution: it is via cast to long.  Good candidate for specialization.
		integer &convert (integer &x, const Element &y) const 
		{ 
			Element temp (y);
			//Dan Roche changed this from long to integer.
			return x = static_cast<integer> (temp); 
		}
    
		/// x :=  y.  Caution: it is via cast to long.  Good candidate for specialization. --dpritcha
		double &convert (double &x, const Element &y) const 
		{ 
			Element temp (y);
			return x = static_cast<double> (temp); 
		}
    
		///
		Element &assign (Element &x, const Element &y) const { return x = y; }
    
		/// c := cardinality of this field (-1 if infinite).
		integer &cardinality (integer &c) const { return c = _card; }
    
		/// c := characteristic of this field (zero or prime).
		integer &characteristic (integer &c) const { return c = _p; }
    
		//@} Data Object Management
    
		/// @name Comparison Predicates
		//@{
		///  x == y
		bool areEqual (const Element &x, const Element &y) const { return x == y; }
    
		///  x == 0
		bool isZero (const Element &x) const { return x == Element (0); }
    
		///  x == 1
		bool isOne (const Element &x) const { return x == Element (1); }
		//@} Comparison Predicates
    
		 
		/** @name Arithmetic Operations 
		 * The first argument is set and is also the return value.
		 */
		//@{
    
		/// x := y + z
		Element &add (Element &x, const Element &y, const Element &z) const
			{ return x = y + z; }
    
		/// x := y - z
		Element &sub (Element &x, const Element &y, const Element &z) const
			{ return x = y - z; }
    
		/// x := y*z
		Element &mul (Element &x, const Element &y, const Element &z) const
			{ return x = y * z; }
    
		/// x := y/z
		Element &div (Element &x, const Element &y, const Element &z) const
			{ return x = y / z; }
    
		/// x := -y
		Element &neg (Element &x, const Element &y) const { return x = - y; }
    
		/// x := 1/y
		Element &inv (Element &x, const Element &y) const 
			{ return x = Element (1) / y; }
    
		/// z := a*x + y 
		// more optimal implementation, if available, can be defined in a template specialization.
		Element &axpy (Element &z, 
			       const Element &a, 
			       const Element &x, 
			       const Element &y) const
			{ return z = a * x + y; }
 
		//@} Arithmetic Operations
    
		/** @name Inplace Arithmetic Operations 
		 * The first argument is modified and the result is the return value.
		 */
		//@{
    
		/// x := x + y
		Element &addin (Element &x, const Element &y) const { return x += y; }
    
		/// x := x - y
		Element &subin (Element &x, const Element &y) const { return x -= y; }
    
		/// x := x*y
		Element &mulin (Element &x, const Element &y) const { return x *= y; }
    
		/// x := x/y
		Element &divin (Element &x, const Element &y) const { return x /= y; }
    
		/// x := -x
		Element &negin (Element &x) const { return x = - x; }
    
		/// x := 1/x
		Element &invin (Element &x) const { return x = Element (1) / x; }
    
		/// y := a*x + y
		Element &axpyin (Element &y, const Element &a, const Element &x) const
			{ return y += a * x; }
 
		//@} Inplace Arithmetic Operations

		/** @name Input/Output Operations */
		//@{
    
		/** Print field.
		 * @return output stream to which field is written.
		 * @param  os  output stream to which field is written.
		 */
		std::ostream &write (std::ostream &os) const { return os << "unparamterized field"; }
    
		/** Read field.
		 * @return input stream from which field is read.
		 * @param  is  input stream from which field is read.
		 */
		std::istream &read (std::istream &is) const { return is; }
    
		/** Print field element.
		 * @return output stream to which field element is written.
		 * @param  os  output stream to which field element is written.
		 * @param  x   field element.
		 */
		std::ostream &write (std::ostream &os, const Element &x) const { return os << x; }
    
		/** Read field element.
		 * @return input stream from which field element is read.
		 * @param  is  input stream from which field element is read.
		 * @param  x   field element.
		 */
		std::istream &read (std::istream &is, Element &x) const { return is >> x; }
    
		//@}
    
		//@} Common Object Interface
    
		/** @name Implementation-Specific Methods.
		 * These methods are not required of all LinBox fields
		 * and are included only for the implementation of this field
		 * template.
		 */
		//@{
    
		/// Default constructor
		//UnparametricField (void) {}
    
		/** Constructor from field object.
		 * @param  A unparameterized field object
		 */
		UnparametricField (const K &A) {} 
    
		/** Constant access operator.
		 * @return constant reference to field object
		 */
		const K &operator () (void) const { return Element (); }
    
		/** Access operator.
		 * @return reference to field object
		 */
		K &operator () (void) { return Element (); }
    
		//@} Implementation-Specific Methods

	}; // template <class K> class UnparametricField

	template<class Field>
	class FieldAXPY;

	template<>
	class FieldAXPY<UnparametricField<integer> >  {
	public:
		typedef UnparametricField<integer> Field;
		typedef integer Element;

		/** Constructor.
                 * A faxpy object if constructed from a Field and a field element.
                 * Copies of this objects are stored in the faxpy object.
                 * @param F field F in which arithmetic is done
                 */
                FieldAXPY (const Field &F) : _F (F) { _y = 0; }
 
                /** Copy constructor.
                 * @param faxpy
                 */
                FieldAXPY (const FieldAXPY<Field> &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
 
                /** Assignment operator
                 * @param faxpy
                 */
                FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
                        { _y = faxpy._y; return *this; }
 
                /** Add a*x to y
                 * y += a*x.
                 * @param a constant reference to element a
                 * @param x constant reference to element x
		 * allow optimal multiplication, such as integer * int
                 */
		template<class Element1>
                inline Element&  mulacc (const Element &a, const Element1 &x)
		{ 
			return _y += (a * x); 
		}
 
		template<class Element1>
                inline Element& accumulate (const Element1 &t)
		{ 
			return _y += t; 
		}
 
                /** Retrieve y
                 *
                 * Performs the delayed modding out if necessary
                 */
                inline Element &get (Element &y) { y = _y; return y; }
 
                /** Assign method.
                 * Stores new field element for arithmetic.
                 * @return reference to self
                 * @param y_init constant reference to element a
                 */
                inline FieldAXPY &assign (const Element& y)
                {
                        _y = y;
                        return *this;
                }
		
		inline void reset() {
			_y = 0;
		}
			
            private:
 
                /// Field in which arithmetic is done
                Field _F;
 
                /// Field element for arithmetic
                Element _y;

	};
	
} // namespace LinBox



#include "linbox/randiter/unparametric.h"

#endif // __FIELD_UNPARAMETRIC_H_