This file is indexed.

/usr/include/BALL/MATHS/cubicSpline2D.h is in libball1.4-dev 1.4.1+20111206-3.

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
#ifndef BALL_MATHS_CUBICSPLINE2D_H
#define BALL_MATHS_CUBICSPLINE2D_H

#include <set>
#include <map>

#ifndef BALL_MATHS_CUBICSPLINE1D_H
#	include <BALL/MATHS/cubicSpline1D.h>
#endif

#ifndef BALL_COMMON_EXCEPTION_H
#include <BALL/COMMON/exception.h>
#endif

namespace BALL 
{
	class BALL_EXPORT CubicSpline2D
	{
		public:

			static const int VERBOSITY_LEVEL_DEBUG;
			static const int VERBOSITY_LEVEL_CRITICAL;

			BALL_CREATE(CubicSpline2D)

			//@}
			/** @name	Constructors and Destructors.
			*/
			//@{

			/**	Default constructor.
			*/
			CubicSpline2D();
			

			/** Detailed constructor
				Given the increasingly sorted sample positions {\tt sample_positions_y_} in y direction, 
				increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the
				corresponding sample values {\tt sample_values}
				a 2D spline is created by storing for each y sample position the corresponding 
				1d spline in x direction. 
				By default, we assume the first and the last values to be the lower and upper bounds.
				If the {\tt return_average_} flag is set to true, the default return values are set to the
				spline average.
			 	If the {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the
				{\tt operator() } will be natural. 
			  Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as
			 	first derivatives of the first/last sample positions in x direction 
				and {\tt y_lower_derivative} and {\tt y_upper_derivative} are taken as the first derivatives
				of the first/last derivative in y direction. By default, the derivatives are set to zero.
			*/ 
			CubicSpline2D(const std::vector<std::vector<float> >& sample_positions_x,
										const std::vector<float>& sample_positions_y,
										const std::vector<std::vector<float> >& sample_values, 
										bool 	return_average = false,
										bool 	is_natural = true,  	
										const std::vector<float>& x_lower_derivatives = std::vector<float>(),  
										const std::vector<float>& x_upper_derivatives = std::vector<float>(),
										float y_lower_derivative = 0., 
										float y_upper_derivative = 0.,
										int verbosity = VERBOSITY_LEVEL_DEBUG);
		
		

