This file is indexed.

/usr/include/root/Math/Expression.h is in libroot-math-smatrix-dev 5.34.30-0ubuntu8.

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
// @(#)root/smatrix:$Id$
// Authors: T. Glebe, L. Moneta    2005  

#ifndef ROOT_Math_Expression
#define ROOT_Math_Expression
// ********************************************************************
//
// source:
//
// type:      source code
//
// created:   19. Mar 2001
//
// author:    Thorsten Glebe
//            HERA-B Collaboration
//            Max-Planck-Institut fuer Kernphysik
//            Saupfercheckweg 1
//            69117 Heidelberg
//            Germany
//            E-mail: T.Glebe@mpi-hd.mpg.de
//
// Description: Expression Template Elements for SVector
//
// changes:
// 19 Mar 2001 (TG) creation
// 20 Mar 2001 (TG) added rows(), cols() to Expr
// 21 Mar 2001 (TG) added Expr::value_type
// 11 Apr 2001 (TG) rows(), cols() replaced by rows, cols
// 10 Okt 2001 (TG) added print() and operator<<() for Expr class
//
// ********************************************************************

/**
   @defgroup Expression Expression Template Classes
   @ingroup SMatrixGroup
 */

//==============================================================================
// Expr: class representing SVector expressions
//=============================================================================

// modified BinaryOp with two extension BinaryOpCopyL and BinaryOpCopyR to store the 
// object in BinaryOp by value and not reference. When used with constant BinaryOp reference give problems
// on some compilers (like Windows) where a temporary Constant object is ccreated and then destructed


#include <iomanip>
#include <iostream>

namespace ROOT { 

  namespace Math { 



//    template <class T, unsigned int D, unsigned int D2> class MatRepStd;

/** 
    Expression wrapper class for Vector objects

    @ingroup Expression
*/
template <class ExprType, class T, unsigned int D >
class VecExpr {

public:
  typedef T  value_type;

  ///
  VecExpr(const ExprType& rhs) :
    rhs_(rhs) {}

  ///
  ~VecExpr() {}

   /// 
  inline T apply(unsigned int i) const {
    return rhs_.apply(i);
  }

  inline T operator() (unsigned int i) const {
    return rhs_.apply(i);
  }


#ifdef OLD_IMPL
  ///
  static const unsigned int rows = D;
  ///
  ///static const unsigned int cols = D2;
#else
  // use enumerations
  enum { 

    kRows = D 

  };
#endif

  /** 
      function to  determine if any use operand 
      is being used (has same memory adress)
   */ 
  inline bool IsInUse (const T * p) const { 
    return rhs_.IsInUse(p); 
  }


  /// used by operator<<()
  std::ostream& print(std::ostream& os) const {
    os.setf(std::ios::right,std::ios::adjustfield);
    unsigned int i=0;
    os << "[ ";
    for(; i<D-1; ++i) {
      os << apply(i) << ", ";
    }
    os << apply(i);
    os << " ]";
    
    return os;
  }

private:
  ExprType rhs_; // cannot be a reference!
};


/** 
    Expression wrapper class for Matrix objects

    @ingroup Expression
*/

template <class T, unsigned int D, unsigned int D2> class MatRepStd;

template <class ExprType, class T, unsigned int D, unsigned int D2 = 1,
     class R1=MatRepStd<T,D,D2> >
class Expr {
public:
  typedef T  value_type;

  ///
  Expr(const ExprType& rhs) :
    rhs_(rhs) {}

  ///
  ~Expr() {}

  ///
  inline T apply(unsigned int i) const {
    return rhs_.apply(i);
  }
  inline T operator() (unsigned int i, unsigned j) const {
    return rhs_(i,j);
  }
   
  /** 
      function to  determine if any use operand 
      is being used (has same memory adress)
   */ 
  inline bool IsInUse (const T * p) const { 
    return rhs_.IsInUse(p); 
  }
  


#ifdef OLD_IMPL
  ///
  static const unsigned int rows = D;
  ///
  static const unsigned int cols = D2;
#else
  // use enumerations
  enum { 
    ///
    kRows = D, 
  ///
    kCols = D2
  };
#endif

  /// used by operator<<()
  /// simplify to use apply(i,j) 
  std::ostream& print(std::ostream& os) const {
    os.setf(std::ios::right,std::ios::adjustfield);
      os << "[ ";
      for (unsigned int i=0; i < D; ++i) {
         unsigned int d2 = D2; // to avoid some annoying warnings in case of vectors (D2 = 0)
         for (unsigned int j=0; j < D2; ++j) {
            os << std::setw(12) << this->operator() (i,j);
            if ((!((j+1)%12)) && (j < d2-1))
            os << std::endl << "         ...";
         }
         if (i != D - 1)
         os << std::endl  << "  ";
      }
     os << " ]";
     
     return os;
  }

private:
  ExprType rhs_; // cannot be a reference!
};

//==============================================================================
// operator<<
//==============================================================================
template <class A, class T, unsigned int D>
inline std::ostream& operator<<(std::ostream& os, const VecExpr<A,T,D>& rhs) {
  return rhs.print(os);
}

template <class A, class T, unsigned int D1, unsigned int D2, class R1>
inline std::ostream& operator<<(std::ostream& os, const Expr<A,T,D1,D2,R1>& rhs) {
  return rhs.print(os);
}

/** 
    BinaryOperation class
    A class representing binary operators in the parse tree. 
    This is the default case where objects are kept by reference

    @ingroup  Expression
    @author T. Glebe
*/



//==============================================================================
// BinaryOp
//==============================================================================
template <class Operator, class LHS, class RHS, class T>
class BinaryOp {
public:
  ///
  BinaryOp( Operator /* op */, const LHS& lhs, const RHS& rhs) :
    lhs_(lhs), rhs_(rhs) {}

