MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
block.h
1//
2// block.h
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _math_scmat_block_h
29#define _math_scmat_block_h
30
31#include <util/state/state.h>
32
33namespace sc {
34
35class SCElementOp;
36class SCElementOp2;
37class SCElementOp3;
38
42 public:
43 int blocki, blockj;
44 public:
47 virtual ~SCMatrixBlock();
49
53 virtual SCMatrixBlock *deepcopy() const;
54
59 virtual double *dat();
60 virtual int ndat() const;
61
62 // These routines are obsolete.
63 virtual void process(SCElementOp*) = 0;
64 virtual void process(SCElementOp2*, SCMatrixBlock*) = 0;
65 virtual void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*) = 0;
66};
67
68
70 private:
71 void operator = (const SCMatrixBlockListLink&) {} // disallowed
72 SCMatrixBlock* _block;
74 public:
77 void block(SCMatrixBlock*);
78 void next(SCMatrixBlockListLink* link) { _next = link; }
79 SCMatrixBlock* block() { return _block; }
80 SCMatrixBlockListLink* next() { return _next; }
81};
82
84 private:
86 public:
87 SCMatrixBlockListIter(): link(0) {}
89 int operator !=(const SCMatrixBlockListIter p) const {
90 return link != p.link;
91 }
92 void operator ++() { link = link->next(); }
93 void operator ++(int) { link = link->next(); }
94 SCMatrixBlock* block() const { return link->block(); }
95};
96
98 private:
100 public:
105 void insert(SCMatrixBlock*);
106 void append(SCMatrixBlock*);
107 SCMatrixBlockListIter begin() { return _begin; }
108 SCMatrixBlockListIter end() { return 0; }
109 SCMatrixBlockList *deepcopy();
110};
111
112
124 public:
125 SCVectorSimpleBlock(int istart,int iend);
127 virtual ~SCVectorSimpleBlock();
129 int istart;
130 int iend;
131 double* data;
132
134
135 void process(SCElementOp*);
136 void process(SCElementOp2*, SCMatrixBlock*);
137 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
138
139 double *dat();
140 int ndat() const;
141};
142
143
155 public:
156 SCVectorSimpleSubBlock(int istart,int iend, int offset, double* data);
158 virtual ~SCVectorSimpleSubBlock();
160 int istart;
161 int iend;
162 int offset;
163 double* data;
164
165 void process(SCElementOp*);
166 void process(SCElementOp2*, SCMatrixBlock*);
167 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
168};
169
170
184 public:
185 SCMatrixRectBlock(int is, int ie, int js, int je);
187 virtual ~SCMatrixRectBlock();
189 int istart;
190 int jstart;
191 int iend;
192 int jend;
193 double* data;
194
196
197 void process(SCElementOp*);
198 void process(SCElementOp2*, SCMatrixBlock*);
199 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
200
201 double *dat();
202 int ndat() const;
203};
204
205
220 public:
221 SCMatrixRectSubBlock(int is, int ie, int istride, int js, int je,
222 double* data);
224 // does not delete the data member
225 virtual ~SCMatrixRectSubBlock();
226 // does not save the data member
228 int istart;
229 int jstart;
230 int iend;
231 int jend;
232 int istride;
233 double* data;
234
235 void process(SCElementOp*);
236 void process(SCElementOp2*, SCMatrixBlock*);
237 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
238};
239
240
254 public:
255 SCMatrixLTriBlock(int s,int e);
257 virtual ~SCMatrixLTriBlock();
259 int start;
260 int end;
261 double* data;
262
264
265 void process(SCElementOp*);
266 void process(SCElementOp2*, SCMatrixBlock*);
267 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
268
269 double *dat();
270 int ndat() const;
271};
272
273
289 public:
290 SCMatrixLTriSubBlock(int is,int ie,int js,int je,double*data);
292 // does not delete the data member
293 virtual ~SCMatrixLTriSubBlock();
294 // does not save the data member
296 int istart;
297 int iend;
298 int jstart;
299 int jend;
300 double* data;
301
302 void process(SCElementOp*);
303 void process(SCElementOp2*, SCMatrixBlock*);
304 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
305};
306
307
319 public:
320 SCMatrixDiagBlock(int istart,int iend,int jstart);
321 SCMatrixDiagBlock(int istart,int iend);
323 virtual ~SCMatrixDiagBlock();
325 int istart;
326 int jstart;
327 int iend;
328 double* data;
329
331
332 void process(SCElementOp*);
333 void process(SCElementOp2*, SCMatrixBlock*);
334 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
335
336 double *dat();
337 int ndat() const;
338};
339
340
352 public:
353 SCMatrixDiagSubBlock(int istart,int iend,int jstart, int offset,
354 double*data);
355 SCMatrixDiagSubBlock(int istart,int iend, int offset, double*data);
357 // does not delete the data member
358 virtual ~SCMatrixDiagSubBlock();
359 // does not save the data member
361 int istart;
362 int jstart;
363 int iend;
364 int offset;
365 double* data;
366
367 void process(SCElementOp*);
368 void process(SCElementOp2*, SCMatrixBlock*);
369 void process(SCElementOp3*, SCMatrixBlock*, SCMatrixBlock*);
370};
371
372
373// //////////////////////////////////////////////////////////////////
374// Classes that iterate through the blocks of a matrix.
375
380 public:
381 enum Access { Read, Write, Accum, None };
382 protected:
383 Access access_;
384 public:
387 SCMatrixSubblockIter(Access access): access_(access) {}
390 virtual void begin() = 0;
392 virtual int ready() = 0;
394 virtual void next() = 0;
396 virtual SCMatrixBlock *block() = 0;
398 Access access() const { return access_; }
399};
400
401
403 protected:
404 Ref<SCMatrixBlock> block_;
405 int ready_;
406 public:
408 void begin();
409 int ready();
410 void next();
412};
413
415 protected:
418 public:
420 void begin();
421 int ready();
422 void next();
424};
425
435
437 protected:
438 int niters_;
440 int iiter_;
441 public:
442 SCMatrixCompositeSubblockIter(Access, int niter);
446 void set_iter(int i, const Ref<SCMatrixSubblockIter> &);
447 void begin();
448 int ready();
449 void next();
451 int current_block() const { return iiter_; }
452};
453
454
456 protected:
457 int niters_;
459 public:
462 const Ref<SCMatrixSubblockIter>& = 0,
463 const Ref<SCMatrixSubblockIter>& = 0,
464 const Ref<SCMatrixSubblockIter>& = 0);
466 void begin();
467 int ready();
468 void next();
470 SCMatrixBlock *block(int i);
471};
472
473}
474
475#endif
476
477// Local Variables:
478// mode: c++
479// c-file-style: "CLJ"
480// End:
The base class for all reference counted objects.
Definition ref.h:192
A template class that maintains references counts.
Definition ref.h:361
The SCElementOp2 class is very similar to the SCElementOp class except that pairs of blocks are treat...
Definition elemop.h:159
The SCElementOp3 class is very similar to the SCElementOp class except that a triplet of blocks is tr...
Definition elemop.h:181
Objects of class SCElementOp are used to perform operations on the elements of matrices.
Definition elemop.h:94
Definition block.h:83
Definition block.h:97
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
SCMatrixBlock is the base clase for all types of blocks that comprise matrices and vectors.
Definition block.h:41
virtual double * dat()
Return a pointer to the block's data and the number of elements in the block.
virtual SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &s)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition block.h:436
int ready()
Returns nonzero if there is another block.
void next()
Proceed to the next block.
SCMatrixBlock * block()
Return the current block.
void begin()
Start at the beginning.
The SCMatrixDiagBlock describes a diagonal piece of a matrix.
Definition block.h:318
double * dat()
Return a pointer to the block's data and the number of elements in the block.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
SCMatrixBlock * deepcopy() const
Return of copy of this.
The SCMatrixDiagSubBlock describes a diagonal subblock of a matrix.
Definition block.h:351
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition block.h:455
void begin()
Start at the beginning.
void next()
Proceed to the next block.
int ready()
Returns nonzero if there is another block.
SCMatrixBlock * block()
Return the current block.
The SCMatrixLTriBlock describes a triangular piece of a matrix.
Definition block.h:253
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
double * dat()
Return a pointer to the block's data and the number of elements in the block.
SCMatrixBlock * deepcopy() const
Return of copy of this.
The SCMatrixLTriSubBlock describes a triangular subblock of a matrix.
Definition block.h:288
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition block.h:414
int ready()
Returns nonzero if there is another block.
void begin()
Start at the beginning.
void next()
Proceed to the next block.
SCMatrixBlock * block()
Return the current block.
Definition block.h:426
int ready()
Returns nonzero if there is another block.
SCMatrixBlock * block()
Return the current block.
void begin()
Start at the beginning.
void next()
Proceed to the next block.
The SCMatrixRectBlock describes a rectangular piece of a matrix.
Definition block.h:183
double * dat()
Return a pointer to the block's data and the number of elements in the block.
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
The SCMatrixRectSubBlock describes a rectangular piece of a matrix.
Definition block.h:219
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Definition block.h:402
int ready()
Returns nonzero if there is another block.
void begin()
Start at the beginning.
SCMatrixBlock * block()
Return the current block.
void next()
Proceed to the next block.
Objects of class SCMatrixSubblockIter are used to iterate through the blocks of a matrix.
Definition block.h:379
Access access() const
Return the type of Access allowed for these blocks.
Definition block.h:398
virtual void next()=0
Proceed to the next block.
virtual SCMatrixBlock * block()=0
Return the current block.
virtual int ready()=0
Returns nonzero if there is another block.
virtual void begin()=0
Start at the beginning.
SCMatrixSubblockIter(Access access)
The access variable should be one of Read, Write, Accum, and None, with the SCMatrixSubblockIter:: sc...
Definition block.h:387
The SCVectorSimpleBlock describes a piece of a vector.
Definition block.h:123
SCMatrixBlock * deepcopy() const
Return of copy of this.
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
double * dat()
Return a pointer to the block's data and the number of elements in the block.
The SCVectorSimpleSubBlock describes a subblock of a vector.
Definition block.h:154
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
Base class for objects that can save/restore state.
Definition state.h:45
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
Contains all MPQC code up to version 3.
Definition mpqcin.h:14

Generated at Wed Sep 25 2024 02:45:30 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.