This file is indexed.

/usr/include/rheolef/csr-algo-aplb.h is in librheolef-dev 5.93-2.

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
# ifndef _SKIT_CSR_ALGO_APLB_H
# define _SKIT_CSR_ALGO_APLB_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
/// 
/// =========================================================================
//
// CSR: Compressed Sparse Row format
//
// algorithm-oriented generic library
// inspired from sparskit2 fortran library
//  
// author: Pierre.Saramito@imag.fr
//  
// date: 12 november 1997
//  
//@!\vfill\listofalgorithms
/*@! 
 \vfill \pagebreak \mbox{} \vfill \begin{algorithm}[h]
  \caption{{\tt xply\_size}: sparse size of $z=x\pm y$, where $x,y$ are sparse vectors.}
  \begin{algorithmic}
    \INPUT {sparse vectors patterns}
      jx(0:nnzx-1), jy(0:nnzy-1)
    \ENDINPUT
    \OUTPUT {number of non-null elements in $z=x\pm y$}
      nnzz
    \ENDOUTPUT
    \NOTE {}
      The input sparse vectors may be sorted by increasing index order (see also {\tt csr\_sort}).
    \ENDNOTE
    \BEGIN 
      nnzz := 0 \\
      p := 0 \\
      q := 0 \\
      \WHILE {p $\neq$ nnzx {\bf or } q $\neq$ nnzy}
          ix := {\bf if} p = nnzx {\bf then} $+\infty$ {\bf else} jx(p) {\bf endif} \\
          iy := {\bf if} q = nnzy {\bf then} $+\infty$ {\bf else} jy(q) {\bf endif} \\
	  \IF {ix = jy}
	      p++\\
	      q++
          \ELSIF {ix $<$ iy}
	      p++
          \ELSE
	      q++
          \ENDIF
	  nnz++
      \ENDWHILE
    \END
 \end{algorithmic} \end{algorithm}
 \vfill \pagebreak \mbox{} \vfill
*/
namespace rheolef { 

template <
    class InputIterator1, 
    class InputIterator2,
    class Size>
inline 
Size
xply_size (
    InputIterator1  jx, 
    InputIterator1  last_jx,
    InputIterator2  jy,
    InputIterator2  last_jy,
    const Size&)
{
    Size nnzz = 0;
    const Size infty = std::numeric_limits<Size>::max();
    while (jx != last_jx || jy != last_jy) {

        Size i1 = jx == last_jx ? infty : *jx;
        Size i2 = jy == last_jy ? infty : *jy;

        if (i1 == i2) {
            ++jx;
            ++jy;
        } else if (i1 < i2) {
            ++jx;
        } else {
            ++jy;
        }
	nnzz++;
    }
    return nnzz;
}
/*@! 
 \vfill \pagebreak \mbox{} \vfill \begin{algorithm}[h]
  \caption{{\tt xply}: compute $z=x\pm y$, where $x,y$ are sparse vectors.}
  \begin{algorithmic}
    \INPUT {sparse vectors}
      jx(0:nnzx-1), x(0:nnzx-1), \\
      jy(0:nnzy-1), y(0:nnzy-1)
    \ENDINPUT
    \OUTPUT {the sparse vector $z=x\pm y$}
      jz(0:nnzz-1), z(0:nnzz-1)
    \ENDOUTPUT
    \NOTE {}
	The input sparse vectors may be sorted by increasing index order (see also {\tt csr\_sort}).
    \ENDNOTE
    \BEGIN 
      p := q := nzzz := 0 \\
      \WHILE {p $\neq\infty$ {\bf or } q $\neq\infty$}
          ix := {\bf if} p = $+\infty$ {\bf then} $+\infty$ {\bf else} jx(p) {\bf endif} \\
          iy := {\bf if} q = $+\infty$ {\bf then} $+\infty$ {\bf else} jy(q) {\bf endif} \\
	  \IF {ix = jy}
	      jz(nzzz) := ix \\
	      z(nzzz) := x(p) $\pm$ y(q) \\
	      p++ \\
	      q++
          \ELSIF {ix $<$ iy}
	      jz(nzzz) := ix \\
	      z(nzzz) := x(p) $\pm$ 0\\
	      p++
          \ELSE
	      jz(nzzz) := iy \\
	      z(nzzz) := 0 $\pm$ y(q) \\
	      q++
          \ENDIF
	  nzzz++
      \ENDWHILE
    \END
 \end{algorithmic} \end{algorithm}
 \vfill \pagebreak \mbox{} \vfill
*/
template <
    class BinaryOperation,
    class InputIterator1,
    class InputIterator2,
    class InputIterator3,
    class InputIterator4,
    class OutputIterator1,
    class OutputIterator2,
    class Size>
inline
Size
xply (
    BinaryOperation    binary_op,
    InputIterator1     jx,
    InputIterator1     last_jx,
    InputIterator2     x,
    InputIterator3     jy,
    InputIterator3     last_jy,
    InputIterator4     y,
    OutputIterator1    jz,
    OutputIterator2    z,
    const Size&)
{
    Size nnzz = 0;
    const Size infty = std::numeric_limits<Size>::max();
    while (jx != last_jx || jy != last_jy) {

        Size i1 = jx == last_jx ? infty : *jx;
        Size i2 = jy == last_jy ? infty : *jy;
        
	if (i1 == i2) {
	    *z++ = binary_op(*x++, *y++);
	    *jz++ = i1;
            ++jx;
            ++jy;
        } else if (i1 < i2) {
	    *z++ = binary_op(*x++, 0);
	    *jz++ = i1;
            ++jx;
        } else {
	    *z++ = binary_op(0, *y++);
	    *jz++ = i2;
            ++jy;
        }
	nnzz++;
    }
    return nnzz;
}
/*@! 
 \vfill \pagebreak \mbox{} \vfill \begin{algorithm}[h]
  \caption{{\tt aplb\_size}: sparse size of $c=a\pm b$.}
  \begin{algorithmic}
    \INPUT {sparse matrix patterns}
      ia(0:nrowa), ja(0:nnza-1), \\
      ib(0:nrowb), jb(0:nnzb-1)
    \ENDINPUT
    \OUTPUT {number of non-null elements in $c=a\pm b$}
      nnzc
    \ENDOUTPUT
    \NOTE {} The input sparse matrix may be sorted by increasing column order (see also {\tt csr\_sort}).
    \ENDNOTE
    \BEGIN 
      nnzz := 0 \\
      \FORTO {i := 0} {nrowa-1}
          nnzc += xply\_size (ja(ia(i):ia(i+1)-1), jb(ib(i):ib(i+1)-1))
      \ENDFOR
    \END
 \end{algorithmic} \end{algorithm}
 \vfill \pagebreak \mbox{} \vfill
*/
template <
  class InputIterator1,
  class InputIterator2,
  class InputIterator3,
  class InputIterator4,
  class Size>
Size
aplb_size (
    InputIterator1 ia,
    InputIterator1 last_ia,
    InputIterator2 ja,
    InputIterator3 ib,
    InputIterator4 jb,
    const Size&)
{
    Size nnzc = 0;
    InputIterator2 first_ja = ja + *ia++;
    InputIterator4 first_jb = jb + *ib++;
    while (ia != last_ia) {
        InputIterator2 last_ja = ja + *ia++;
        InputIterator4 last_jb = jb + *ib++;
	nnzc += xply_size (first_ja, last_ja, first_jb, last_jb, Size());
	first_ja = last_ja;
	first_jb = last_jb;
    }
    return nnzc;
}
/*@! 
 \vfill \pagebreak \mbox{} \vfill \begin{algorithm}[h]
  \caption{{\tt aplb}: compute $c=a\pm b$.}
  \begin{algorithmic}
    \INPUT {sparse matrix in CSR format}
      ia(0:nrowa), ja(0:nnza-1), a(0:nnza-1), \\
      ib(0:nrowb), jb(0:nnzb-1), b(0:nnzb-1)
    \ENDINPUT
    \OUTPUT {the result $c=a\pm b$ in CSR format}
      ic(0:nrowa), jc(0:nnzc-1), c(0:nnzc-1)
    \ENDOUTPUT
    \NOTE {}
	The input sparse matrixes may be sorted by increasing column order (see also {\tt csr\_sort}).
    \ENDNOTE
    \BEGIN 
      nnzc := 0 \\
      \FORTO {i := 0}{nrowa-1}
	  jx := ja(ia(i):ia(i+1)-1) \\
	  x := a(ia(i):ia(i+1)-1) \\
	  jb := jb(ib(i):ib(i+1)-1) \\
	  b := b(ib(i):ib(i+1)-1) \\
	  nzzz += xply(jx, x, jy, y, jc(ic(i):ic(i+1)-1), c(ic(i):ic(i+1)-1))
      \ENDFOR
    \END
 \end{algorithmic} \end{algorithm}
 \vfill \pagebreak \mbox{} \vfill
*/
template <
    class BinaryOperation,
    class InputIterator1,
    class InputIterator2,
    class InputIterator3,
    class InputIterator4,
    class InputIterator5,
    class InputIterator6,
    class OutputIterator1,
    class OutputIterator2,
    class OutputIterator3,
    class Size>
Size
aplb (
    BinaryOperation     binary_op,
    InputIterator1      ia,
    InputIterator1      last_ia,
    InputIterator2      ja,
    InputIterator3      a,
    InputIterator4      ib,
    InputIterator5      jb,
    InputIterator6      b,
    OutputIterator1     ic,
    OutputIterator2     jc,
    OutputIterator3     c,
    const Size&)
{
    Size nnzc = *ic++ = 0;
    Size a_offset = *ia++;
    Size b_offset = *ib++;
    InputIterator2  first_ja = ja + a_offset;
    InputIterator3  first_a  =  a + a_offset;
    InputIterator5  first_jb = jb + b_offset;
    InputIterator6  first_b  =  b + b_offset;
    OutputIterator2 first_jc = jc + nnzc;
    OutputIterator3 first_c  =  c + nnzc;
    while (ia != last_ia) {
        a_offset = *ia++;
        b_offset = *ib++;
        InputIterator2 last_ja = ja + a_offset;
        InputIterator5 last_jb = jb + b_offset;
	nnzc += xply (binary_op,
		    first_ja, last_ja, first_a, 
		    first_jb, last_jb, first_b, 
		    first_jc,          first_c, 
		    Size());
	first_ja = last_ja;
	first_a  = a + a_offset;
	first_jb = last_jb;
	first_b  = b + b_offset;
	*ic++ = nnzc;
	first_jc = jc + nnzc;
	first_c  =  c + nnzc;
    }
    return nnzc;
}
//@!\vfill
}// namespace rheolef
# endif // _SKIT_CSR_ALGO_APLB_H