This file is indexed.

/usr/include/TiledArray/expressions/add_expr.h is in libtiledarray-dev 0.6.0-5.

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
432
433
434
435
/*
 *  This file is a part of TiledArray.
 *  Copyright (C) 2013  Virginia Tech
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Justus Calvin
 *  Department of Chemistry, Virginia Tech
 *
 *  add_expr.h
 *  Apr 1, 2014
 *
 */

#ifndef TILEDARRAY_EXPRESSIONS_ADD_EXPR_H__INCLUDED
#define TILEDARRAY_EXPRESSIONS_ADD_EXPR_H__INCLUDED

#include <TiledArray/expressions/add_engine.h>
#include <TiledArray/expressions/binary_expr.h>

namespace TiledArray {
  namespace expressions {

    template <typename Left, typename Right>
    using ConjAddExpr =
        ScalAddExpr<Left, Right, TiledArray::detail::ComplexConjugate<void> >;

    template <typename Left, typename Right, typename Scalar>
    using ScalConjAddExpr =
        ScalAddExpr<Left, Right, TiledArray::detail::ComplexConjugate<Scalar> >;

    using TiledArray::detail::conj_op;
    using TiledArray::detail::mult_t;
    using TiledArray::detail::numeric_t;
    using TiledArray::detail::scalar_t;

    template <typename Left, typename Right>
    struct ExprTrait<AddExpr<Left, Right> > {
      typedef Left left_type; ///< The left-hand expression type
      typedef Right right_type; ///< The right-hand expression type
      typedef AddEngine<typename ExprTrait<Left>::engine_type,
          typename ExprTrait<Right>::engine_type>
          engine_type; ///< Expression engine type
      typedef numeric_t<typename EngineTrait<engine_type>::eval_type>
          numeric_type; ///< Addition result numeric type
      typedef scalar_t<typename EngineTrait<engine_type>::eval_type>
          scalar_type; ///< Addition result scalar type
    };

    template <typename Left, typename Right, typename Scalar>
    struct ExprTrait<ScalAddExpr<Left, Right, Scalar> > {
      typedef Left left_type; ///< The left-hand expression type
      typedef Right right_type; ///< The right-hand expression type
      typedef ScalAddEngine<typename ExprTrait<Left>::engine_type,
          typename ExprTrait<Right>::engine_type, Scalar>
          engine_type; ///< Expression engine type
      typedef numeric_t<typename EngineTrait<engine_type>::eval_type>
          numeric_type; ///< Addition numeric type
      typedef Scalar scalar_type;  ///< Expression scalar type
    };


    /// Addition expression

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    template <typename Left, typename Right>
    class AddExpr : public BinaryExpr<AddExpr<Left, Right> > {
    public:
      typedef AddExpr<Left, Right> AddExpr_; ///< This class type
      typedef BinaryExpr<AddExpr<Left, Right> >
          BinaryExpr_; ///< Binary base class type
      typedef typename ExprTrait<AddExpr_>::left_type
          left_type; ///< The left-hand expression type
      typedef typename ExprTrait<AddExpr_>::right_type
          right_type; ///< The right-hand expression type
      typedef typename ExprTrait<AddExpr_>::engine_type
          engine_type; ///< Expression engine type

      // Compiler generated functions
      AddExpr(const AddExpr_&) = default;
      AddExpr(AddExpr_&&) = default;
      ~AddExpr() = default;
      AddExpr_& operator=(const AddExpr_&) = delete;
      AddExpr_& operator=(AddExpr_&&) = delete;

      /// Expression constructor

      /// \param left The left-hand expression
      /// \param right The right-hand expression
      AddExpr(const left_type& left, const right_type& right) :
        BinaryExpr_(left, right)
      { }

    }; // class AddExpr


    /// Addition expression

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    template <typename Left, typename Right, typename Scalar>
    class ScalAddExpr : public BinaryExpr<ScalAddExpr<Left, Right, Scalar> > {
    public:
      typedef ScalAddExpr<Left, Right, Scalar>
          ScalAddExpr_; ///< This class type
      typedef BinaryExpr<ScalAddExpr_>
          BinaryExpr_; ///< Binary base class type
      typedef typename ExprTrait<ScalAddExpr_>::left_type
          left_type; ///< The left-hand expression type
      typedef typename ExprTrait<ScalAddExpr_>::right_type
          right_type; ///< The right-hand expression type
      typedef typename ExprTrait<ScalAddExpr_>::engine_type
          engine_type; ///< Expression engine type
      typedef typename ExprTrait<ScalAddExpr_>::scalar_type
          scalar_type; ///< Scalar type


    private:

      scalar_type factor_; ///< The scaling factor

    public:

      // Compiler generated functions
      ScalAddExpr(const ScalAddExpr_&) = default;
      ScalAddExpr(ScalAddExpr_&&) = default;
      ~ScalAddExpr() = default;
      ScalAddExpr_& operator=(const ScalAddExpr_&) = delete;
      ScalAddExpr_& operator=(ScalAddExpr_&&) = delete;

