source: ThirdParty/mpqc_open/src/lib/math/scmat/scmat.dox

Candidate_v1.6.1
Last change on this file was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 12.7 KB
Line 
1
2/** \page scmat The Matrix Library
3
4The scientific computing matrix library (SCMAT) is designed around a set of
5matrix abstractions that permit very general matrix implementations. This
6flexibility is needed to support diverse computing environments. For
7example, this library must support, at a minimum: simple matrices that
8provide efficient matrix computations in a uniprocessor environment,
9clusters of processors with enough memory to store all matrices connected
10by a relatively slow network (workstations on an LAN), clusters of
11processors with enough memory to store all matrices and a fast interconnect
12network (a massively parallel machine such as the Intel Paragon), and
13clusters of machines that don't have enough memory to hold entire matrices.
14
15<ul>
16 <li> \ref scmatover
17 <li> \ref scmatdim
18 <li> \ref scmatref
19 <li> \ref scmatabstract
20 <li> \ref scmatstor
21 <li> \ref scmatop
22 <li> \ref scmatopsp
23 <li> \ref scmatlocal
24 <li> \ref scmatrepl
25 <li> \ref scmatdist
26 <li> \ref scmatblocked
27</ul>
28
29\section scmatover Overview
30
31The design of SCMAT differs from other object-oriented matrix packages in
32two important ways. First, the matrix classes are abstract base classes.
33No storage layout is defined and virtual function calls must be used to
34access individual matrix elements. This would have a negative performance
35impact if users needed to frequently access matrix elements. The interface
36to the matrix classes is hopefully rich enough to avoid individual matrix
37element access for any computationally significant task. The second major
38difference is that symmetric matrices do not inherit from matrices, etc.
39The SCMAT user must know whether a matrix is symmetric at all places it is
40used if any performance gain, by virtue of symmetry, is expected.
41
42Dimension information is contained objects of the SCDimension type. In
43addition to the simple integer dimension, application specific blocking
44information can be provided. For example, in a quantum chemistry
45application, the dimension corresponding to the atomic orbital basis set
46will have block sizes that correspond to the shells. Dimensions are used
47to create new matrix or vector objects.
48
49The primary abstract classes are SCMatrix, SymmSCMatrix, DiagSCMatrix, and
50SCVector. These represent matrices, symmetric matrices, diagonal matrices,
51and vectors, respectively. These abstract classes are specialized into
52groups of classes. For example, the locally stored matrix implementation
53specializes the abstract classes to LocalSCMatrix, LocalSymmSCMatrix,
54LocalDiagSCMatrix, LocalSCVector, LocalSCDimension, and LocalSCMatrixKit.
55These specializations are all designed to work with each other. However, a
56given specialization is incompatible with other matrix specializations. An
57attempt to multiply a local matrix by a distributed matrix would generate
58an error at runtime.
59
60Since the different groups of classes do not interoperate, some mechanism
61of creating consistent specializations is needed. This is done with
62SCMatrixKit objects. SCMatrixKit is an abstract base type which has
63specializations that correspond to each group of the matrix
64specializations. It is used to create matrices and vectors from that
65group. For example, the DistSCMatrixKit is used to create objects of type
66DistSCMatrix, DistSymmSCMatrix, DistDiagSCMatrix, and DistSCVector.
67
68The abstract matrix classes and their derivations are usually not directly
69used by SCMAT users. The most convenient classes to use are the smart
70pointer classes RefSCMatrix, RefSymmSCMatrix, RefDiagSCMatrix,
71and RefSCDimension.
72These classes respectively inherit from Ref<SCMatrix>, Ref<SymmSCMatrix>,
73Ref<DiagSCMatrix>, and Ref<SCDimension>, providing automatic memory
74management through reference counting.
75The smart pointer classes also have matrix
76operations such as operator *(), operator -(), and operator +() defined as
77members for convenience. These forward the operations to the contained
78matrix object. The smart pointer classes also simplify creation of
79matrices by providing constructors that take as arguments one or more
80RefSCDimension's and a Ref<SCMatrixKit>. These initialize the smart pointer
81to contain a new matrix with a specialization corresponding to that of the
82Ref<SCMatrixKit>. Matrix operations not provided by the smart pointer
83classes but present as member in the abstract classes can be accessed with
84operator->().
85
86If a needed matrix operation is missing, mechanisms exist to add more
87general operations. Operations which only depend on individual elements of
88matrices can be provided by specializations of the SCElementOp class.
89Sometimes we need operations on matrices with identical dimensions that
90examine each element in one matrix along with the corresponding element
91from the other matrix. This is accomplished with SCElementOp2 for two
92matrices and with SCElementOp3 for three.
93
94Other features of SCMAT include run-time type facilities and persistence.
95Castdown operations (type conversions from less to more derived objects)
96and other run-time type information are provided by the DescribedClass base
97class. Persistence is not provided by inheriting from SavableState base
98clase as is the case with many other classes in the SC class hierarchies,
99because it is necessary to save objects in an implementation independent
100manner. If a calculation checkpoints a matrix on a single processor
101machine and later is restarted on a multiprocessor machine the matrix would
102need to be restored as a different matrix specialization. This is handled
103by saving and restoring matrices' and vectors' data without reference to
104the specialization.
105
106The following include files are provided by the matrix library:
107
108<dl>
109<dt><tt>matrix.h</tt><dd>
110Usually, this is the only include file needed by users of matrices. It
111declares reference counting pointers to abstract matrices.
112
113If kit for a matrix must be created, or a member specific to an
114implementation is needed, then that implementation's header file must be
115included.
116
117<dt><tt>elemop.h</tt><dd>
118This is the next most useful include file. It defines useful
119SCElementOp, SCElementOp2, and SCElementOp3
120specializations.
121
122<dt><tt>abstract.h</tt><dd>
123This include file contains the declarations for abstract classes that
124users do not usually need to see. These include SCDimension,
125SCMatrix, SymmSCMatrix, DiagSCMatrix,
126SCMatrixKit. This file is currently included by
127matrix.h.
128
129<dt><tt>block.h</tt><dd>
130This file declares SCMatrixBlock and specializations. It
131only need be include by users implementing new SCElementOp
132specializations.
133
134<dt><tt>blkiter.h</tt><dd>
135This include file declares the implementations of
136SCMatrixBlockIter. It only need be include by users implementing
137new SCElementOp specializations.
138
139<dt><tt>vector3.h</tt><dd>
140This declares SCVector3, a lightweight vector of length three.
141
142<dt><tt>matrix3.h</tt><dd>
143This declares SCMatrix3, a lightweight matrix of dimension three by
144three. It includes vector3.h.
145
146<dt><tt>local.h</tt><dd>
147This include file is the matrix implementation for locally stored
148matrices. These are suitable for use in a uniprocessor environment. The
149LocalSCMatrixKit is the default matrix implementation returned
150by the static member SCMatrixKit::default_matrixkit.
151This file usually doesn't need to be included.
152
153<dt><tt>dist.h</tt><dd>
154This include file is the matrix implementation for distributed matrices.
155These are suitable for use in a distributed memory multiprocessor which
156does not have enough memory to hold all of the matrix elements on each
157processor. This file usually doesn't need to be included.
158
159<dt><tt>repl.h</tt><dd>
160This include file is the matrix implementation for replicated matrices.
161These are suitable for use in a distributed memory multiprocessor which
162does have enough memory to hold all of the matrix elements on each
163processor. This file usually doesn't need to be included.
164
165<dt><tt>blocked.h</tt><dd>
166This include file is the matrix implementation for blocked matrices.
167Blocked matrices store a matrix as subblocks that are matrices from another
168matrix specialization. These are used to save storage and computation time
169in quantum chemistry applications for molecules with other than \f$C_1\f$ point
170group symmetry.
171
172</dl>
173
174\section scmatdim Matrix Dimensions
175
176In addition to the simple integer dimension, objects of the SCDimension
177class contain application specific blocking information. This information
178is held in an object of class SCBlockInfo.
179
180\section scmatref Matrix Reference Classes
181
182The easiest way to use SCMAT is through the smart pointer classes
183RefSCMatrix, RefSymmSCMatrix, RefDiagSCMatrix, RefSCVector, RefSCDimension,
184and Ref<SCMatrixKit>. These are based on the Ref reference counting package
185and automatically delete matrix objects when they are no longer needed.
186These reference classes also have common operations defined as members for
187convenience. This makes it unnecessary to also use the sometimes awkward
188syntax of operator->() to manipulate the contained objects.
189
190\section scmatabstract Abstract Matrix Classes
191
192This section documents the primary abstract classes: SCMatrix,
193SymmSCMatrix, DiagSCMatrix, and SCVector, as well as the SCMatrixKit class
194which allows the programmer to generate consistent specializations of
195matrices. These represent matrices, symmetric matrices, diagonal matrices,
196and vectors, respectively.
197
198This section is primarily for implementers of new specializations
199of matrices. Users of existing matrices will be most interested
200in the matrix reference classes.
201
202\section scmatstor Matrix Storage
203
204All elements of matrices and vectors are kept in blocks. The
205choice of blocks and where they are keep is left up to each
206matrix specialization.
207
208\section scmatop Manipulating Matrix Elements with Element Operations
209
210The SCElementOp, SCElementOp2, and SCElementOp3 classes can
211be used to maniupulate matrix elements.
212
213\section scmatopsp SCElementOp Specializations
214
215Several commonly needed element operations are already coded up and
216available by including math/scmat/elemop.h. Below are descriptions
217of these classes:
218
219<dl>
220<dt>SCElementScalarProduct<dd> This SCElementOp2 computes
221the scalar product of two matrices or vectors. The result is available
222after the operation from the return value of the result() member.
223<dt>SCDestructiveElementProduct<dd> This SCElementOp2
224replaces the elements of the matrix or vector whose element_op
225member is called. The resulting values are the element by element products
226of the two matrices or vectors.
227<dt>SCElementScale<dd> This scales each element by an amount given
228in the constructor.
229<dt>SCElementRandomize<dd> This generates random elements.
230<dt>SCElementAssign<dd> Assign to each element the value passed to
231the constructor.
232<dt>SCElementSquareRoot<dd> Replace each element with its square
233root.
234<dt>SCElementInvert<dd> Replace each element by its reciprocal.
235<dt>SCElementScaleDiagonal<dd> Scales the diagonal elements of a
236matrix by the argument passed to the constructor. Use of this on a vector
237is undefined.
238<dt>SCElementShiftDiagonal<dd> Add the value passed to the
239constructor to the diagonal elements of the matrix. Use of this on a
240vector is undefined.
241<dt>SCElementMaxAbs<dd> Find the maximum absolute value element in a
242matrix or vector. The result is available as the return value of the
243<tt>result()</tt> member.
244<dt>SCElementDot<dd> The constructor for this class takes three
245arguments: SCElementDot(double**a,
246double**b, int length). The length of each vector given by
247a and b is given by length. The number of vectors in
248a is the number of rows in the matrix and the number in b is
249the number of columns. To each element in the matrix \f$m_{ij}\f$ the dot
250product of the \f$a_i\f$ and \f$b_j\f$ is added.
251<dt>SCElementAccumulateSCMatrix<dd> This is obsolete---do not use it.
252<dt>SCElementAccumulateSymmSCMatrix<dd> This is obsolete---do not
253use it.
254<dt>SCElementAccumulateDiagSCMatrix<dd> This is obsolete---do not
255use it.
256<dt>SCElementAccumulateSCVector<dd> This is obsolete---do not use
257it.
258</dl>
259
260\section scmatlocal Local Matrices
261
262Local matrices do no communication. All elements reside on each node
263and all computations are duplicated on each node.
264
265\section scmatrepl Replicated Matrices
266
267Replicated matrices hold all of the elements on each node, however
268do some communications in order to reduce computation time.
269
270\section scmatdist Distributed Matrices
271
272Distributed matrices spread the elements across all the nodes and
273thus require less storage than local matrices however these use
274more communications than replicated matrices.
275
276\section scmatblocked Blocked Matrices
277
278Blocked matrices are used to implement point group symmetry. Another
279matrix specialization is used to hold the diagonal subblocks of a
280matrix. The offdiagonal subblocks are known to be zero and not stored.
281This results in considerable savings in storage and computation for
282those cases where it applies.
283
284*/
Note: See TracBrowser for help on using the repository browser.