  ///
  ~BinaryOp() {}

  ///
  inline T apply(unsigned int i) const {
    return Operator::apply(lhs_.apply(i), rhs_.apply(i));
  }
  inline T operator() (unsigned int i, unsigned int j) const {
    return Operator::apply(lhs_(i,j), rhs_(i,j) );
  }

  inline bool IsInUse (const T * p) const { 
    return lhs_.IsInUse(p) || rhs_.IsInUse(p); 
  }

protected:

  const LHS& lhs_;
  const RHS& rhs_;

};

//LM :: add specialization of BinaryOP when first or second argument needs to be copied
// (maybe it can be doen with a template specialization, but it is not worth, easier to have a separate class    

//==============================================================================
/**
   Binary Operation class with value storage for the left argument. 
   Special case of BinaryOp where for the left argument the passed object 
   is copied and stored by value instead of a reference.  
   This is used in the case of operations involving a constant, where we cannot store a 
   reference to the constant (we get a temporary object) and we need to copy it. 

   @ingroup  Expression
*/
//==============================================================================
template <class Operator, class LHS, class RHS, class T>
class BinaryOpCopyL {
public:
  ///
  BinaryOpCopyL( Operator /* op */, const LHS& lhs, const RHS& rhs) :
    lhs_(lhs), rhs_(rhs) {}

  ///
  ~BinaryOpCopyL() {}

  ///
  inline T apply(unsigned int i) const {
    return Operator::apply(lhs_.apply(i), rhs_.apply(i));
  }
  inline T operator() (unsigned int i, unsigned int j) const {
    return Operator::apply(lhs_(i,j), rhs_(i,j) );
  }

  inline bool IsInUse (const T * p) const { 
    // no need to check left since we copy it
    return rhs_.IsInUse(p); 
  }

protected:

  const LHS  lhs_;
  const RHS& rhs_;

};


//==============================================================================
/**
   Binary Operation class with value storage for the right argument. 
   Special case of BinaryOp where for the wight argument a copy is stored instead of a reference 
   This is use in the case for example of constant where we cannot store by reference 
   but need to copy since Constant is a temporary object

   @ingroup  Expression
*/
//==============================================================================
template <class Operator, class LHS, class RHS, class T>
class BinaryOpCopyR {
public:
  ///
  BinaryOpCopyR( Operator /* op */, const LHS& lhs, const RHS& rhs) :
    lhs_(lhs), rhs_(rhs) {}

  ///
  ~BinaryOpCopyR() {}

  ///
  inline T apply(unsigned int i) const {
    return Operator::apply(lhs_.apply(i), rhs_.apply(i));
  }
  inline T operator() (unsigned int i, unsigned int j) const {
    return Operator::apply(lhs_(i,j), rhs_(i,j) );
  }

  inline bool IsInUse (const T * p) const { 
    // no need for right since we copied 
    return lhs_.IsInUse(p); 
  }

protected:

  const LHS&  lhs_;
  const RHS rhs_;

};



/** 
    UnaryOperation class
    A class representing unary operators in the parse tree.
    The objects are stored by reference

    @ingroup  Expression
    @author T. Glebe
*/
//==============================================================================
// UnaryOp
//==============================================================================
template <class Operator, class RHS, class T>
class UnaryOp {
public:
  ///
  UnaryOp( Operator /* op */ , const RHS& rhs) :
    rhs_(rhs) {}

  ///
  ~UnaryOp() {}
  
  ///
  inline T apply(unsigned int i) const {
    return Operator::apply(rhs_.apply(i));
  }
  inline T operator() (unsigned int i, unsigned int j) const {
    return Operator::apply(rhs_(i,j));
  }

  inline bool IsInUse (const T * p) const { 
    return rhs_.IsInUse(p); 
  }

protected:

  const RHS& rhs_;

};


/** 
    Constant expression class
    A class representing constant expressions (literals) in the parse tree.

    @ingroup Expression
    @author T. Glebe
*/
//==============================================================================
// Constant
//==============================================================================
template <class T>
class Constant {
public:
  ///
  Constant( const T& rhs ) :
    rhs_(rhs) {}

  ///
  ~Constant() {}

  ///
  inline T apply(unsigned int /*i */ ) const { return rhs_; }

  inline T operator() (unsigned int /*i */, unsigned int /*j */ ) const { return rhs_; }

  //inline bool IsInUse (const T * ) const { return false; }

protected:

  const T rhs_;  // no need for reference. It is  a fundamental type normally 


};



  }  // namespace Math

}  // namespace ROOT
          


#endif  /* ROOT_Math_Expression */