      /// Expression constructor

      /// \param arg The argument expression
      /// \param factor The scaling factor
      ScalAddExpr(const left_type& left, const right_type& right,
          const scalar_type factor) :
        BinaryExpr_(left, right), factor_(factor)
      { }


      /// Scaling factor accessor

      /// \return The scaling factor
      scalar_type factor() const { return factor_; }

    }; // class ScalAddExpr


    /// Addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \param left The left-hand expression object
    /// \param right The right-hand expression object
    /// \return An addition expression object
    template <typename Left, typename Right>
    inline AddExpr<Left, Right>
    operator+(const Expr<Left>& left, const Expr<Right>& right) {
      static_assert(TiledArray::expressions::is_aliased<Left>::value,
          "no_alias() expressions are not allowed on the right-hand side of "
          "the assignment operator.");
      static_assert(TiledArray::expressions::is_aliased<Right>::value,
          "no_alias() expressions are not allowed on the right-hand side of "
          "the assignment operator.");
      return AddExpr<Left, Right>(left.derived(), right.derived());
    }

    /// Scaled-addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The addition expression object
    /// \param factor The scaling factor
    /// \return A scaled-addition expression object
    template <typename Left, typename Right, typename Scalar>
    inline typename std::enable_if<TiledArray::detail::is_numeric<Scalar>::value,
        ScalAddExpr<Left, Right, Scalar> >::type
    operator*(const AddExpr<Left, Right>& expr, const Scalar& factor) {
      return ScalAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          factor);
    }

