This file is indexed.

/usr/include/linbox/vector/vector-domain-gf2.inl is in liblinbox-dev 1.3.2-1.1build2.

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
405
406
407
/* linbox/vector/vector-domain.inl
 * Copyright (C) 2001-2002 Bradford Hovinen
 *
 * Written by Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * ------------------------------------
 * 2002-07-24 Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * Added support for the new SparseParallel vector type; this involves quite a
 * few new specializations.
 *
 * ------------------------------------
 * Modified by Dmitriy Morozov <linbox@foxcub.org>
 *
 * Added the modifications for categories and vector traits that were designed
 * at the Rootbeer meeting. Added parametrization of VectorTags by VectorTraits.
 *
 * ------------------------------------
 * 2002-06-04 Bradford Hovinen <hovinen@cis.udel.edu>
 *
 * Updated function definitions according to the new policy set in
 * vector-domain.h  This means the functions each take a parameter tag (or, for
 * dot product, tag1 and tag2) that allows specialization by vector type.
 * ------------------------------------
 *
 * 
 * ========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========
 *.
 */

#ifndef __LINBOX_field_vector_domain_gf2_INL
#define __LINBOX_field_vector_domain_gf2_INL


#include <iostream>
#include <cctype>

namespace LinBox
{ /*  VectorDomain */
	template <class Vector>
	std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
							   VectorCategories::DenseZeroOneVectorTag) const
	{


		// TO BE REMOVED
		os << "writeSpec DenseZO, of size " << x.size() << ' ';

		os << "[ ";

		for (typename Vector::const_iterator i = x.begin (); i != x.end (); ++i)
			os << *i << ' ';

		os << ']';

		os << "( ";

		for (typename Vector::const_word_iterator i = x.wordBegin (); i != x.wordEnd (); ++i)
			os << *i << ' ';

		os << ')';

		return os;
	}

	template <class Vector>
	std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
							   VectorCategories::SparseZeroOneVectorTag) const
	{
		typename Vector::const_iterator i;
		size_t idx = 0;

		// TO BE REMOVED
		os << "writeSpec SparseZO, of size " << x.size() << ' ';
		os << "[ ";

		for (i = x.begin (); i != x.end (); ++i) {
			while (++idx <= *i)
				os << 0 << ' ';

			os << 1 << ' ';
		}
		os << ']';

		return os;
	}

	template <class Vector>
	std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
							  VectorCategories::DenseZeroOneVectorTag) const
	{
		typename Vector::iterator i;
		char c;

		do { is >> c ; } while (!std::isdigit (c));

		is.unget ();

		for (i = x.begin (); i != x.end (); ++i)
			is >> *i;

		return is;
	}

	template <class Vector>
	std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
							  VectorCategories::SparseZeroOneVectorTag) const
	{
		char c;
		size_t idx;

		do { is >> c ; } while (!std::isdigit (c));

		is.unget ();
		x.clear ();

		while (1) {
			is >> c;

			if (!std::isdigit (c) && c != ' ') break;
			is.unget ();
			is >> idx;
			x.push_back (idx);
		}

		return is;
	}

	template <class Vector1, class Vector2>
	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
						     VectorCategories::DenseZeroOneVectorTag,
						     VectorCategories::SparseZeroOneVectorTag) const
	{
		typename Vector1::const_iterator i = v1.begin ();
		typename Vector2::const_iterator j = v2.begin ();
		size_t idx = 0;

		for (; j != v2.end (); ++j, ++i, ++idx) {
			while (idx < *j) {
				if (*i) return false;
				++idx;
				++i;
			}

			if (!*i) return false;
		}

		for (; i != v1.end (); ++i)
			if (*i) return false;

		return true;
	}

	template <class Vector1, class Vector2>
	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
						     VectorCategories::DenseZeroOneVectorTag,
						     VectorCategories::DenseZeroOneVectorTag) const
	{
		typename Vector1::const_word_iterator i = v1.wordBegin ();
		typename Vector2::const_word_iterator j = v2.wordBegin ();
		for (; j != v2.wordEnd (); ++j, ++i)
			if (*i != *j) return false;
		return true;
	}

	template <class Vector1, class Vector2>
	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
						     VectorCategories::SparseZeroOneVectorTag,
						     VectorCategories::SparseZeroOneVectorTag) const
	{
		return v1 == v2;
	}

	template <class Vector>
	bool VectorDomain<GF2>::isZeroSpecialized (const Vector &v,
						   VectorCategories::DenseZeroOneVectorTag) const
	{
		typename Vector::const_word_iterator i;

		for (i = v.wordBegin (); i != v.wordEnd (); ++i)
			if (*i) return false;

		return true;
	}

	template <class Vector1, class Vector2>
	Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
						     VectorCategories::SparseZeroOneVectorTag,
						     VectorCategories::DenseZeroOneVectorTag) const
	{
		typename Vector2::const_iterator i;
		size_t idx = 0;

		res.clear ();

		for (i = v.begin (); i != v.end (); ++i, ++idx)
			if (*i) res.push_back (idx);

		return res;
	}

	template <class Vector1, class Vector2>
	Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
						     VectorCategories::DenseZeroOneVectorTag,
						     VectorCategories::SparseZeroOneVectorTag) const
	{
		size_t sparsesize = *(v.rbegin());
		if (sparsesize > res.size()) res.resize( *(v.rbegin()) );
		std::fill (res.wordBegin (), res.wordEnd (), 0);

		for (typename Vector2::const_iterator i = v.begin ();
		     i != v.end ();
		     ++i)
			res[*i] = true;
		return res;
	}

	template <class Vector1, class Vector2>
	bool &VectorDomain<GF2>::dotSpecialized (bool &res, const Vector1 &v1, const Vector2 &v2,
						 VectorCategories::SparseZeroOneVectorTag,
						 VectorCategories::SparseZeroOneVectorTag) const
	{
		typename Vector1::const_iterator i = v1.begin ();
		typename Vector2::const_iterator j = v2.begin ();
		res = false;

		while (i != v1.end () || j != v2.end ()) {
			while (i != v1.end () && (j == v2.end () || *i < *j)) { res = !res; ++i; }
			while (j != v2.end () && (i == v1.end () || *j < *i)) { res = !res; ++j; }
			if (i != v1.end () && j != v2.end () && *i == *j) { ++i; ++j; }
		}

		return res;
	}

	template <class Vector1, class Vector2, class Vector3>
	Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
						    VectorCategories::DenseZeroOneVectorTag,
						    VectorCategories::DenseZeroOneVectorTag,
						    VectorCategories::DenseZeroOneVectorTag) const
	{
		linbox_check (res.size () == y.size ());
		linbox_check (res.size () == x.size ());

		typename Vector1::word_iterator i = res.wordBegin ();
		typename Vector2::const_word_iterator j = y.wordBegin ();
		typename Vector3::const_word_iterator k = x.wordBegin ();

		for (; i != res.wordEnd (); ++i)
			*i = *j++ ^ *k++;

		return res;
	}

	template <class Vector1, class Vector2, class Vector3>
	Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
						    VectorCategories::SparseZeroOneVectorTag,
						    VectorCategories::SparseZeroOneVectorTag,
						    VectorCategories::SparseZeroOneVectorTag) const
	{
		typename Vector2::const_iterator i = y.begin ();
		typename Vector3::const_iterator j = x.begin ();

		res.clear ();

		while (i != y.end () || j != x.end ()) {
			while (i != y.end () && (j == x.end () || *i < *j)) { res.push_back (*i); ++i; }
			while (j != x.end () && (i == y.end () || *j < *i)) { res.push_back (*j); ++j; }
			if (i != y.end () && j != x.end () && *i == *j) { ++i; ++j; }
		}

		return res;
	}

	template <class Vector1, class Vector2>
	Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
						      VectorCategories::DenseZeroOneVectorTag,
						      VectorCategories::DenseZeroOneVectorTag) const
	{
		linbox_check (y.size () == x.size ());

		typename Vector1::word_iterator i = y.wordBegin ();
		typename Vector2::const_word_iterator j = x.wordBegin ();

		for (; i != y.wordEnd (); ++i, ++j)
			*i ^= *j;

		return y;
	}

	template <class Vector1, class Vector2>
	Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
						      VectorCategories::DenseZeroOneVectorTag,
						      VectorCategories::SparseZeroOneVectorTag) const
	{
		typename Vector2::const_iterator i;

		for (i = x.begin (); i != x.end (); ++i)
			y[*i] = !y[*i];

		return y;
	}

}