		/** Detailed constructor
				Given the increasingly sorted sample positions {\tt sample_positions_y_} in y direction, 
				increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the
				corresponding sample values {\tt sample_values}
				a 2D spline is created by storing for each y sample position the corresponding 
				1d spline in x direction. 				
				The {\tt return_average} flag is set to false and the default values {\tt x_default_values_} 
				and {\tt y_default_value_} is set to the given values.
				The lower and upper bounds in x and y direction are set to the given values.
			 	If the {\tt is_natural} flag is set to true, all  1D splines and the 1D spline in y direction used in the
				{\tt operator() } will be natural. 
			  Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as
			 	first derivatives of the first/last sample positions in x direction 
				and {\tt y_lower_derivative} and {\tt y_upper_derivative} are taken as the first derivatives
				of the first/last derivative in y direction. By default, the derivatives are set to zero.
			*/  
			CubicSpline2D(const std::vector<std::vector<float> >& sample_positions_x,
										const std::vector<float>& sample_positions_y,
										const std::vector<std::vector<float> >& sample_values, 
										const std::vector<float>& x_default_values, 
										float y_default_value, 
										const std::vector<float>& x_lower_bounds,
										const std::vector<float>& x_upper_bounds,
										float y_lower_bound,
										float y_upper_bound,
										bool 	is_natural = true, 	
										const std::vector<float>& x_lower_derivatives = std::vector<float>(), 
										const std::vector<float>& x_upper_derivatives = std::vector<float>(),
										float y_lower_derivative = 0.0,
										float y_upper_derivative = 0.0,
										int verbosity = VERBOSITY_LEVEL_DEBUG);
			
//-------------------------- Constructors with equal x sample positions for all y ------------------------
     //Assumes that all rows have the same x-positions.


/** Detailed constructor
				Given the increasingly sorted sample positions {\tt sample_positions_y_} in y direction, 
				increasingly sorted sample positions {\tt sample_positions_x_} in x direction (same for all splines in x direction! )
				and the corresponding sample values {\tt sample_values}
				a 2D spline is created by storing for each y sample position the corresponding 
				1d spline in x direction. 
				By default, we assume the first and the last values to be the lower and upper bounds.
				If the {\tt return_average_} flag is set to true, the default return values are set to the
				spline average.
			 	If the {\tt is_natural} flag is set to true, all 1D splines and the 1D spline in y direction used in the
				{\tt operator() } will be natural. 
			  Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as
			 	first derivatives of the first/last sample positions in x direction 
				and {\tt y_lower_derivative} and {\tt y_upper_derivative} are taken as the first derivatives
				of the first/last derivative in y direction. By default, the derivatives are set to zero.
			*/ 
			CubicSpline2D(const std::vector<float>& sample_positions_x,
										const std::vector<float>& sample_positions_y,
										const std::vector<std::vector<float> >& sample_values, 
										bool 	return_average = false,
										bool 	is_natural = true,  	
										const std::vector<float>& x_lower_derivatives = std::vector<float>(),  
										const std::vector<float>& x_upper_derivatives = std::vector<float>(),
										float y_lower_derivative = 0., 
										float y_upper_derivative = 0.,
										int verbosity = VERBOSITY_LEVEL_DEBUG);
		
		/** Detailed constructor
				Given the increasingly sorted sample positions {\tt sample_positions_y_} in y direction, 
				increasingly sorted sample positions {\tt sample_positions_x_} in x direction and the
				corresponding sample values {\tt sample_values}
				a 2D spline is created by storing for each y sample position the corresponding 
				1d spline in x direction. 				
				The {\tt return_average} flag is set to false and the default values {\tt x_default_values_} 
				and {\tt y_default_value_} is set to the given values.
				The lower and upper bounds in x and y direction are set to the given values.
			 	If the {\tt is_natural} flag is set to true, all  1D splines and the 1D spline in y direction used in the
				{\tt operator() } will be natural. 
			  Otherwise {\tt x_lower_derivatives} and {\tt x_upper_derivatives} are taken as
			 	first derivatives of the first/last sample positions in x direction 
				and {\tt y_lower_derivative} and {\tt y_upper_derivative} are taken as the first derivatives
				of the first/last derivative in y direction. By default, the derivatives are set to zero.
			*/  
			CubicSpline2D(const std::vector<float>& sample_positions_x,
										const std::vector<float>& sample_positions_y,
										const std::vector<std::vector<float> >& sample_values, 
										const std::vector<float>& x_default_values, 
										float y_default_value, 
										const std::vector<float>& x_lower_bounds,
										const std::vector<float>& x_upper_bounds,
										float y_lower_bound,
										float y_upper_bound,
										bool 	is_natural = true, 	
										const std::vector<float>& x_lower_derivatives = std::vector<float>(), 
										const std::vector<float>& x_upper_derivatives = std::vector<float>(),
										float y_lower_derivative = 0.0,
										float y_upper_derivative = 0.0,
										int verbosity = VERBOSITY_LEVEL_DEBUG);

			
			/**	Copy constructor.
			*/
			CubicSpline2D(const CubicSpline2D& cs2D);
			
			/**	Destructor.
			*/
			virtual ~CubicSpline2D();
	
			/// Set the verbosity of the spline computation and evaluation.
			void setVerbosity(int verbosity);

