This file is indexed.

/usr/include/fflas-ffpack/fflas/fflas_bounds.inl is in fflas-ffpack-common 2.2.2-5.

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
/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
// vim:sts=4:sw=4:ts=4:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
/* fflas/fflas_bounds.inl
 * Copyright (C) 2008 Clement Pernet
 *
 * Written by Clement Pernet <Clement.Pernet@imag.fr>
 *            Brice Boyer (briceboyer) <boyer.brice@gmail.com>
 *
 *
 * ========LICENCE========
 * This file is part of the library FFLAS-FFPACK.
 *
 * FFLAS-FFPACK 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 __FFLASFFPACK_fflas_bounds_INL
#define __FFLASFFPACK_fflas_bounds_INL

#define FFLAS_INT_TYPE uint64_t

#include "fflas-ffpack/fflas-ffpack-config.h"
#include "fflas-ffpack/utils/flimits.h"

#include <givaro/udl.h>
#include <givaro/modular.h>
#include <givaro/modular-balanced.h>

namespace FFLAS { namespace Protected {

	template <class Field>
	inline double computeFactorClassic (const Field& F)
	{
		//FFLAS_INT_TYPE p=0;
		Givaro::Integer p=0;
		F.characteristic(p);
		return (double) (p-1);
	}

	/*************************************************************************************
	 * Specializations for ModularPositive and ModularBalanced over double and float
	 *************************************************************************************/
	template <>
	inline double computeFactorClassic (const Givaro::ModularBalanced<double>& F)
	{
		//FFLAS_INT_TYPE p;
		Givaro::Integer p;
		F.characteristic(p);
		return double((p-1) >> 1);
	}

	//BB: ajout, pourquoi pas ?
	template <>
	inline double computeFactorClassic (const Givaro::ModularBalanced<float>& F)
	{
		//FFLAS_INT_TYPE p;
		Givaro::Integer p;
		F.characteristic(p);
		return double((p-1) >> 1);
	}

	template <class Field>
	inline size_t DotProdBoundClassic (const Field& F,
					   const typename Field::Element& beta
					  )
	{

		//FFLAS_INT_TYPE p=0;
		Givaro::Integer p=0;
		F.characteristic(p);

		    //unsigned long mantissa = Protected::Mantissa<typename Field::Element>();

		if (p == 0)
			return std::numeric_limits<size_t>::max();

		double kmax;
		{

			double c = computeFactorClassic(F);
			
			double cplt=0;
			if (!F.isZero (beta)){
				if (F.isOne (beta) || F.areEqual (beta, F.mOne)) cplt = c;
				else{
					double be;
					F.convert(be, beta);
					cplt = fabs(be)*c;
				}
			}
			kmax = floor ( (double (double(limits<typename Field::Element>::max()) + 1 - cplt)) / (c*c));
			if (kmax  <= 1) return 1;
		}
			
		//kmax--; // we computed a strict upper bound
		return  (size_t) std::min ((uint64_t)kmax, 1_ui64 << 31);
	}
		
} // FFLAS
} // Protected

namespace FFLAS {

	inline Givaro::Integer
	InfNorm (const size_t M, const size_t N, const Givaro::Integer* A, const size_t lda){
		Givaro::Integer max = 0;
		size_t log=0;
		for (size_t i=0; i<M; ++i)
			for (size_t j=0; j<N; ++j){
				Givaro::Integer x = A[i*lda+j];
				if ((x.bitsize() >= log) && (abs(x) > max)){
					max = abs(x);
// 					max = x;
					log = x.bitsize();
				}
			}
		return max;
	}

	namespace Protected {


	/**
	 * TRSMBound
	 *
	 * \brief  computes the maximal size for delaying the modular reduction
	 *         in a triangular system resolution
	 *
	 * This is the default version over an arbitrary field.
	 * It is currently never used (the recursive algorithm is run until n=1 in this case)
	 *
	 * \param F Finite Field/Ring of the computation
	 *
	 */
	template <class Field>
	inline size_t TRSMBound (const Field&)
	{
		return 1;
	}

	// /**
	//  * Specialization for positive modular representation over double
	//  * Computes nmax s.t. (p-1)/2*(p^{nmax-1} + (p-2)^{nmax-1}) < 2^53
	//  * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
	//  */
	// template<>
	// inline size_t TRSMBound (const Givaro::Modular<double>& F)
	// {

	// 	FFLAS_INT_TYPE pi;
	// 	F.characteristic(pi);
	// 	unsigned long p = pi;
	// 	unsigned long long p1(1), p2(1);
	// 	size_t nmax = 0;
	// 	unsigned long long max = ( (1 << (DBL_MANT_DIG + 1) ) / ((unsigned long long)(p - 1)));
	// 	while ( (p1 + p2) < max ){
	// 		p1*=p;
	// 		p2*=p-2;
	// 		nmax++;
	// 	}
	// 	return nmax;
	// }


	/**
	 * Specialization for positive modular representation over float.
	 * Computes nmax s.t. (p-1)/2*(p^{nmax-1} + (p-2)^{nmax-1}) < 2^24
	 * @pbi
	 * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
	 */
	template<class Element>
	inline size_t TRSMBound (const Givaro::Modular<Element>& F)
	{

		FFLAS_INT_TYPE pi;
		F.characteristic(pi);
		double p = pi;
		double p1 = 1.0, p2 = 1.0;
		double pm1 = (p - 1) / 2;
		size_t nmax = 0;
		unsigned long long max = limits<Element>::max();
		while ( (p1 + p2)*pm1 <= max ){
			p1*=p;
			p2*=p-2;
			nmax++;
		}
		return std::max((size_t)1,nmax);
	}

	/**
	 * Specialization for balanced modular representation over double.
	 * Computes nmax s.t. (p-1)/2*(((p+1)/2)^{nmax-1}) < 2^53
	 * @bib
	 * - Dumas Giorgi Pernet 06, arXiv:cs/0601133
	 */
	template<class Element>
	inline size_t TRSMBound (const Givaro::ModularBalanced<Element>& F)
	{

		FFLAS_INT_TYPE pi;
		F.characteristic (pi);
		double pp1 = (pi + 1) / 2;
		double pm1 = (pi - 1) / 2;
		double p1 = 1.0;
		size_t nmax = 0;
		double max = limits<Element>::max();
		while (pm1*p1 <= max){
			p1 *= pp1;
			nmax++;
		}
		return std::max((size_t) 1,nmax);
	}

	// /**
	//  * Specialization for balanced modular representation over float
	//  * Computes nmax s.t. (p-1)/2*(((p+1)/2)^{nmax-1}) < 2^24
	//  * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
	//  */
	// template<>
	// inline size_t TRSMBound (const Givaro::ModularBalanced<float>& F)
	// {

	// 	FFLAS_INT_TYPE pi;
	// 	F.characteristic (pi);
	// 	unsigned long p = (pi + 1) / 2;
	// 	unsigned long long p1(1);
	// 	size_t nmax = 0;
	// 	unsigned long long max = (1 << (FLT_MANT_DIG + 1)) ;
	// 	while ((pi-1)*p1 < max){
	// 		p1 *= p;
	// 		nmax++;
	// 	}
	// 	return nmax;

	// }
} // Protected
} // FFLAS

#endif // __FFLASFFPACK_fflas_bounds_INL