32#ifndef _math_scmat_dist_h
33#define _math_scmat_dist_h
35#include <util/group/message.h>
36#include <util/group/mstate.h>
38#include <math/scmat/block.h>
39#include <math/scmat/matrix.h>
40#include <math/scmat/abstract.h>
46class DistSCMatrixKit:
public SCMatrixKit {
58class DistSCVector:
public SCVector {
59 friend class DistSCMatrix;
60 friend class DistSymmSCMatrix;
61 friend class DistDiagSCMatrix;
65 void init_blocklist();
66 double *find_element(
int i)
const;
67 int element_to_node(
int i)
const;
68 int block_to_node(
int)
const;
70 void error(
const char *);
74 void assign_p(
const double*);
75 void assign_v(SCVector*a);
85 void accumulate_product_rv(
SCMatrix *, SCVector *);
91 void vprint(
const char* title=0,
100class DistSCMatrix:
public SCMatrix {
101 friend class DistSymmSCMatrix;
102 friend class DistDiagSCMatrix;
103 friend class DistSCVector;
112 void init_blocklist();
113 void error(
const char *);
114 double *find_element(
int i,
int j)
const;
115 int element_to_node(
int i,
int j)
const;
116 int block_to_node(
int,
int)
const;
121 enum VecOp {CopyFromVec, CopyToVec, AccumFromVec, AccumToVec};
122 enum Form { Row, Col } form;
123 void create_vecform(Form,
int nvec = -1);
124 void delete_vecform();
125 void vecform_op(VecOp op,
int *ivec = 0);
134 void set_element(
int,
int,
double);
135 void accumulate_element(
int,
int,
double);
142 void assign_column(
SCVector *v,
int i);
144 void accumulate_column(
SCVector *v,
int i);
147 void accumulate_product_rr(SCMatrix*,SCMatrix*);
157 void gen_invert_this();
164 SCMatrix*,SCMatrix*);
165 void vprint(
const char* title=0,
167 void vprint(
const char* title=0,
176class DistSymmSCMatrix:
public SymmSCMatrix {
177 friend class DistSCMatrix;
178 friend class DistDiagSCMatrix;
179 friend class DistSCVector;
184 void init_blocklist();
185 double *find_element(
int i,
int j)
const;
186 int element_to_node(
int i,
int j)
const;
187 int block_to_node(
int,
int)
const;
190 void error(
const char *msg);
197 void set_element(
int,
int,
double);
198 void accumulate_element(
int,
int,
double);
216 void gen_invert_this();
224 SymmSCMatrix*,SymmSCMatrix*);
226 virtual void convert_accumulate(SymmSCMatrix*);
234class DistDiagSCMatrix:
public DiagSCMatrix {
235 friend class DistSCMatrix;
236 friend class DistSymmSCMatrix;
237 friend class DistSCVector;
241 void init_blocklist();
242 double *find_element(
int i)
const;
243 int element_to_node(
int i)
const;
244 int block_to_node(
int)
const;
246 void error(
const char *msg);
253 void set_element(
int,
double);
254 void accumulate_element(
int,
double);
265 DiagSCMatrix*,DiagSCMatrix*);
273class DistSCMatrixListSubblockIter:
public SCMatrixListSubblockIter {
281 void maybe_advance_list();
284 DistSCMatrixListSubblockIter(Access,
289 ~DistSCMatrixListSubblockIter();
The SymmSCMatrix class is the abstract base class for diagonal double valued matrices.
Definition abstract.h:503
double trace()
Return the trace.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
double invert_this()
Invert this.
double get_element(int) const
Return or modify an element.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
double determ_this()
Return the determinant of this. this is overwritten.
void gen_invert_this()
Do a generalized inversion of this.
void accumulate(const DiagSCMatrix *)
Sum m into this.
The DistSCMatrixKit produces matrices that work in a many processor environment.
Definition dist.h:46
SCMatrix * matrix(const RefSCDimension &, const RefSCDimension &)
Given the dimensions, create matrices or vectors.
void begin()
Start at the beginning.
void next()
Proceed to the next block.
SCMatrix * get_subblock(int, int, int, int)
Return a subblock of this.
void transpose_this()
Transpose this.
double get_element(int, int) const
Return or modify an element.
void assign_row(SCVector *v, int i)
Assign v to a row or column of this.
void schmidt_orthog(SymmSCMatrix *, int)
Schmidt orthogonalize this.
int schmidt_orthog_tol(SymmSCMatrix *, double tol, double *res=0)
Schmidt orthogonalize this.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void assign_subblock(SCMatrix *, int, int, int, int, int=0, int=0)
Assign m to a subblock of this.
void accumulate(const SCMatrix *)
Sum m into this.
SCVector * get_row(int i)
Return a row or column of this.
void accumulate_subblock(SCMatrix *, int, int, int, int, int=0, int=0)
Sum m into a subblock of this.
double determ_this()
Return the determinant of this. this is overwritten.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
void accumulate_row(SCVector *v, int i)
Sum v to a row or column of this.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
double invert_this()
Invert this.
void accumulate_outer_product(SCVector *, SCVector *)
Sum into this the products of various vectors or matrices.
double trace()
Return the trace.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this vector.
void convert(SCVector *)
Convert an SCVector of a different specialization to this specialization and possibly accumulate the ...
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void convert(double *v) const
Assign v[i] to element i for all i.
void accumulate(const SCMatrix *m)
Sum m into this. One of m's dimensions must be 1.
void set_element(int, double)
Set element i to val.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this vector.
double scalar_product(SCVector *)
Return the dot product.
void accumulate(const SCVector *)
Sum v into this.
void accumulate_element(int, double)
Add val to element i.
double get_element(int) const
Return the value of element i.
double get_element(int, int) const
Return or modify an element.
double invert_this()
Invert this.
void accumulate_subblock(SCMatrix *, int, int, int, int)
Sum m into a subblock of this.
void diagonalize(DiagSCMatrix *, SCMatrix *)
Diagonalize this, placing the eigenvalues in d and the eigenvectors in m.
SCMatrix * get_subblock(int, int, int, int)
Return a subblock of this.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void accumulate(const SymmSCMatrix *)
Sum m into this.
void assign_subblock(SCMatrix *, int, int, int, int)
Assign m to a subblock of this.
void accumulate_row(SCVector *v, int i)
Sum v to a row of this.
double trace()
Return the trace.
SCVector * get_row(int i)
Return a row of this.
void assign_row(SCVector *v, int i)
Assign v to a row of this.
void accumulate_symmetric_sum(SCMatrix *)
Sum into this the products of various vectors or matrices.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
double determ_this()
Return the determinant of this. this is overwritten.
static std::ostream & out0()
Return an ostream that writes from node 0.
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:156
A template class that maintains references counts.
Definition ref.h:332
The SCMatrix class is the abstract base class for general double valued n by m matrices.
Definition abstract.h:195
The SCVector class is the abstract base class for double valued vectors.
Definition abstract.h:97
StateRecv is a concrete specialization of MsgStateRecv that does the receive part of point to point c...
Definition mstate.h:178
StateSend is a concrete specialization of MsgStateSend that does the send part of point to point comm...
Definition mstate.h:157
The SymmSCMatrix class is the abstract base class for symmetric double valued matrices.
Definition abstract.h:364