This file is indexed.

/usr/include/rheolef/csr_concat.h is in librheolef-dev 6.7-6.

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
#ifndef _RHEOLEF_CSR_CONCAT_H
#define _RHEOLEF_CSR_CONCAT_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef 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 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef 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 Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
///
/// =========================================================================
// build csr from initializer list (c++ 2011)
//
#include "rheolef/csr.h"

namespace rheolef {

// =========================================================================
// 1rst case : one-line matrix initializer
//  A = {a, u};			// matrix & vector
//  A = {trans(u), 3.2};	// trans(vector) & scalar
// =========================================================================
template <class T, class M>
struct vec_trans {
  vec<T,M> v;
  vec_trans (const vec<T,M>& w) : v(w) {}
};
template <class T, class M>
inline
vec_trans<T,M>
trans (const vec<T,M>& w) {
  return vec_trans<T,M> (w);
}
template <class T, class M>
struct vector_vec_trans {
  std::vector<vec<T,M> > v;
  vector_vec_trans (const std::vector<vec<T,M> >& w) : v(w) {}
};
template <class T, class M>
inline
vector_vec_trans<T,M>
trans (const std::vector<vec<T,M> >& w) {
  return vector_vec_trans<T,M> (w);
}
 
template <class T, class M>
class csr_concat_value {
public:
// typedef:
 typedef enum { scalar, vector, vector_transpose, vector_vec, vector_vec_transpose, matrix} variant_type;
// allocators:
 csr_concat_value (int x)                           : s(x), v(),     vv(),     m(),  variant(scalar) {}
#ifdef _RHEOLEF_HAVE_QD
 csr_concat_value (double x)                        : s(x), v(),     vv(),     m(),  variant(scalar) {}
#endif // _RHEOLEF_HAVE_QD
 csr_concat_value (const T& x)                      : s(x), v(),     vv(),     m(),  variant(scalar) {}
 csr_concat_value (const vec<T,M>& x)               : s(),  v(x),    vv(),     m(),  variant(vector) {}
 csr_concat_value (const vec_trans<T,M>& vt)        : s(),  v(vt.v), vv(),     m(),  variant(vector_transpose) {}
 csr_concat_value (const std::vector<vec<T,M> >& x) : s(),  v(),     vv(x),    m(),  variant(vector_vec) {}
 csr_concat_value (const vector_vec_trans<T,M>& vt) : s(),  v(),     vv(vt.v), m(),  variant(vector_vec_transpose) {}
 csr_concat_value (const csr<T,M>& x)               : s(),  v(),     vv(),     m(x), variant(matrix) {}

// data:
public:
 T                      s;
 vec<T,M>               v;
 std::vector<vec<T,M> > vv;
 csr<T,M>               m;
 variant_type           variant;
};

template <class T, class M>
class csr_concat_line {
public:
// typedef:
 typedef typename csr<T,M>::size_type   size_type;
 typedef csr_concat_value<T,M>          value_type;
// allocators:
 csr_concat_line () : _l() {}

#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_LIST
 csr_concat_line (const std::initializer_list<value_type>& il) : _l() {
#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    typedef typename std::initializer_list<value_type>::const_iterator const_iterator;
#else // _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    typedef const value_type* const_iterator;
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    for (const_iterator iter = il.begin(); iter != il.end(); ++iter) {
        _l.push_back(*iter);
    }
 }
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_LIST

 void push_back (const value_type& x) { _l.push_back (x); }

 friend std::ostream& operator<< (std::ostream& o, const csr_concat_line<T,M>& x) {
    std::cout << "{";
    for(typename std::list<value_type>::const_iterator iter = x._l.begin(); iter != x._l.end(); ++iter) {
        std::cout << *iter << " ";
    }
    return std::cout << "}";
 }
// internals:
 static void set_sizes (
    std::pair<size_type,size_type>&         row_sizes,
    std::pair<size_type,size_type>&         col_sizes,
    const std::pair<size_type,size_type>&   new_row_sizes,
    const std::pair<size_type,size_type>&   new_col_sizes);

 static void finalize_sizes (
    std::pair<size_type,size_type>&         sizes,
    const communicator&                     comm);

 static void finalize_sizes (
    std::vector<std::pair<size_type,size_type> >&  sizes,
    const communicator&                            comm);

 void build_csr_pass0 (
    std::pair<size_type,size_type>&                row_sizes,
    std::vector<std::pair<size_type,size_type> >&  col_sizes,
    communicator&                                  comm) const;

 void build_csr_pass1 (
    const std::pair<size_type,size_type>&                row_sizes,
    const std::vector<std::pair<size_type,size_type> >&  col_sizes,
    const communicator&                                  comm,
    distributor&                                         row_ownership,
    distributor&                                         col_ownership,
    std::vector<distributor>&                            col_start_by_component) const;

 void build_csr_pass2 (
    asr<T,M>&                                            a,
    const std::vector<std::pair<size_type,size_type> >&  col_sizes,
    const std::vector<distributor>&                      col_start_by_component,
    size_type                                            row_start_comp_i = 0,
    size_type                                            row_start_comp_dis_i = 0) const;

 csr<T,M> build_csr () const;

// data:
protected:
 std::list<value_type> _l;
};

// -------------------------------
// csr cstor from std::initializer
// -------------------------------
#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_LIST
#define RHEOLEF_csr_cstor(M)						\
template <class T>							\
inline									\
csr<T,M>::csr (const std::initializer_list<csr_concat_value<T,M> >& init_list)	\
{									\
  csr_concat_line<T,M> cc (init_list);					\
  csr<T,M>::operator= (cc.build_csr());					\
}
RHEOLEF_csr_cstor(sequential)
#ifdef _RHEOLEF_HAVE_MPI
RHEOLEF_csr_cstor(distributed)
#endif // _RHEOLEF_HAVE_MPI
#undef RHEOLEF_csr_cstor
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_LIST

// =========================================================================
// 2nd case : multi-line matrix initializer
//  A = { {a,        u  },
//        {trans(u), 3.2} };
// =========================================================================
template <class T, class M>
class csr_concat {
public:
// typedef:
 typedef typename csr<T,M>::size_type   size_type;
 typedef csr_concat_line<T,M>           line_type;
 typedef csr_concat_value<T,M>          value_type;
// allocators:
 csr_concat () : _l() {}

#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_LIST
 csr_concat (const std::initializer_list<line_type>& il) : _l() {
#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    typedef typename std::initializer_list<line_type>::const_iterator const_iterator;
#else // _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    typedef const line_type* const_iterator;
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_ITERATOR
    for(const_iterator iter = il.begin(); iter != il.end(); ++iter) {
        _l.push_back(*iter);
    }
 }
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_LIST

 void push_back (const line_type& line) { _l.push_back(line); }

#ifdef TO_CLEAN
 friend std::ostream& operator<< (std::ostream& o, const csr_concat<T,M>& x) {
    std::cout << "{";
    for(typename std::list<line_type>::const_iterator iter = x._l.begin(); iter != x._l.end(); ++iter) {
        std::cout << *iter << " ";
    }
    return std::cout << "}";
 }
#endif // TO_CLEAN

// internals:
 csr<T,M> build_csr () const;

// data:
protected:
 std::list<line_type> _l;
};

#ifdef _RHEOLEF_HAVE_STD_INITIALIZER_LIST
#define RHEOLEF_csr_cstor(M)						\
template <class T>							\
inline									\
csr<T,M>::csr (const std::initializer_list<csr_concat_line<T,M> >& init_list) \
{									\
  csr_concat<T,M> cc (init_list);					\
  csr<T,M>::operator= (cc.build_csr());					\
}
RHEOLEF_csr_cstor(sequential)
#ifdef _RHEOLEF_HAVE_MPI
RHEOLEF_csr_cstor(distributed)
#endif // _RHEOLEF_HAVE_MPI
#undef RHEOLEF_csr_cstor
#endif // _RHEOLEF_HAVE_STD_INITIALIZER_LIST

} // namespace rheolef
#endif // _RHEOLEF_CSR_CONCAT_H