    /// Scaled-addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param factor The scaling factor
    /// \param expr The addition expression object
    /// \return A scaled-addition expression object
    template <typename Left, typename Right, typename Scalar>
    inline typename std::enable_if<TiledArray::detail::is_numeric<Scalar>::value,
        ScalAddExpr<Left, Right, Scalar> >::type
    operator*(const Scalar& factor, const AddExpr<Left, Right>& expr) {
      return ScalAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          factor);
    }

    /// Scaled-addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar1 The expression scaling factor type
    /// \tparam Scalar2 The scaling factor type
    /// \param expr The addition expression object
    /// \param factor The scaling factor
    /// \return A scaled-addition expression object
    template <typename Left, typename Right, typename Scalar1, typename Scalar2,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar2>::value
        >::type* = nullptr>
    inline ScalAddExpr<Left, Right, mult_t<Scalar1, Scalar2> >
    operator*(const ScalAddExpr<Left, Right, Scalar1>& expr, const Scalar2& factor) {
      return ScalAddExpr<Left, Right, mult_t<Scalar1, Scalar2> >(expr.left(),
          expr.right(), expr.factor() * factor);
    }

    /// Scaled-addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar1 The scaling factor type
    /// \tparam Scalar2 The expression scaling factor type
    /// \param factor The scaling factor
    /// \param expr The addition expression object
    /// \return A scaled-addition expression object
    template <typename Left, typename Right, typename Scalar1, typename Scalar2,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar1>::value
        >::type* = nullptr>
    inline ScalAddExpr<Left, Right, mult_t<Scalar2, Scalar1> >
    operator*(const Scalar1& factor, const ScalAddExpr<Left, Right, Scalar2>& expr) {
      return ScalAddExpr<Left, Right, mult_t<Scalar2, Scalar1> >(expr.left(),
          expr.right(), expr.factor() * factor);
    }

    /// Negated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \param expr The addition expression object
    /// \return A scaled-addition expression object
    template <typename Left, typename Right>
    inline ScalAddExpr<Left, Right,
        typename ExprTrait<AddExpr<Left, Right> >::numeric_type>
    operator-(const AddExpr<Left, Right>& expr) {
      return ScalAddExpr<Left, Right,
          typename ExprTrait<AddExpr<Left, Right> >::numeric_type>(
              expr.left(), expr.right(), -1);
    }

    /// Negated scaled-addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The addition expression object
    /// \return A scaled-addition expression object
    template <typename Left, typename Right, typename Scalar>
    inline ScalAddExpr<Left, Right, Scalar>
    operator-(const ScalAddExpr<Left, Right, Scalar>& expr) {
      return ScalAddExpr<Left, Right, Scalar>(expr.left(), expr.right(), -1);
    }

    /// Conjugated addition expression factory

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \param expr The addition expression object
    /// \return A conjugated addition expression object
    template <typename Left, typename Right>
    inline ConjAddExpr<Left, Right> conj(const AddExpr<Left, Right>& expr) {
      return ConjAddExpr<Left, Right>(expr.left(), expr.right(), conj_op());
    }

    /// Conjugated-conjugate addition expression factory

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \param expr The addition expression object
    /// \return A tensor expression object
    template <typename Left, typename Right>
    inline AddExpr<Left, Right> conj(const ConjAddExpr<Left, Right>& expr) {
      return AddExpr<Left, Right>(expr.left(), expr.right());
    }

    /// Conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The addition expression object
    /// \return A conjugated addition expression object
    template <typename Left, typename Right, typename Scalar>
    inline ScalConjAddExpr<Left, Right, Scalar>
    conj(const ScalAddExpr<Left, Right, Scalar>& expr) {
      return ScalConjAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          conj_op(TiledArray::detail::conj(expr.factor())));
    }

    /// Conjugated-conjugate addition expression factory

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The scaled conjugate tensor expression object
    /// \return A conjugated expression object
    template <typename Left, typename Right, typename Scalar>
    inline ScalAddExpr<Left, Right, Scalar>
    conj(const ScalConjAddExpr<Left, Right, Scalar>& expr) {
      return ScalAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          TiledArray::detail::conj(expr.factor().factor()));
    }

    /// Scaled-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The tensor expression object
    /// \param factor The scaling factor
    /// \return A scaled-tensor expression object
    template <typename Left, typename Right, typename Scalar,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar>::value
        >::type* = nullptr>
    inline ScalConjAddExpr<Left, Right, Scalar>
    operator*(const ConjAddExpr<Left, Right>& expr, const Scalar& factor) {
      return ScalConjAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          conj_op(factor));
    }

    /// Scaled-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param factor The scaling factor
    /// \param expr The tensor expression object
    /// \return A scaled-conjugated addition expression object
    template <typename Left, typename Right, typename Scalar,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar>::value
        >::type* = nullptr>
    inline ScalConjAddExpr<Left, Right, Scalar>
    operator*(const Scalar& factor, const ConjAddExpr<Left, Right>& expr) {
      return ScalConjAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          conj_op(factor));
    }

    /// Scaled-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar1 The expression scaling factor type
    /// \tparam Scalar2 The scaling factor type
    /// \param expr The scaled-tensor expression object
    /// \param factor The scaling factor
    /// \return A scaled-conjugated addition expression object
    template <typename Left, typename Right, typename Scalar1, typename Scalar2,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar2>::value
        >::type* = nullptr>
    inline ScalConjAddExpr<Left, Right, mult_t<Scalar1, Scalar2> >
    operator*(const ScalConjAddExpr<Left, Right, Scalar1>& expr, const Scalar2& factor) {
      return ScalConjAddExpr<Left, Right, mult_t<Scalar1, Scalar2> >(expr.left(),
          expr.right(), conj_op(expr.factor().factor() * factor));
    }

    /// Scaled-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar1 The scaling factor type
    /// \tparam Scalar2 The expression scaling factor type
    /// \param factor The scaling factor
    /// \param expr The scaled-conjugated addition expression object
    /// \return A scaled-conjugated addition expression object
    template <typename Left, typename Right, typename Scalar1, typename Scalar2,
        typename std::enable_if<
            TiledArray::detail::is_numeric<Scalar1>::value
        >::type* = nullptr>
    inline ScalConjAddExpr<Left, Right, mult_t<Scalar2, Scalar1> >
    operator*(const Scalar1& factor, const ScalConjAddExpr<Left, Right, Scalar2>& expr) {
      return ScalConjAddExpr<Left, Right, mult_t<Scalar2, Scalar1> >(
          expr.left(), expr.right(), conj_op(expr.factor().factor() * factor));
    }

    /// Negated-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \param expr The tensor expression object
    /// \return A scaled-addition expression object
    template <typename Left, typename Right>
    inline ScalConjAddExpr<Left, Right,
        typename ExprTrait<ConjAddExpr<Left, Right> >::numeric_type>
    operator-(const ConjAddExpr<Left, Right>& expr) {
      typedef typename ExprTrait<ConjAddExpr<Left, Right> >::numeric_type
          scalar_type;
      return ScalConjAddExpr<Left, Right, scalar_type>(expr.left(),
          expr.right(), conj_op<scalar_type>(-1));
    }

    /// Negated-conjugated addition expression factor

    /// \tparam Left The left-hand expression type
    /// \tparam Right The right-hand expression type
    /// \tparam Scalar A scalar type
    /// \param expr The scaled-conjugated-tensor expression object
    /// \return A scaled-conjugated addition expression object
    template <typename Left, typename Right, typename Scalar>
    inline ScalConjAddExpr<Left, Right, Scalar>
    operator-(const ScalConjAddExpr<Left, Right, Scalar>& expr) {
      return ScalConjAddExpr<Left, Right, Scalar>(expr.left(), expr.right(),
          conj_op(-expr.factor().factor()));
    }

  }  // namespace expressions
} // namespace TiledArray

#endif // TILEDARRAY_EXPRESSIONS_ADD_EXPR_H__INCLUDED