This file is indexed.

/usr/include/BALL/MATHS/numericalIntegrator.h is in libball1.4-dev 1.4.3~beta1-4.

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
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: numericalIntegrator.h,v 1.18 2004/05/27 19:49:42 oliver Exp $
//

#ifndef BALL_MATHS_NUMERICALINTEGRATOR_H
#define BALL_MATHS_NUMERICALINTEGRATOR_H

#ifndef BALL_MATHS_FUNCTION_H
# include <BALL/MATHS/function.h>
#endif

namespace BALL
{ 
	/** Numerical integrator class.
		\ingroup FunctionClasses
	*/
	template <typename Function, typename DataType = float>
	class NumericalIntegrator
	{

		public:

		BALL_CREATE(NumericalIntegrator)

		/// @name Constructors and destructor.
		//@{
		
		/// Default constructor
		NumericalIntegrator();
		
		/// Copy constructor 
		NumericalIntegrator(const NumericalIntegrator& nint);
		
		/// Destructor
		virtual ~NumericalIntegrator();

		//@}


		/// @name Assignment
		//@{

		/// Assignment operator
		NumericalIntegrator& operator = (const NumericalIntegrator& nint);

		//@}
		
		
		/// @name Predicates
		//@{

		/// Equality operator 
		bool operator == (const NumericalIntegrator& nint) const;

		//@}


		/// @name Accessors
		//@{

		/** set the function to be integrated
				@param the function to be assigned
		*/
		void setFunction(const Function& function);

		/** Get the function to be integrated (const version).
				@return a const reference to the actual function
		*/
		const Function& getFunction() const	 { return function_; }

		/** Get the function to be integrated (const version).
				@return a mutable reference to the actual function
		*/
		Function& getFunction()	 { return function_; }

		/** Get the value of the function at position <b>  x </b>
				@param x the position at which <tt>function\_</tt> is to be evaluated
				@return the value of <tt>function\_</tt> at <b>  x </b>
		*/
		DataType getValue(const DataType& x) const;

		/** Integrate the function numerically
				@param from lower limit of the integration
				@param to upper limit of the integration
				@return the value of the integral
		*/
		DataType integrate(const DataType& from, const DataType& to) const;

		//@}


		protected:

		//_ The function to be integrated
		Function function_;

	};


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator()
		: function_()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::NumericalIntegrator(const NumericalIntegrator<Function, DataType>& nint)
		: function_(nint.function_)
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>::~NumericalIntegrator()
	{
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	NumericalIntegrator<Function, DataType>&
	NumericalIntegrator<Function, DataType>::operator =
	(const NumericalIntegrator<Function, DataType>& nint)
	{
		function_ = nint.function_;
		return *this;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	void NumericalIntegrator<Function, DataType>::setFunction(const Function& function)
	{	
		function_ = function;
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	bool NumericalIntegrator<Function, DataType>::operator ==
	(const NumericalIntegrator<Function, DataType>& nint) const
	{
		return (function_ == nint.function_);
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	DataType NumericalIntegrator<Function, DataType>::getValue(const DataType& x) const
	{
		return function_(x);
	}


	template<typename Function, typename DataType>
	BALL_INLINE
	DataType NumericalIntegrator<Function, DataType>::integrate(
			const DataType& from, const DataType& to) const
	{
		// ?????
		// the number of samples has to be user configurable
		Size samples = 30;
		Size n = samples;

		DataType area = 0;
		DataType step = (to - from) / n;
		DataType x = from;

		while (n > 0)
		{
			area += (function_(x) + function_(x + step)) / 2.0 * step;
			x += step;
			--n;
		}

		return area;
	}
}

#endif // BALL_MATHS_NUMERICALINTEGRATOR_H