			/** A method to evaluate the 2Dspline at the access values x | y.
			 *  First all spline in y-direction are evaluated at x.
			 *  Based on these values a temporary 1D spline is created, 
			 *  which will be evaluated at y.
			 *  If the access values are out of bound
			 *  or if we have too less points given for a spline 
			 *  the {\tt default_value} is returned. 
			 *  If the spacing is zero, <tt> std::numeric_limits<float>::min() </tt>
			 *  is returned.
			 */
			float operator () (float x, float y); 
					
			/** Returns the x-th default value in x direction.
			 *  @throw Exception::OutOfRange if x >= number_of_default_values
			 */
			float getXDefaultValue(Index x) const;

			/** Returns the y-th default value in x direction.
			 */
			float getYDefaultValue() const {return y_default_value_;}

			// Set the default values in x direction.
			void setXDefaultValues(vector<float> x_default_values) {x_default_values_ = x_default_values;}

			// Set the default values in y direction.
			void setYDefaultValue(float y_default_value) {y_default_value_ = y_default_value;} 
				
			
			// Set the lower/upper bound in y direction
			void  setYLowerBound(float lb) {y_lower_bound_ = lb;}
			void  setYUpperBound(float ub) {y_upper_bound_ = ub;}
			// Get the lower/upper bound in y direction
			float getYLowerBound() {return y_lower_bound_;}
			float getYUpperBound() {return y_upper_bound_;}
			// Set the lower/upper bounds in x direction
			void  setXLowerBounds(vector<float> lb) {x_lower_bounds_ = lb;}
			void  setXUpperBounds(vector<float> ub) {x_upper_bounds_ = ub;}

			/** Returns all lower bounds in x direction.
			 */
			const vector<float>&  getXLowerBounds() const {return x_lower_bounds_ ;}  

			/** Returns all upper bounds in x direction.
			 */
			const vector<float>&  getXUpperBounds() const {return x_upper_bounds_;}  

			/** Get the lower bounds in x direction  
			 *	@throw Exception::OutOfRange if x  >= x_lower_bounds_.size()
			 */
			float getXLowerBounds(Index x) const;  

			/** Get the upper bounds in x direction  
			 *	@throw Exception::OutOfRange if x  >= x_upper_bounds_.size()
			 */
			float getXUpperBounds(Index x) const;  

			/** Returns true if the x-th spline in x direction is natural.
			 *  If x is out of bound,  <tt> std::numeric_limits<float>::min() </tt> is returned.*/ 
			bool isXNatural(Index x);
			vector<bool> isXNatural() const {return x_is_natural_;}

			/** Sets the flag {\tt is_natural_} for the x-th spline to true. 
			 *  By default the method recomputes the spline. 
			 *  If the argument is false, no recomputation is done.*/
			void makeXNatural(Index x, bool recompute = true);

			/** Sets the flag {\tt is_natural_} for all x-th splines to true. 
			 *  By default the method recomputes all splines. 
			 *  If the argument is false, no recomputation is done.*/
			void makeAllXNatural(bool recompute = true);

			/** Sets the flag {\tt y_is_natural_} to true.
			 * 	Since the spline in y direction is created 
			 * 	for each call of {\tt operator ()} new, 
			 * 	recomputation is not necessary.*/
			void makeYNatural(bool y_is_natural, bool recompute = true);

			/** Returns true if the spline in y direction for each call in {\tt operator ()} is natural.
			 */
			bool isYNatural() {return y_is_natural_;}
			
			// Set the lower/upper derivatives in x direction
			void  setXLowerDerivatives(vector<float> ld, bool recompute = true); 
			void  setXUpperDerivatives(vector<float> ud, bool recompute = true); 

			/** Get the lower derivatives in x direction  
			 *  @throw Exception::OutOfRange if x >= x_lower_derivatives_.size()
			 */
			float getXLowerDerivatives(Index x);

			/** Get the upper derivatives in x direction  
			 *  @throw Exception::OutOfRange if x >= x_upper_derivatives_.size()
			 */
			float getXUpperDerivatives(Index x); 

