This file is indexed.

/usr/include/linbox/algorithms/rational-cra-early-single.h is in liblinbox-dev 1.4.2-5build1.

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
/* Copyright (C) 2007 LinBox
 * Written by <Jean-Guillaume.Dumas@imag.fr>
 *
 *
 *
 * ========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_rational_early_single_cra_H
#define __LINBOX_rational_early_single_cra_H

#include "givaro/zring.h"
#include "linbox/algorithms/cra-early-single.h"

namespace LinBox
{

	template<class Domain_Type>
	struct EarlySingleRatCRA : public EarlySingleCRA<Domain_Type> {
		typedef Domain_Type				Domain;
		typedef EarlySingleCRA<Domain> 			Father_t;
		typedef typename Father_t::DomainElement 	DomainElement;
		typedef EarlySingleRatCRA<Domain>		Self_t;
		Givaro::ZRing<Integer> _ZZ;

		Integer					Numer0;
		Integer					Denom0;

	public:

		EarlySingleRatCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) :
			Father_t(EARLY)
		{}

		void progress (const Domain& D, const DomainElement& e)
		{
			DomainElement u0, m0;

			fieldreconstruct(this->residue_, D, e, D.init(u0,this->residue_), D.init(m0,this->primeProd_), Integer(this->residue_), this->primeProd_);
			D.characteristic( this->nextM_ );
			this->primeProd_ *= this->nextM_;
			Integer a, b;
			_ZZ.reconstructRational(a, b, this->residue_, this->primeProd_);
			if ((a == Numer0) && (b == Denom0))
				++this->occurency_;
			else {
				this->occurency_ = 1;
				Numer0 = a;
				Denom0 = b;
			}
		}

		void progress (const Integer & D, const Integer & e)
		{
			Integer u0 = this->residue_   %D;
			Integer	m0 = this->primeProd_ %D;

			fieldreconstruct(this->residue_, D, e, u0, m0, Integer(this->residue_), this->primeProd_);
			this->primeProd_ *= this->nextM_;
			Integer a, b;
			_ZZ.reconstructRational(a, b, this->residue_, this->primeProd_);
			if ((a == Numer0) && (b == Denom0))
				++this->occurency_;
			else {
				this->occurency_ = 1;
				Numer0 = a;
				Denom0 = b;
			}
		}


		void initialize (const Domain& D, const DomainElement& e)
		{
			Father_t::initialize(D, e);
			_ZZ.reconstructRational(Numer0, Denom0, this->residue_, this->primeProd_);
		}

		void initialize (const Integer& D, const Integer& e)
	       	{
			Father_t::initialize(D, e);
			_ZZ.reconstructRational(Numer0, Denom0, this->residue_, this->primeProd_);
		}

		Integer& result(Integer& Num, Integer& Den)
		{
			Den = Denom0;
			return Num=Numer0;
		}

		Integer& result(Integer& d)
		{
			throw "not a good idea calling this function here !!" ;
		}
	protected:

		Integer& fieldreconstruct(Integer& res, const Domain& D1,
					  const DomainElement& u1, DomainElement& u0,
					  DomainElement& m0, const Integer& r0,
					  const Integer& P0)
		{
			// u0 and m0 are modified
			D1.negin(u0);   	// u0 <-- -u0
			D1.addin(u0,u1);	// u0 <-- u1-u0
			D1.invin(m0);	// m0 <-- m0^{-1} mod m1
			D1.mulin(u0, m0);   // u0 <-- (u1-u0)( m0^{-1} mod m1 )
			D1.convert(res, u0);// res <-- (u1-u0)( m0^{-1} mod m1 )         and res <  m1
			res *= P0;      	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
			return res += r0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
		}

		Integer& fieldreconstruct(Integer& res, const Integer& D,
					  const Integer & u1, Integer & u0,
					  Integer & m0, const Integer& r0,
					  const Integer& P0)
		{
			// u0 and m0 are modified
			inv(m0,m0,D);           // m0 <-- m0^{-1} mod m1
			u0 = (u1-u0) ;
			u0 *= m0 ;
			u0 %= D  ;              // u0 <-- (u1-u0)( m0^{-1} mod m1 )
			res = u0*P0 ;        	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
			return res += r0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
		}
	};
}

#endif // __LINBOX_rational_early_single_cra_H


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