32#ifndef _math_scmat_blocked_h
33#define _math_scmat_blocked_h
35#include <math/scmat/block.h>
36#include <math/scmat/elemop.h>
37#include <math/scmat/matrix.h>
38#include <math/scmat/abstract.h>
48class BlockedSCMatrixKit:
public SCMatrixKit {
54 ~BlockedSCMatrixKit();
64class BlockedSCVector:
public SCVector {
65 friend class BlockedSCMatrix;
66 friend class BlockedSymmSCMatrix;
67 friend class BlockedDiagSCMatrix;
83 void assign_v(SCVector*);
84 void assign_p(
const double*);
90 void accumulate_product_rv(
SCMatrix*,SCVector*);
101 SCVector*,SCVector*);
102 void vprint(
const char* title=0,
115class BlockedSCMatrix:
public SCMatrix {
116 friend class BlockedSymmSCMatrix;
117 friend class BlockedDiagSCMatrix;
118 friend class BlockedSCVector;
137 void set_element(
int,
int,
double);
138 void accumulate_element(
int,
int,
double);
147 void assign_column(
SCVector *v,
int i);
149 void accumulate_column(
SCVector *v,
int i);
152 void accumulate_product_rr(SCMatrix*,SCMatrix*);
166 void gen_invert_this();
174 SCMatrix*,SCMatrix*);
176 void vprint(
const char* title=0,
182 RefSCDimension
rowdim(
int)
const;
183 RefSCDimension coldim(
int)
const;
185 RefSCMatrix block(
int);
191class BlockedSymmSCMatrix:
public SymmSCMatrix {
192 friend class BlockedSCMatrix;
193 friend class BlockedDiagSCMatrix;
194 friend class BlockedSCVector;
203 ~BlockedSymmSCMatrix();
210 void set_element(
int,
int,
double);
211 void accumulate_element(
int,
int,
double);
214 void assign_s(SymmSCMatrix*m);
230 void gen_invert_this();
236 void accumulate_symmetric_outer_product(
SCVector*);
237 void accumulate_symmetric_product(
SCMatrix*);
239 void accumulate_transform(
SCMatrix*,SymmSCMatrix*,
240 SCMatrix::Transform = SCMatrix::NormalTransform);
242 SCMatrix::Transform = SCMatrix::NormalTransform);
243 void accumulate_transform(SymmSCMatrix*,SymmSCMatrix*);
245 void convert_accumulate(SymmSCMatrix*a);
251 SymmSCMatrix*,SymmSCMatrix*);
253 void vprint(
const char* title=0,
266class BlockedDiagSCMatrix:
public DiagSCMatrix {
267 friend class BlockedSCMatrix;
268 friend class BlockedSymmSCMatrix;
269 friend class BlockedSCVector;
278 ~BlockedDiagSCMatrix();
285 void set_element(
int,
double);
286 void accumulate_element(
int,
double);
298 DiagSCMatrix*,DiagSCMatrix*);
299 void vprint(
const char* title=0,
312class BlockedSCElementOp :
public SCElementOp {
317 BlockedSCElementOp();
318 void working_on(
int);
319 int current_block()
const;
322class BlockedSCElementOp2 :
public SCElementOp2 {
327 BlockedSCElementOp2();
328 void working_on(
int);
329 int current_block()
const;
332class BlockedSCElementOp3 :
public SCElementOp3 {
337 BlockedSCElementOp3();
338 void working_on(
int);
339 int current_block()
const;
double get_element(int) const
Return or modify an element.
double invert_this()
Invert this.
void gen_invert_this()
Do a generalized inversion of this.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void save(StateOut &)
Save and restore this in an implementation independent way.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
double trace()
Return the trace.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
void accumulate(const DiagSCMatrix *)
Sum m into this.
double determ_this()
Return the determinant of this. this is overwritten.
SCMatrix * matrix(const RefSCDimension &, const RefSCDimension &)
Given the dimensions, create matrices or vectors.
void schmidt_orthog(SymmSCMatrix *, int)
Schmidt orthogonalize this.
void assign_subblock(SCMatrix *, int, int, int, int, int=0, int=0)
Assign m to a subblock of this.
double get_element(int, int) const
Return or modify an element.
double determ_this()
Return the determinant of this. this is overwritten.
void assign_val(double)
Overridden to implement to assign members.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
void accumulate_outer_product(SCVector *, SCVector *)
Sum into this the products of various vectors or matrices.
SCVector * get_row(int i)
Return a row or column of this.
double invert_this()
Invert this.
void accumulate_subblock(SCMatrix *, int, int, int, int, int=0, int=0)
Sum m into a subblock of this.
void transpose_this()
Transpose this.
void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V)
Compute the singular value decomposition for this, possibly destroying this.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void assign_row(SCVector *v, int i)
Assign v to a row or column of this.
double trace()
Return the trace.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
void accumulate(const SCMatrix *)
Sum m into this.
void accumulate_row(SCVector *v, int i)
Sum v to a row or column of this.
void save(StateOut &)
Save and restore this in an implementation independent way.
SCMatrix * get_subblock(int, int, int, int)
Return a subblock of this.
int schmidt_orthog_tol(SymmSCMatrix *, double tol, double *res=0)
Schmidt orthogonalize this.
double scalar_product(SCVector *)
Return the dot product.
void accumulate(const SCMatrix *)
Sum m into this. One of m's dimensions must be 1.
void assign_val(double)
Overridden to implement the assign functions.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
double get_element(int) const
Return the value of element i.
void set_element(int, double)
Set element i to val.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this vector.
void accumulate_element(int, double)
Add val to element i.
void accumulate(const SCVector *)
Sum v into this.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this vector.
void save(StateOut &)
Save and restore this in an implementation independent way.
double determ_this()
Return the determinant of this. this is overwritten.
void diagonalize(DiagSCMatrix *, SCMatrix *)
Diagonalize this, placing the eigenvalues in d and the eigenvectors in m.
Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
double scalar_product(SCVector *)
Return the scalar obtained by multiplying this on the left and right by v.
void accumulate_symmetric_sum(SCMatrix *)
Sum into this the products of various vectors or matrices.
void element_op(const Ref< SCElementOp > &)
Perform the element operation op on each element of this.
void scale(double)
Multiply all elements by val.
void accumulate(const SymmSCMatrix *)
Sum m into this.
void assign_subblock(SCMatrix *, int, int, int, int)
Assign m to a subblock of this.
SCMatrix * get_subblock(int, int, int, int)
Return a subblock of this.
void assign_val(double)
Overridden to implement the assign functions.
void save(StateOut &)
Save and restore this in an implementation independent way.
double invert_this()
Invert this.
Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)
Returns iterators for the all blocks used in this matrix.
void accumulate_subblock(SCMatrix *, int, int, int, int)
Sum m into a subblock of this.
double get_element(int, int) const
Return or modify an element.
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_row(SCVector *v, int i)
Sum v to a row of this.
double trace()
Return the trace.
The SymmSCMatrix class is the abstract base class for diagonal double valued matrices.
Definition abstract.h:503
RefSCDimension dim() const
Return the dimension.
Definition abstract.h:550
static std::ostream & out0()
Return an ostream that writes from node 0.
The RefDiagSCMatrix class is a smart pointer to an DiagSCMatrix specialization.
Definition matrix.h:380
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition dim.h:156
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
The RefSCVector class is a smart pointer to an SCVector specialization.
Definition matrix.h:55
The RefSymmSCMatrix class is a smart pointer to an SCSymmSCMatrix specialization.
Definition matrix.h:261
A template class that maintains references counts.
Definition ref.h:332
The SCDimension class is used to determine the size and blocking of matrices.
Definition dim.h:109
The SCMatrix class is the abstract base class for general double valued n by m matrices.
Definition abstract.h:195
RefSCDimension rowdim() const
Return the row or column dimension.
Definition abstract.h:258
The SCVector class is the abstract base class for double valued vectors.
Definition abstract.h:97
RefSCDimension dim() const
Return the RefSCDimension corresponding to this vector.
Definition abstract.h:147
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61
The SymmSCMatrix class is the abstract base class for symmetric double valued matrices.
Definition abstract.h:364
RefSCDimension dim() const
Return the dimension.
Definition abstract.h:420