This file is indexed.

/usr/include/ossim/base/ossimTerm.h is in libossim-dev 2.2.2-1.

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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
/**
 * @author	Dylan Thomas Cannisi
 * @date	07/24/2017
 *
 * @brief	Mathematical term data structure for ossim.
 * 
 *        See top level LICENSE.txt file.
 */
#ifndef OSSIM_TERM_H
#define OSSIM_TERM_H 1

#include <ossim/base/ossimConstants.h>

#include <vector>
#include <cmath>



/**
 * @brief      Different types for terms in a function
 */
enum termType : ossim_uint32 {
	monomial,
	polynomial,
	variable,
	constant,
	product
};



/**
 * An abstract class to containing a multivariable function.
 */
class OSSIMDLLEXPORT ossimTerm
{
public:


   /**
    * @brief      Virtual destructor for destroying tree from the top node.
    */
   virtual ~ossimTerm() {}


   /**
    * @brief      Evaluates a term at a given point PURE VIRTUAL
    *
    * @param[in]  point  The point to be evaluated
    *
    * @return     the value at a point
    */
   virtual ossim_float64	evaluate(std::vector<ossim_float64> /* point */ ) const = 0;
   /**
    * @brief      Calculates the derivative of the term
    *
    * @param[in]  variable  The variable in which the derivative is with respect too
    *
    * @return     A pointer containing the derivative of the term.
    */
   virtual ossimTerm*		derivative(const ossim_uint32& variable) const = 0;


   /**
    * @brief      Gets the type
    *
    * @return     The type
    */
   virtual ossim_uint32	getType() const = 0;
   /**
    * @brief      Returns a pointer to a copy of the term
    *
    * @return     A pointer to a copy of the term
    */
   virtual ossimTerm*		copy() const = 0;


   /**
    * @brief      Evaluates the function for a point
    *
    * @param      point   The point at which the function is being evaluated
    *
    * @return     The value at a point
    */
   inline ossim_float64	operator()(std::vector<ossim_float64> point) const{ return this->evaluate(point); }


   /**
    * @brief      Returns a copy of the two terms in a polynomial
    *
    * @param      rhs   The right hand term of the polynomial
    *
    * @return     A polynomial with !COPIES! of the two terms
    */
   inline ossimTerm*	operator+(ossimTerm* rhs) const;
   /**
    * @brief      Returns a copy of the two terms in a product
    *
    * @param      rhs   The right hand term of the product
    *
    * @return     A product with !COPIES! of the two terms
    */
   inline ossimTerm*	operator*(ossimTerm* rhs) const;

};



/**
 * A monomial class to hold a monomial as a term. Example (c_0 * x_0 ^ e_0)
 */
class OSSIMDLLEXPORT ossimMonom : public ossimTerm{
public:


	/**
	 * @brief     Public Constructor
	 *
	 * @param[in]  coeffient    The coeffient of the term
	 * @param      variable     The variable the variable number of the term
	 * @param[in]  exponential  The exponential of the term
	 */
	ossimMonom(const ossim_float64& coeffient, ossimTerm* variable, const ossim_float64& exponential) : coef(coeffient), var(variable), exp(exponential) {}
	/**
	 * @brief      Public Copy Constructor
	 *
	 * @param[in]  src   The source to be copied
	 */
	ossimMonom(const ossimMonom& src) : coef(src.coef), var(src.var->copy()), exp(src.exp) {}
	/**
	 * @brief      Destroys the monomial
	 */
	~ossimMonom() { delete var; }


	/**
	 * @brief      Evaluates a monomial for a point
	 *
	 * @param[in]  point  The point to be evaluated
	 *
	 * @return     The value at a point.
	 */
	ossim_float64	evaluate(std::vector<ossim_float64> point) const { return (coef * pow(var->evaluate(point), exp)); }
	/**
	 * @brief      Calculates the derivative for a monomial
	 *
	 * @param[in]  variable  The variable in which the derivative is with respect too.
	 *
	 * @return     A pointer to that contains the derivative of the term.
	 */
	ossimTerm*		derivative(const ossim_uint32& variable) const;


	/**
	 * @brief      Gets the type of a monomial
	 *
	 * @return     The type of a monomial
	 */
	ossim_uint32	getType() const { return termType::monomial; }
	/**
	 * @brief      Creates a copy of the monomial
	 *
	 * @return     A pointer to a copy of the monomial
	 */
	ossimTerm*		copy() const;

private:
	ossim_float64	coef;		// The coefficent of the monomial 
	ossimTerm*		var;		// The variable number of the monomial (starts at 0 - n)
	ossim_float64	exp;		// The exponenent of the monomial

};



/**
 * A polynomial class to hold a polynomial as a term.
 */
class OSSIMDLLEXPORT ossimPolynomial : public ossimTerm{
public:


	/**
	 * @brief      Public Constructor
	 *
	 * @param      leftTerm   The left term
	 * @param      rightTerm  The right term
	 */
	ossimPolynomial(ossimTerm* leftTerm, ossimTerm* rightTerm) : lTerm(leftTerm), rTerm(rightTerm) {}
	/**
	 * @brief      Public Copy Constructor
	 *
	 * @param[in]  src   The source to be copied
	 */
	ossimPolynomial(const ossimPolynomial& src) : lTerm(src.lTerm->copy()), rTerm(src.rTerm->copy()) {}
	/**
	 * @brief      Destroys the polynomial
	 */
	~ossimPolynomial() { delete lTerm; delete rTerm; }


	/**
	 * @brief      Evaluates a polynomial for a point
	 *
	 * @param[in]  point  The point to be evaluated
	 *
	 * @return     The value at a point.
	 */
	ossim_float64	evaluate(std::vector<ossim_float64> point) const { return lTerm->evaluate(point) + rTerm->evaluate(point); }
	/**
	 * @brief      Calculates the derivative for a polynomial
	 *
	 * @param[in]  variable  The variable in which the derivative is with respect too.
	 *
	 * @return     A pointer to that contains the derivative of the term.
	 */
	ossimTerm*		derivative(const ossim_uint32& variable) const;


	/**
	 * @brief      Gets the type of a polynomial
	 *
	 * @return     The type of a polynomial
	 */
	ossim_uint32	getType() const { return termType::polynomial; }
	/**
	 * @brief      Creates a copy of the polynomial
	 *
	 * @return     A pointer to a copy of the polynomial
	 */
	ossimTerm*		copy() const;

private:
	ossimTerm* lTerm;		// The left term of the polynomial
	ossimTerm* rTerm;		// The right term of the polynomial

};



/**
 * A polynomial class to hold a product as a term.
 */
class OSSIMDLLEXPORT ossimProd : public ossimTerm{
public:


	/**
	 * @brief      Public Constructor
	 *
	 * @param      leftTerm   The left term
	 * @param      rightTerm  The right term
	 */
	ossimProd(ossimTerm* leftTerm, ossimTerm* rightTerm) : lTerm(leftTerm), rTerm(rightTerm) {}
	/**
	 * @brief      Public Copy Constructor
	 *
	 * @param[in]  src   The source to be copied
	 */
	ossimProd(const ossimProd& src) : lTerm(src.lTerm->copy()), rTerm(src.rTerm->copy()) {}
	/**
	 * @brief      Destroys the product
	 */
	~ossimProd() { delete lTerm; delete rTerm; }


	/**
	 * @brief      Evaluates a product for a point
	 *
	 * @param[in]  point  The point to be evaluated
	 *
	 * @return     The value at a point.
	 */
	ossim_float64	evaluate(std::vector<ossim_float64> point) const { return lTerm->evaluate(point) * rTerm->evaluate(point); }
	/**
	 * @brief      Calculates the derivative for a product
	 *
	 * @param[in]  variable  The variable in which the derivative is with respect too.
	 *
	 * @return     A pointer to that contains the derivative of the term.
	 */
	ossimTerm*		derivative(const ossim_uint32& variable) const;


	/**
	 * @brief      Gets the type of a product
	 *
	 * @return     The type of a product
	 */
	ossim_uint32	getType() const { return termType::product; }
	/**
	 * @brief      Creates a copy of the product
	 *
	 * @return     A pointer to a copy of the product
	 */
	ossimTerm*		copy() const;

private:
	ossimTerm* lTerm;		// The left term of the product
	ossimTerm* rTerm;		// The right term of the product

};



/**
 * A variable class to hold a variable as a term.
 */
class OSSIMDLLEXPORT ossimVar : public ossimTerm{
public:


	/**
	 * @brief      Public Constructor
	 *
	 * @param[in]  variable  The variable number
	 */
	ossimVar(const ossim_uint32& variable) : var(variable) {}
	/**
	 * @brief      Public Copy Constructor
	 *
	 * @param[in]  src   The source to be copied
	 */
	ossimVar(const ossimVar& src) : var(src.var) {}
	/**
	 * @brief      Destroys the variable
	 */
	~ossimVar() {}


	/**
	 * @brief      Evaluates a variable for a point
	 *
	 * @param[in]  point  The point to be evaluated
	 *
	 * @return     The value at a point.
	 */
	ossim_float64	evaluate(std::vector<ossim_float64> point) const{ return point[var]; }
	/**
	 * @brief      Calculates the derivative for a variable
	 *
	 * @param[in]  variable  The variable in which the derivative is with respect too.
	 *
	 * @return     A pointer to that contains the derivative of the term.
	 */
	ossimTerm*		derivative(const ossim_uint32& variable) const;


	/**
	 * @brief      Gets the type of a variable
	 *
	 * @return     The type of a variable
	 */
	ossim_uint32	getType() const { return termType::variable; }
	/**
	 * @brief      Creates a copy of the variable
	 *
	 * @return     A pointer to a copy of the variable
	 */
	ossimTerm*		copy() const;

private:
	ossim_uint32 var;		// The number of the variable (0-n)

};



/**
 * A constant class to hold a constant as a term.
 */
class OSSIMDLLEXPORT ossimConst : public ossimTerm
{
public:


   /**
    * @brief      Public Constructor
    *
    * @param[in]  value  The value of the constant
    */
ossimConst(const ossim_float64& value) : val(value) {}
   /**
    * @brief      Public Copy Constructor
    *
    * @param[in]  src   The source to be copied
    */
ossimConst(const ossimConst& src) : val(src.val) {}
   /**
    * @brief      Destroys the constant
    */
   ~ossimConst() {}


   /**
    * @brief      Evaluates a constant for a point
    *
    * @param[in]  point  The point to be evaluated
    *
    * @return     The value at a point.
    */
   ossim_float64	evaluate(std::vector<ossim_float64> /* point */ ) const{ return val; }
   /**
    * @brief      Calculates the derivative for a constant
    *
    * @param[in]  variable  The variable in which the derivative is with respect too.
    *
    * @return     A pointer to that contains the derivative of the term.
    */
   ossimTerm*		derivative(const ossim_uint32& variable) const;


   /**
    * @brief      Gets the type of a constant
    *
    * @return     The type of a constant
    */
   ossim_uint32	getType() const { return termType::constant; }
   /**
    * @brief      Creates a copy of the constant
    *
    * @return     A pointer to a copy of the constant
    */
   ossimTerm*		copy() const;

private:
   ossim_float64 val;	// The value of the constant

};

#endif // OSSIM_TERM_H