			vector<float>& getXLowerDerivatives() {return x_lower_derivatives_;}
			vector<float>& getXUpperDerivatives() {return x_upper_derivatives_;}

			// Set the lower/upper derivative in y direction
			void setYLowerDerivative (float ld, bool recompute = true); 
			void setYUpperDerivative (float ud, bool recompute = true);

			// Get the lower/upper derivative in y direction
			float getYLowerDerivative() {return y_lower_derivative_;}
			float getYUpperDerivative() {return y_upper_derivative_;}

			
			/** Return the i-th spline
			 *  @throw Exception::OutOfRange if i >= getNumberOfSplines()
			 */
			CubicSpline1D& getSpline(Position i); 

			/** Return the i-th spline
			 *  @throw Exception::OutOfRange if i >= getNumberOfSplines()
			 */
			const CubicSpline1D& getSpline(Position i) const;

			Size getNumberOfSplines() const {return splines_.size();}	
	
		private :
			
			/** Method to create a 2D cubic spline relying to be given _increasingly ordered_ sample positions in y direction, 
			 * for each y position  _increasingly ordered_ sample positions in x direction, and
			 * the corresponding sample values.
			 * If the {\tt return_average_} flag is set to true, the {\tt default_value_} is the average 
			 * of the 1D spline averages, otherwise it is set to  <tt> std::numeric_limits<float>::min() </tt>.
			 * By default the boundaries in y direction are set to the lower and the upper y sample position. 
			 * The {\tt operator ()} returns the 2D interpolation for given x and y values. 
			 */
			void createBiCubicSpline(); 
				
			// Sample x positions of the spline.
			// Note: we allow for each y value different x positions.
			std::vector< std::vector<float> > sample_positions_x_;
			
			// Sample y positions of the spline.
			std::vector<float> 								sample_positions_y_;

			// For each y position a 1D cubic spline is stored.
			std::vector<CubicSpline1D> 				splines_;
			
			// Sample values of the spline.
			std::vector<std::vector<float> > 	sample_values_;
			
			//
			//  Parameters 
			//
			
			// Flag to denote, if the default values should be set to the average of the spline averages. 
			bool 									 return_average_;
			
			/** The default values of the splines in x direction.
			 		In case the access-value of the x-th spline in x direction is out of bounds 
					or if too less points are given, 
					the corresponding {\tt default_value_(x)} is returned.
		  */
			std::vector<float> 		x_default_values_; 
			
			/** The default value of the splines in y direction.
			 		In case the access-value of the y-th spline in y direction is out of bounds or if 
					too less points for this spline are given, 
					the corresponding {\tt default_value_(y)} is returned.
		  */
			float 								y_default_value_; 

			/** The default value of splines in general. If the return_average_ flag is set
			 *  to true, the averall average of the splines is computed. Otherwise it is set 
			 *  to  <tt> std::numeric_limits<float>::min() </tt>.	 */
			float default_value_;
			
			// Lower bounds of the spline in x direction.
			vector<float>	 				x_lower_bounds_;

			// Upper bounds of the spline in x direction.	
			vector<float> 				x_upper_bounds_;
			
			// Lower bound of the splines in y direction.
			float 								y_lower_bound_;

			// Upper bound of the splines in y direction.	
			float 								y_upper_bound_;
			
			
			// Flag to denote, if the splines in x direction is natural.
			vector<bool> 					x_is_natural_;
			
			// Flag to denote, if the splines in y direction are natural.
			bool 									y_is_natural_;

			
			// Values of the first derivatives of the lower x sample position
			vector<float> 				x_lower_derivatives_;
			
			// Values of the first derivatives of the upper x sample position
			vector<float> 				x_upper_derivatives_;
			
			// Value of the first derivatives of the lower y sample position
			float 								y_lower_derivative_;
			
			// Value of the first derivatives of the upper y sample position
			float 								y_upper_derivative_;

			///
			int 									verbosity_;
	};



}
#endif