namespace LinBox
{ /*  Dot product */
	// template<>
	template <class Vector1, class Vector2>
	inline bool &DotProductDomain<GF2>::dotSpecializedDD
	(bool          &res,
	 const Vector1 &v1,
	 const Vector2 &v2) const
	{
		linbox_check (v1.size () == v2.size ());

		unsigned long t = 0;
		typename Vector1::const_word_iterator i = v1.wordBegin ();
		typename Vector2::const_word_iterator j = v2.wordBegin ();

		while (i != v1.wordEnd () - 1)
			t ^= *i++ & *j++;

		const size_t zeroing = __LINBOX_BITSOF_LONG - (v1.size() % __LINBOX_BITSOF_LONG);
		unsigned long lastdot = *i & *j;
		lastdot <<= zeroing;
		lastdot >>= zeroing;

		t ^= lastdot;
		return res = __LINBOX_PARITY(t);
	}

	// template<>
	template <class Vector1, class Vector2>
	inline bool &DotProductDomain<GF2>::dotSpecializedDSP
	(bool          &res,
	 const Vector1 &v1,
	 const Vector2 &v2) const
	{
		typename Vector2::const_iterator i;

		res = 0;

		for (i = v2.begin (); i != v2.end (); ++i)
			res ^= v1[*i];

		return res;
	}

	// template<>
	template <class Vector1, class Vector2>
	inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDD
	(BitVector::reference res,
	 const Vector1 &v1,
	 const Vector2 &v2) const
	{
		bool tmp;
		return res = dotSpecializedDD(tmp, v1, v2);
	}

	// template<>
	template <class Vector1, class Vector2>
	inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDSP
	(BitVector::reference res,
	 const Vector1 &v1,
	 const Vector2 &v2) const
	{
		typename Vector2::const_iterator i;

		res = 0;

		for (i = v2.begin (); i != v2.end (); ++i)
			res ^= v1[*i];

		return res;
	}

}


#endif // __LINBOX_field_vector_domain_INL



// 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: