This file is indexed.

/usr/include/sc/math/scmat/block.h is in libsc-dev 2.3.1-16.

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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
//
// block.h
//
// Copyright (C) 1996 Limit Point Systems, Inc.
//
// Author: Curtis Janssen <cljanss@limitpt.com>
// Maintainer: LPS
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit 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 Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//

#ifndef _math_scmat_block_h
#define _math_scmat_block_h

#ifdef __GNUC__
#pragma interface
#endif

#include <util/state/state.h>

namespace sc {

class SCElementOp;
class SCElementOp2;
class SCElementOp3;

/** SCMatrixBlock is the base clase for all types of blocks
    that comprise matrices and vectors. */
class SCMatrixBlock: public SavableState {
  public:
    int blocki, blockj;
  public:
    SCMatrixBlock();
    SCMatrixBlock(StateIn&s);
    virtual ~SCMatrixBlock();
    void save_data_state(StateOut&s);

    /** Return of copy of this.  A runtime error will be generated
        for blocks that cannot do a deepcopy.  These routines are only used
        internally in the matrix library. */
    virtual SCMatrixBlock *deepcopy() const;

    /** Return a pointer to the block's data and the number of elements
        in the block.  Some blocks cannot provide this information and
        a runtime error will be generated if these members are called.
        These routines are only used internally in the matrix library. */
    virtual double *dat();
    virtual int ndat() const;

    // These routines are obsolete.
    virtual void process(SCElementOp*) = 0;
    virtual void process(SCElementOp2*, SCMatrixBlock*) = 0;
    virtual void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*) = 0;
};


class SCMatrixBlockListLink {
  private:
    void operator = (const SCMatrixBlockListLink&) {}  // disallowed
    SCMatrixBlock* _block;
    SCMatrixBlockListLink* _next;
  public:
    SCMatrixBlockListLink(SCMatrixBlock*, SCMatrixBlockListLink* = 0);
    ~SCMatrixBlockListLink();
    void block(SCMatrixBlock*);
    void next(SCMatrixBlockListLink* link) { _next = link; }
    SCMatrixBlock* block() { return _block; }
    SCMatrixBlockListLink* next() { return _next; }
};

class SCMatrixBlockListIter {
  private:
    SCMatrixBlockListLink* link;
  public:
    SCMatrixBlockListIter(): link(0) {}
    SCMatrixBlockListIter(SCMatrixBlockListLink*l): link(l) {}
    int operator !=(const SCMatrixBlockListIter p) const {
        return link != p.link;
      }
    void operator ++() { link = link->next(); }
    void operator ++(int) { link = link->next(); }
    SCMatrixBlock* block() const { return link->block(); }
};

class SCMatrixBlockList: public SavableState {
  private:
    SCMatrixBlockListLink* _begin;
  public:
    SCMatrixBlockList();
    SCMatrixBlockList(StateIn&);
    ~SCMatrixBlockList();
    void save_data_state(StateOut&);
    void insert(SCMatrixBlock*);
    void append(SCMatrixBlock*);
    SCMatrixBlockListIter begin() { return _begin; }
    SCMatrixBlockListIter end() { return 0; }
    SCMatrixBlockList *deepcopy();
};


/** The SCVectorSimpleBlock describes a piece of a
vector.  The following bit of code illustrates the data layout:
fill(double *vector, SCVectorSimpleBlock &b)
{
  int i,offset=0;
  for (i=b.istart; i<b.iend; i++,offset++) {
      vector[i] = b.data[offset];
  }
}
*/
class SCVectorSimpleBlock: public SCMatrixBlock {
  public:
    SCVectorSimpleBlock(int istart,int iend);
    SCVectorSimpleBlock(StateIn&);
    virtual ~SCVectorSimpleBlock();
    void save_data_state(StateOut&);
    int istart;
    int iend;
    double* data;

    SCMatrixBlock *deepcopy() const;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);

    double *dat();
    int ndat() const;
};


/** The SCVectorSimpleSubBlock describes a subblock of a
vector.  The following bit of code illustrates the data layout:
fill(double *vector, SCVectorSimpleSubBlock &b)
{
  int i,offset=b.offset;
  for (i=b.istart; i<b.iend; i++,offset++) {
      vector[i] = b.data[offset];
  }
}
*/
class SCVectorSimpleSubBlock: public SCMatrixBlock {
  public:
    SCVectorSimpleSubBlock(int istart,int iend, int offset, double* data);
    SCVectorSimpleSubBlock(StateIn&);
    virtual ~SCVectorSimpleSubBlock();
    void save_data_state(StateOut&);
    int istart;
    int iend;
    int offset;
    double* data;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
};


/** The SCMatrixRectBlock describes a rectangular piece of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixRectBlock &b)
{
  int offset=0;
  for (int i=b.istart; i<b.iend; i++) {
    for (int j=b.jstart; j<b.jend; j++,offset++) {
      matrix[i][j] = b.data[offset];
    }
  }
}
*/
class SCMatrixRectBlock: public SCMatrixBlock {
  public:
    SCMatrixRectBlock(int is, int ie, int js, int je);
    SCMatrixRectBlock(StateIn&);
    virtual ~SCMatrixRectBlock();
    void save_data_state(StateOut&);
    int istart;
    int jstart;
    int iend;
    int jend;
    double* data;

    SCMatrixBlock *deepcopy() const;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);

    double *dat();
    int ndat() const;
};


/** The SCMatrixRectSubBlock describes a rectangular piece of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixRectSubBlock &b)
{
  int offset=b.istart * b.istride + b.jstart;
  for (int i=b.istart; i<b.iend; i++) {
    for (int j=b.jstart; j<b.jend; j++,offset++) {
      matrix[i][j] = b.data[offset];
    }
  offset += b.istride - (b.jend - b.jstart);
  }
}
*/
class SCMatrixRectSubBlock: public SCMatrixBlock {
  public:
    SCMatrixRectSubBlock(int is, int ie, int istride, int js, int je,
                         double* data);
    SCMatrixRectSubBlock(StateIn&);
    // does not delete the data member
    virtual ~SCMatrixRectSubBlock();
    // does not save the data member
    void save_data_state(StateOut&);
    int istart;
    int jstart;
    int iend;
    int jend;
    int istride;
    double* data;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
};


/** The SCMatrixLTriBlock describes a triangular piece of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixLTriBlock &b)
{
  int offset=0;
  for (int i=b.start; i<b.end; i++) {
    for (int j=b.start; j<=i; j++,offset++) {
      matrix[i][j] = b.data[offset];
    }
  }
}
*/
class SCMatrixLTriBlock: public SCMatrixBlock {
  public:
    SCMatrixLTriBlock(int s,int e);
    SCMatrixLTriBlock(StateIn&);
    virtual ~SCMatrixLTriBlock();
    void save_data_state(StateOut&);
    int start;
    int end;
    double* data;

    SCMatrixBlock *deepcopy() const;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);

    double *dat();
    int ndat() const;
};


/** The SCMatrixLTriSubBlock describes a triangular subblock of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixLTriSubBlock &b)
{
  int offset=(b.istart*(b.istart+1)>>1) + b.jstart;
  for (int i=b.start; i<b.end; i++) {
    for (int j=b.start; j<=i && j<b.jend; j++,offset++) {
      matrix[i][j] = b.data[offset];
    }
  if (j>i) offset += b.istart;
  else offset += i + b.jstart - b.jend;
  }
}
*/
class SCMatrixLTriSubBlock: public SCMatrixBlock {
  public:
    SCMatrixLTriSubBlock(int is,int ie,int js,int je,double*data);
    SCMatrixLTriSubBlock(StateIn&);
    // does not delete the data member
    virtual ~SCMatrixLTriSubBlock();
    // does not save the data member
    void save_data_state(StateOut&);
    int istart;
    int iend;
    int jstart;
    int jend;
    double* data;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
};


/** The SCMatrixDiagBlock describes a diagonal piece of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixDiagBlock &b)
{
  int i,j,offset=0;
  for (i=b.istart,j=b.jstart; i<b.iend; i++,j++,offset++) {
      matrix[i][j] = b.data[offset];
  }
}
*/
class SCMatrixDiagBlock: public SCMatrixBlock {
  public:
    SCMatrixDiagBlock(int istart,int iend,int jstart);
    SCMatrixDiagBlock(int istart,int iend);
    SCMatrixDiagBlock(StateIn&);
    virtual ~SCMatrixDiagBlock();
    void save_data_state(StateOut&);
    int istart;
    int jstart;
    int iend;
    double* data;

    SCMatrixBlock *deepcopy() const;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);

    double *dat();
    int ndat() const;
};


/** The SCMatrixDiagSubBlock describes a diagonal subblock of a
matrix.  The following bit of code illustrates the data layout:
fill(double **matrix, SCMatrixDiagSubBlock &b)
{
  int i,j,offset=b.offset;
  for (i=b.istart,j=b.jstart; i<b.iend; i++,j++,offset++) {
      matrix[i][j] = b.data[offset];
  }
}
*/
class SCMatrixDiagSubBlock: public SCMatrixBlock {
  public:
    SCMatrixDiagSubBlock(int istart,int iend,int jstart, int offset,
                         double*data);
    SCMatrixDiagSubBlock(int istart,int iend, int offset, double*data);
    SCMatrixDiagSubBlock(StateIn&);
    // does not delete the data member
    virtual ~SCMatrixDiagSubBlock();
    // does not save the data member
    void save_data_state(StateOut&);
    int istart;
    int jstart;
    int iend;
    int offset;
    double* data;

    void process(SCElementOp*);
    void process(SCElementOp2*, SCMatrixBlock*);
    void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
};


// //////////////////////////////////////////////////////////////////
// Classes that iterate through the blocks of a matrix.

/** Objects of class SCMatrixSubblockIter are used to iterate through the
    blocks of a matrix.  The object must be deleted before using the matrix
    that owns the blocks that SCMatrixSubblockIter is iterating through. */
class SCMatrixSubblockIter: public RefCount {
  public:
    enum Access { Read, Write, Accum, None };
  protected:
    Access access_;
  public:
    /** The access variable should be one of Read, Write, Accum, and None,
        with the SCMatrixSubblockIter:: scope operator applied. */
    SCMatrixSubblockIter(Access access): access_(access) {}
    ~SCMatrixSubblockIter();
    /// Start at the beginning.
    virtual void begin() = 0;
    /// Returns nonzero if there is another block.
    virtual int ready() = 0;
    /// Proceed to the next block.
    virtual void next() = 0;
    /// Return the current block.
    virtual SCMatrixBlock *block() = 0;
    /// Return the type of Access allowed for these blocks.
    Access access() const { return access_; }
};


class SCMatrixSimpleSubblockIter: public SCMatrixSubblockIter {
  protected:
    Ref<SCMatrixBlock> block_;
    int ready_;
  public:
    SCMatrixSimpleSubblockIter(Access, const Ref<SCMatrixBlock> &b);
    void begin();
    int ready();
    void next();
    SCMatrixBlock *block();
};

class SCMatrixListSubblockIter: public SCMatrixSubblockIter {
  protected:
    Ref<SCMatrixBlockList> list_;
    SCMatrixBlockListIter iter_;
  public:
    SCMatrixListSubblockIter(Access, const Ref<SCMatrixBlockList> &list);
    void begin();
    int ready();
    void next();
    SCMatrixBlock *block();
};

class SCMatrixNullSubblockIter: public SCMatrixSubblockIter {
  public:
    SCMatrixNullSubblockIter();
    SCMatrixNullSubblockIter(Access);
    void begin();
    int ready();
    void next();
    SCMatrixBlock *block();
};

class SCMatrixCompositeSubblockIter: public SCMatrixSubblockIter {
  protected:
    int niters_;
    Ref<SCMatrixSubblockIter> *iters_;
    int iiter_;
  public:
    SCMatrixCompositeSubblockIter(Access, int niter);
    SCMatrixCompositeSubblockIter(Ref<SCMatrixSubblockIter>&,
                                  Ref<SCMatrixSubblockIter>&);
    ~SCMatrixCompositeSubblockIter();
    void set_iter(int i, const Ref<SCMatrixSubblockIter> &);
    void begin();
    int ready();
    void next();
    SCMatrixBlock *block();
    int current_block() const { return iiter_; }
};


class SCMatrixJointSubblockIter: public SCMatrixSubblockIter {
  protected:
    int niters_;
    Ref<SCMatrixSubblockIter> *iters_;
  public:
    SCMatrixJointSubblockIter(const Ref<SCMatrixSubblockIter>&,
                              const Ref<SCMatrixSubblockIter>&,
                              const Ref<SCMatrixSubblockIter>& = 0,
                              const Ref<SCMatrixSubblockIter>& = 0,
                              const Ref<SCMatrixSubblockIter>& = 0);
    ~SCMatrixJointSubblockIter();
    void begin();
    int ready();
    void next();
    SCMatrixBlock *block();
    SCMatrixBlock *block(int i);
};

}

#endif

// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: