MPQC  2.3.1
abstract.h
1 //
2 // abstract.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_abstract_h
29 #define _math_scmat_abstract_h
30 
31 #ifdef __GNUC__
32 #pragma interface
33 #endif
34 
35 #include <util/group/message.h>
36 
37 #include <util/state/state.h>
38 #include <math/scmat/dim.h>
39 #include <math/scmat/block.h>
40 #include <iostream>
41 
42 namespace sc {
43 
44 class SCMatrix;
45 class SymmSCMatrix;
46 class DiagSCMatrix;
47 class SCVector;
48 
49 class SCElementOp;
50 class SCElementOp2;
51 class SCElementOp3;
52 
53 class RefSCDimension;
54 
58 class SCMatrixKit: public DescribedClass {
59  protected:
60  Ref<MessageGrp> grp_;
61 
62  public:
63  SCMatrixKit();
64  SCMatrixKit(const Ref<KeyVal>&);
65  ~SCMatrixKit();
66 
67  // these members are default in local.cc
71  static void set_default_matrixkit(const Ref<SCMatrixKit> &);
72 
73  Ref<MessageGrp> messagegrp() const;
74 
76  virtual SCMatrix* matrix(const RefSCDimension&,const RefSCDimension&) = 0;
77  virtual SymmSCMatrix* symmmatrix(const RefSCDimension&) = 0;
78  virtual DiagSCMatrix* diagmatrix(const RefSCDimension&) = 0;
79  virtual SCVector* vector(const RefSCDimension&) = 0;
80 
84  const RefSCDimension&,
85  const RefSCDimension&);
86  SymmSCMatrix* restore_symmmatrix(StateIn&,
87  const RefSCDimension&);
88  DiagSCMatrix* restore_diagmatrix(StateIn&,
89  const RefSCDimension&);
90  SCVector* restore_vector(StateIn&,
91  const RefSCDimension&);
92 };
93 
94 
97 class SCVector: public DescribedClass {
98  protected:
100  Ref<SCMatrixKit> kit_;
101  public:
103 
105  virtual void save(StateOut&);
106  virtual void restore(StateIn&);
107 
109  Ref<SCMatrixKit> kit() const { return kit_; }
110 
111  // concrete functions (some can be overridden)
113  virtual SCVector* copy();
115  virtual SCVector* clone();
116 
117  virtual ~SCVector();
119  int n() const { return d->n(); }
121  virtual double maxabs() const;
123  virtual void normalize();
125  virtual void randomize();
127  void assign(double val) { assign_val(val); }
129  void assign(const double* v) { assign_p(v); }
132  void assign(SCVector* v) { assign_v(v); }
134  virtual void assign_val(double val);
135  virtual void assign_p(const double* v);
136  virtual void assign_v(SCVector *v);
138  virtual void convert(double* v) const;
141  virtual void convert(SCVector*);
142  virtual void convert_accumulate(SCVector*);
144  virtual void scale(double val);
145 
147  RefSCDimension dim() const { return d; }
149  virtual void set_element(int i,double val) = 0;
151  virtual void accumulate_element(int,double) = 0;
153  virtual double get_element(int i) const = 0;
156  { accumulate_product_sv(m,v); }
158  { accumulate_product_rv(m,v); }
159  virtual void accumulate_product_sv(SymmSCMatrix* m, SCVector* v);
160  virtual void accumulate_product_rv(SCMatrix* m, SCVector* v) = 0;
162  virtual void accumulate(const SCVector*v) = 0;
164  virtual void accumulate(const SCMatrix*m) = 0;
166  virtual double scalar_product(SCVector*) = 0;
168  virtual void element_op(const Ref<SCElementOp>&) = 0;
169  virtual void element_op(const Ref<SCElementOp2>&,
170  SCVector*) = 0;
171  virtual void element_op(const Ref<SCElementOp3>&,
172  SCVector*,SCVector*) = 0;
174  void print(std::ostream&o=ExEnv::out0()) const;
175  void print(const char* title=0,std::ostream&out=ExEnv::out0(),int=10) const;
176  virtual void vprint(const char*title=0,std::ostream&out=ExEnv::out0(),
177  int=10) const = 0;
178 
180  Ref<MessageGrp> messagegrp() const;
181 
186  virtual Ref<SCMatrixSubblockIter> local_blocks(
187  SCMatrixSubblockIter::Access) = 0;
189  virtual Ref<SCMatrixSubblockIter> all_blocks(SCMatrixSubblockIter::Access) = 0;
190 };
191 
195 class SCMatrix: public DescribedClass {
196  protected:
197  RefSCDimension d1,d2;
198  Ref<SCMatrixKit> kit_;
199  public:
200  // used to control transformations
201  enum Transform { NormalTransform = 0, TransposeTransform = 1 };
202 
203  // concrete functions (some can be overridden)
205  virtual ~SCMatrix();
206 
208  virtual void save(StateOut&);
209  virtual void restore(StateIn&);
210 
212  Ref<SCMatrixKit> kit() const { return kit_; }
213 
215  int nrow() const { return d1->n(); }
217  int ncol() const { return d2->n(); }
219  virtual double maxabs() const;
221  virtual void randomize();
223  void assign(double val) { assign_val(val); }
225  void assign(const double* m) { assign_p(m); }
227  void assign(const double** m) { assign_pp(m); }
229  void assign(SCMatrix* m) { assign_r(m); }
231  virtual void assign_val(double val);
232  virtual void assign_p(const double* m);
233  virtual void assign_pp(const double** m);
234  virtual void assign_r(SCMatrix* m);
237  virtual void convert(double*) const;
238  virtual void convert(double**) const;
241  virtual void convert(SCMatrix*);
242  virtual void convert_accumulate(SCMatrix*);
244  virtual void scale(double val);
246  virtual void scale_diagonal(double val);
248  virtual void shift_diagonal(double val);
250  virtual void unit();
252  virtual SCMatrix* copy();
254  virtual SCMatrix* clone();
255 
256  // pure virtual functions
258  RefSCDimension rowdim() const { return d1; }
259  RefSCDimension coldim() const { return d2; }
261  virtual double get_element(int,int) const = 0;
262  virtual void set_element(int,int,double) = 0;
263  virtual void accumulate_element(int,int,double) = 0;
264 
268  virtual SCMatrix * get_subblock(int br, int er, int bc, int ec) =0;
269 
271  virtual void assign_subblock(SCMatrix *m, int, int, int, int, int=0, int=0) =0;
272 
274  virtual void accumulate_subblock(SCMatrix *m, int, int, int, int, int=0,int=0) =0;
275 
277  virtual SCVector * get_row(int i) =0;
278  virtual SCVector * get_column(int i) =0;
279 
281  virtual void assign_row(SCVector *v, int i) =0;
282  virtual void assign_column(SCVector *v, int i) =0;
283 
285  virtual void accumulate_row(SCVector *v, int i) =0;
286  virtual void accumulate_column(SCVector *v, int i) =0;
287 
289  virtual void accumulate(const SCMatrix* m) = 0;
290  virtual void accumulate(const SymmSCMatrix* m) = 0;
291  virtual void accumulate(const DiagSCMatrix* m) = 0;
292  virtual void accumulate(const SCVector*) = 0;
294  virtual void accumulate_outer_product(SCVector*,SCVector*) = 0;
295  void accumulate_product(SCMatrix*m1,SCMatrix*m2)
296  { accumulate_product_rr(m1,m2); }
297  void accumulate_product(SCMatrix*m1,SymmSCMatrix*m2)
298  { accumulate_product_rs(m1,m2); }
299  void accumulate_product(SCMatrix*m1,DiagSCMatrix*m2)
300  { accumulate_product_rd(m1,m2); }
301  void accumulate_product(SymmSCMatrix*m1,SCMatrix*m2)
302  { accumulate_product_sr(m1,m2); }
303  void accumulate_product(DiagSCMatrix*m1,SCMatrix*m2)
304  { accumulate_product_dr(m1,m2); }
305  void accumulate_product(SymmSCMatrix*m1,SymmSCMatrix*m2)
306  { accumulate_product_ss(m1,m2); }
307  virtual void accumulate_product_rr(SCMatrix*,SCMatrix*) = 0;
308  virtual void accumulate_product_rs(SCMatrix*,SymmSCMatrix*);
309  virtual void accumulate_product_rd(SCMatrix*,DiagSCMatrix*);
310  virtual void accumulate_product_sr(SymmSCMatrix*,SCMatrix*);
311  virtual void accumulate_product_dr(DiagSCMatrix*,SCMatrix*);
312  virtual void accumulate_product_ss(SymmSCMatrix*,SymmSCMatrix*);
314  virtual void transpose_this() = 0;
316  virtual double trace() =0;
318  virtual double invert_this() = 0;
320  virtual double determ_this() = 0;
321 
324  virtual void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V);
325  virtual double solve_this(SCVector*) = 0;
326  virtual void gen_invert_this();
327 
330  virtual void schmidt_orthog(SymmSCMatrix*, int n) =0;
331 
335  virtual int schmidt_orthog_tol(SymmSCMatrix*, double tol, double*res=0)=0;
336 
338  virtual void element_op(const Ref<SCElementOp>&) = 0;
339  virtual void element_op(const Ref<SCElementOp2>&,
340  SCMatrix*) = 0;
341  virtual void element_op(const Ref<SCElementOp3>&,
342  SCMatrix*,SCMatrix*) = 0;
344  void print(std::ostream&o=ExEnv::out0()) const;
345  void print(const char* title=0,std::ostream& out=ExEnv::out0(),
346  int =10) const;
347  virtual void vprint(const char*title=0,
348  std::ostream&out=ExEnv::out0(),int =10) const = 0;
349 
351  Ref<MessageGrp> messagegrp() const;
352 
355  virtual Ref<SCMatrixSubblockIter> local_blocks(
356  SCMatrixSubblockIter::Access) = 0;
358  virtual Ref<SCMatrixSubblockIter> all_blocks(
359  SCMatrixSubblockIter::Access) = 0;
360 };
361 
365  protected:
366  RefSCDimension d;
367  Ref<SCMatrixKit> kit_;
368  public:
370  ~SymmSCMatrix();
371 
373  Ref<SCMatrixKit> kit() const { return kit_; }
374 
376  virtual void save(StateOut&);
377  virtual void restore(StateIn&);
379  virtual double maxabs() const;
381  virtual void randomize();
383  void assign(double val) { assign_val(val); }
385  void assign(const double* m) { assign_p(m); }
387  void assign(const double** m) { assign_pp(m); }
390  void assign(SymmSCMatrix* m) { assign_s(m); }
392  virtual void assign_val(double val);
393  virtual void assign_p(const double* m);
394  virtual void assign_pp(const double** m);
395  virtual void assign_s(SymmSCMatrix* m);
397  virtual void convert(double*) const;
398  virtual void convert(double**) const;
401  virtual void convert(SymmSCMatrix*);
402  virtual void convert_accumulate(SymmSCMatrix*);
404  virtual void scale(double);
406  virtual void scale_diagonal(double);
408  virtual void shift_diagonal(double);
410  virtual void unit();
412  int n() const { return d->n(); }
414  virtual SymmSCMatrix* copy();
416  virtual SymmSCMatrix* clone();
417 
418  // pure virtual functions
420  RefSCDimension dim() const { return d; }
422  virtual double get_element(int,int) const = 0;
423  virtual void set_element(int,int,double) = 0;
424  virtual void accumulate_element(int,int,double) = 0;
425 
429  virtual SCMatrix * get_subblock(int br, int er, int bc, int ec) =0;
430  virtual SymmSCMatrix * get_subblock(int br, int er) =0;
431 
433  virtual void assign_subblock(SCMatrix *m, int, int, int, int) =0;
434  virtual void assign_subblock(SymmSCMatrix *m, int, int) =0;
435 
437  virtual void accumulate_subblock(SCMatrix *m, int, int, int, int) =0;
438  virtual void accumulate_subblock(SymmSCMatrix *m, int, int) =0;
439 
441  virtual SCVector * get_row(int i) =0;
442 
444  virtual void assign_row(SCVector *v, int i) =0;
445 
447  virtual void accumulate_row(SCVector *v, int i) =0;
448 
451  virtual void diagonalize(DiagSCMatrix*d,SCMatrix*m) = 0;
453  virtual void accumulate(const SymmSCMatrix* m) = 0;
455  virtual void accumulate_symmetric_sum(SCMatrix*) = 0;
456  virtual void accumulate_symmetric_product(SCMatrix*);
457  virtual void accumulate_transform(SCMatrix*,SymmSCMatrix*,
458  SCMatrix::Transform = SCMatrix::NormalTransform);
459  virtual void accumulate_transform(SCMatrix*,DiagSCMatrix*,
460  SCMatrix::Transform = SCMatrix::NormalTransform);
461  virtual void accumulate_transform(SymmSCMatrix*,SymmSCMatrix*);
462  virtual void accumulate_symmetric_outer_product(SCVector*);
465  virtual double scalar_product(SCVector* v);
467  virtual double trace() = 0;
469  virtual double invert_this() = 0;
471  virtual double determ_this() = 0;
472 
473  virtual double solve_this(SCVector*) = 0;
474  virtual void gen_invert_this() = 0;
475 
477  virtual void element_op(const Ref<SCElementOp>&) = 0;
478  virtual void element_op(const Ref<SCElementOp2>&,
479  SymmSCMatrix*) = 0;
480  virtual void element_op(const Ref<SCElementOp3>&,
481  SymmSCMatrix*,SymmSCMatrix*) = 0;
483  void print(std::ostream&o=ExEnv::out0()) const;
484  void print(const char* title=0,std::ostream& out=ExEnv::out0(),
485  int =10) const;
486  virtual void vprint(const char* title=0,
487  std::ostream& out=ExEnv::out0(), int =10) const;
488 
490  Ref<MessageGrp> messagegrp() const;
491 
495  SCMatrixSubblockIter::Access) = 0;
498  SCMatrixSubblockIter::Access) = 0;
499 };
500 
504  protected:
505  RefSCDimension d;
506  Ref<SCMatrixKit> kit_;
507  public:
509  ~DiagSCMatrix();
510 
512  Ref<SCMatrixKit> kit() const { return kit_; }
513 
515  virtual void save(StateOut&);
516  virtual void restore(StateIn&);
517 
519  virtual double maxabs() const;
521  virtual void randomize();
523  void assign(double val) { assign_val(val); }
525  void assign(const double*p) { assign_p(p); }
528  void assign(DiagSCMatrix*d_a) { assign_d(d_a); }
530  virtual void assign_val(double val);
531  virtual void assign_p(const double*);
532  virtual void assign_d(DiagSCMatrix*);
534  virtual void convert(double*) const;
537  virtual void convert(DiagSCMatrix*);
538  virtual void convert_accumulate(DiagSCMatrix*);
540  virtual void scale(double);
542  int n() const { return d->n(); }
544  virtual DiagSCMatrix* copy();
546  virtual DiagSCMatrix* clone();
547 
548  // pure virtual functions
550  RefSCDimension dim() const { return d; }
552  virtual double get_element(int) const = 0;
553  virtual void set_element(int,double) = 0;
554  virtual void accumulate_element(int,double) = 0;
556  virtual void accumulate(const DiagSCMatrix* m) = 0;
558  virtual double trace() = 0;
560  virtual double determ_this() = 0;
562  virtual double invert_this() = 0;
564  virtual void gen_invert_this() = 0;
566  virtual void element_op(const Ref<SCElementOp>&) = 0;
567  virtual void element_op(const Ref<SCElementOp2>&,
568  DiagSCMatrix*) = 0;
569  virtual void element_op(const Ref<SCElementOp3>&,
570  DiagSCMatrix*,DiagSCMatrix*) = 0;
572  void print(std::ostream&o=ExEnv::out0()) const;
573  void print(const char* title=0,
574  std::ostream& out=ExEnv::out0(), int =10) const;
575  virtual void vprint(const char* title=0,
576  std::ostream& out=ExEnv::out0(), int =10) const;
577 
579  Ref<MessageGrp> messagegrp() const;
580 
584  SCMatrixSubblockIter::Access) = 0;
587  SCMatrixSubblockIter::Access) = 0;
588 };
589 
590 }
591 
592 #endif
593 
594 // Local Variables:
595 // mode: c++
596 // c-file-style: "CLJ"
597 // End:
sc::SCMatrix::copy
virtual SCMatrix * copy()
Return a matrix with the same dimension and same elements.
sc::SymmSCMatrix::determ_this
virtual double determ_this()=0
Return the determinant of this. this is overwritten.
sc::SymmSCMatrix::get_element
virtual double get_element(int, int) const =0
Return or modify an element.
sc::SymmSCMatrix::assign
void assign(const double *m)
Assign element i, j to m[i*(i+1)/2+j].
Definition: abstract.h:385
sc::DiagSCMatrix::kit
Ref< SCMatrixKit > kit() const
Return the SCMatrixKit used to create this object.
Definition: abstract.h:512
sc::SCMatrix::accumulate
virtual void accumulate(const SCMatrix *m)=0
Sum m into this.
sc::SymmSCMatrix::randomize
virtual void randomize()
Assign each element to a random number between -1 and 1.
sc::SymmSCMatrix::scale_diagonal
virtual void scale_diagonal(double)
Scale the diagonal elements by val.
sc::DiagSCMatrix::assign
void assign(DiagSCMatrix *d_a)
Make this have the same elements as m.
Definition: abstract.h:528
sc::SCVector::maxabs
virtual double maxabs() const
Return the maximum absolute value element of this vector.
sc::SCVector::convert
virtual void convert(double *v) const
Assign v[i] to element i for all i.
sc::SCMatrix::transpose_this
virtual void transpose_this()=0
Transpose this.
sc::DiagSCMatrix::assign_val
virtual void assign_val(double val)
Overridden to implement the assign members.
sc::SCMatrix::accumulate_outer_product
virtual void accumulate_outer_product(SCVector *, SCVector *)=0
Sum into this the products of various vectors or matrices.
sc::DiagSCMatrix::print
void print(std::ostream &o=ExEnv::out0()) const
Print out the matrix.
sc::SCMatrix::assign
void assign(const double *m)
Assign element i, j to m[ir*nrow()+j].
Definition: abstract.h:225
sc::SCVector
The SCVector class is the abstract base class for double valued vectors.
Definition: abstract.h:97
sc::DiagSCMatrix::dim
RefSCDimension dim() const
Return the dimension.
Definition: abstract.h:550
sc::SCMatrix::get_element
virtual double get_element(int, int) const =0
Return or modify an element.
sc::SCVector::local_blocks
virtual Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the local (rapidly accessible) blocks used in this vector.
sc::SCVector::all_blocks
virtual Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the all blocks used in this vector.
sc::SCVector::scale
virtual void scale(double val)
Multiply each element by val.
sc::SCMatrix::save
virtual void save(StateOut &)
Save and restore this in an implementation independent way.
sc::SCVector::save
virtual void save(StateOut &)
Save and restore this in an implementation independent way.
sc::DiagSCMatrix::randomize
virtual void randomize()
Assign each element to a random number between -1 and 1.
sc::SymmSCMatrix::scalar_product
virtual double scalar_product(SCVector *v)
Return the scalar obtained by multiplying this on the left and right by v.
sc::SymmSCMatrix::save
virtual void save(StateOut &)
Save and restore this in an implementation independent way.
sc::SCMatrixKit::matrix
virtual SCMatrix * matrix(const RefSCDimension &, const RefSCDimension &)=0
Given the dimensions, create matrices or vectors.
sc::Ref
A template class that maintains references counts.
Definition: ref.h:332
sc::SCMatrix::accumulate_subblock
virtual void accumulate_subblock(SCMatrix *m, int, int, int, int, int=0, int=0)=0
Sum m into a subblock of this.
sc::SCMatrix::ncol
int ncol() const
Return the number of columns.
Definition: abstract.h:217
sc::SCMatrix::determ_this
virtual double determ_this()=0
Return the determinant of this. this is overwritten.
sc::SymmSCMatrix::assign
void assign(SymmSCMatrix *m)
Make this have the same elements as m.
Definition: abstract.h:390
sc::SymmSCMatrix::accumulate_row
virtual void accumulate_row(SCVector *v, int i)=0
Sum v to a row of this.
sc::SymmSCMatrix::diagonalize
virtual void diagonalize(DiagSCMatrix *d, SCMatrix *m)=0
Diagonalize this, placing the eigenvalues in d and the eigenvectors in m.
sc::SymmSCMatrix::kit
Ref< SCMatrixKit > kit() const
Return the SCMatrixKit object that created this object.
Definition: abstract.h:373
sc::SCMatrix::randomize
virtual void randomize()
Assign each element to a random number between -1 and 1.
sc::SCMatrix::clone
virtual SCMatrix * clone()
Return a matrix with the same dimension but uninitialized memory.
sc::SymmSCMatrix::scale
virtual void scale(double)
Multiply all elements by val.
sc::DiagSCMatrix::copy
virtual DiagSCMatrix * copy()
Return a matrix with the same dimension and same elements.
sc::SCVector::assign_val
virtual void assign_val(double val)
Overridden to implement the assign functions.
sc::SCMatrix::invert_this
virtual double invert_this()=0
Invert this.
sc::SCMatrixKit
The SCMatrixKit abstract class acts as a factory for producing matrices.
Definition: abstract.h:58
sc::SCMatrix::print
void print(std::ostream &o=ExEnv::out0()) const
Print out the matrix.
sc::SymmSCMatrix::assign_val
virtual void assign_val(double val)
Overridden to implement the assign functions.
sc::SCMatrix::assign_val
virtual void assign_val(double val)
Overridden to implement to assign members.
sc::SCMatrix::kit
Ref< SCMatrixKit > kit() const
Return the SCMatrixKit used to create this object.
Definition: abstract.h:212
sc::SCMatrix::schmidt_orthog
virtual void schmidt_orthog(SymmSCMatrix *, int n)=0
Schmidt orthogonalize this.
sc::DiagSCMatrix::convert
virtual void convert(double *) const
Like the assign member, but this writes values to the argument.
sc::SCVector::accumulate_product
void accumulate_product(SymmSCMatrix *m, SCVector *v)
Sum the result of m times v into this.
Definition: abstract.h:155
sc::SymmSCMatrix::get_subblock
virtual SCMatrix * get_subblock(int br, int er, int bc, int ec)=0
Return a subblock of this.
sc::SymmSCMatrix::element_op
virtual void element_op(const Ref< SCElementOp > &)=0
Perform the element operation op on each element of this.
sc::SCVector::dim
RefSCDimension dim() const
Return the RefSCDimension corresponding to this vector.
Definition: abstract.h:147
sc::SymmSCMatrix::accumulate
virtual void accumulate(const SymmSCMatrix *m)=0
Sum m into this.
sc::DiagSCMatrix
The SymmSCMatrix class is the abstract base class for diagonal double valued matrices.
Definition: abstract.h:503
sc::SCVector::set_element
virtual void set_element(int i, double val)=0
Set element i to val.
sc::DiagSCMatrix::trace
virtual double trace()=0
Return the trace.
sc::SCMatrix::scale_diagonal
virtual void scale_diagonal(double val)
Scale the diagonal elements by val.
sc::SCVector::assign
void assign(const double *v)
Assign element i to v[i] for all i.
Definition: abstract.h:129
sc::StateIn
Restores objects that derive from SavableState.
Definition: statein.h:70
sc::DiagSCMatrix::element_op
virtual void element_op(const Ref< SCElementOp > &)=0
Perform the element operation op on each element of this.
sc::DiagSCMatrix::scale
virtual void scale(double)
Multiply all elements by val.
sc::RefSCDimension
The RefSCDimension class is a smart pointer to an SCDimension specialization.
Definition: dim.h:156
sc::SCMatrix::assign_subblock
virtual void assign_subblock(SCMatrix *m, int, int, int, int, int=0, int=0)=0
Assign m to a subblock of this.
sc::SymmSCMatrix::local_blocks
virtual Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
sc::SCMatrix::messagegrp
Ref< MessageGrp > messagegrp() const
Returns the message group used by the matrix kit.
sc::SCMatrix::scale
virtual void scale(double val)
Multiply all elements by val.
sc::DiagSCMatrix::messagegrp
Ref< MessageGrp > messagegrp() const
Returns the message group used by the matrix kit.
sc::SymmSCMatrix::accumulate_subblock
virtual void accumulate_subblock(SCMatrix *m, int, int, int, int)=0
Sum m into a subblock of this.
sc::SCVector::kit
Ref< SCMatrixKit > kit() const
Return the SCMatrixKit used to create this object.
Definition: abstract.h:109
sc::SymmSCMatrix::copy
virtual SymmSCMatrix * copy()
Return a matrix with the same dimension and same elements.
sc::SymmSCMatrix::accumulate_symmetric_sum
virtual void accumulate_symmetric_sum(SCMatrix *)=0
Sum into this the products of various vectors or matrices.
sc::SCMatrixKit::default_matrixkit
static SCMatrixKit * default_matrixkit()
This returns a LocalSCMatrixKit, unless the default has been changed with set_default_matrixkit.
sc::SCMatrix::assign
void assign(SCMatrix *m)
Make this have the same elements as m. The dimensions must match.
Definition: abstract.h:229
sc::DiagSCMatrix::assign
void assign(const double *p)
Assign element i, i to m[i].
Definition: abstract.h:525
sc::DiagSCMatrix::determ_this
virtual double determ_this()=0
Return the determinant of this. this is overwritten.
sc::SCMatrix::element_op
virtual void element_op(const Ref< SCElementOp > &)=0
Perform the element operation op on each element of this.
sc::SymmSCMatrix::n
int n() const
Return the dimension.
Definition: abstract.h:412
sc::SCVector::accumulate
virtual void accumulate(const SCVector *v)=0
Sum v into this.
sc::DiagSCMatrix::n
int n() const
Return the dimension.
Definition: abstract.h:542
sc::SymmSCMatrix::unit
virtual void unit()
Make this equal to the unit matrix.
sc::SCVector::randomize
virtual void randomize()
Assign each element to a random number between -1 and 1.
sc::SCVector::accumulate_element
virtual void accumulate_element(int, double)=0
Add val to element i.
sc::SCVector::assign
void assign(SCVector *v)
Make this have the same elements as v.
Definition: abstract.h:132
sc::SCMatrix::assign
void assign(const double **m)
Assign element i, j to m[i][j].
Definition: abstract.h:227
sc::SCVector::copy
virtual SCVector * copy()
Return a vector with the same dimension and same elements.
sc::SCMatrixKit::restore_matrix
SCMatrix * restore_matrix(StateIn &, const RefSCDimension &, const RefSCDimension &)
Given the dimensions and a StateIn object, restore matrices or vectors.
sc::SCMatrix::rowdim
RefSCDimension rowdim() const
Return the row or column dimension.
Definition: abstract.h:258
sc::SCVector::clone
virtual SCVector * clone()
Return a vector with the same dimension but uninitialized memory.
sc::SymmSCMatrix::assign_row
virtual void assign_row(SCVector *v, int i)=0
Assign v to a row of this.
sc::SymmSCMatrix::shift_diagonal
virtual void shift_diagonal(double)
Shift the diagonal elements by val.
sc::SCMatrix::schmidt_orthog_tol
virtual int schmidt_orthog_tol(SymmSCMatrix *, double tol, double *res=0)=0
Schmidt orthogonalize this.
sc::SCMatrix::get_subblock
virtual SCMatrix * get_subblock(int br, int er, int bc, int ec)=0
Return a subblock of this.
sc::SymmSCMatrix::invert_this
virtual double invert_this()=0
Invert this.
sc::StateOut
Serializes objects that derive from SavableState.
Definition: stateout.h:61
sc::SCVector::assign
void assign(double val)
Assign all elements of this to val.
Definition: abstract.h:127
sc::SymmSCMatrix::all_blocks
virtual Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the all blocks used in this matrix.
sc::DiagSCMatrix::save
virtual void save(StateOut &)
Save and restore this in an implementation independent way.
sc::SymmSCMatrix::assign
void assign(const double **m)
Assign element i, j to m[i][j].
Definition: abstract.h:387
sc::SymmSCMatrix::get_row
virtual SCVector * get_row(int i)=0
Return a row of this.
sc::SymmSCMatrix
The SymmSCMatrix class is the abstract base class for symmetric double valued matrices.
Definition: abstract.h:364
sc::SymmSCMatrix::print
void print(std::ostream &o=ExEnv::out0()) const
Print out the matrix.
sc::SCVector::messagegrp
Ref< MessageGrp > messagegrp() const
Returns the message group used by the matrix kit.
sc::SCMatrix::local_blocks
virtual Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the local (rapidly accessible) blocks used in this matrix.
sc::DescribedClass
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:244
sc::SCVector::normalize
virtual void normalize()
Normalize this.
sc::SCMatrix::all_blocks
virtual Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the all blocks used in this matrix.
sc::SymmSCMatrix::convert
virtual void convert(double *) const
Like the assign members, but these write values to the arguments.
sc::SCMatrix::unit
virtual void unit()
Make this equal to the unit matrix.
sc::SCVector::scalar_product
virtual double scalar_product(SCVector *)=0
Return the dot product.
sc::SymmSCMatrix::messagegrp
Ref< MessageGrp > messagegrp() const
Returns the message group used by the matrix kit.
sc::SymmSCMatrix::assign_subblock
virtual void assign_subblock(SCMatrix *m, int, int, int, int)=0
Assign m to a subblock of this.
sc::ExEnv::out0
static std::ostream & out0()
Return an ostream that writes from node 0.
sc::SCMatrix
The SCMatrix class is the abstract base class for general double valued n by m matrices.
Definition: abstract.h:195
sc::SymmSCMatrix::maxabs
virtual double maxabs() const
Return the maximum absolute value element of this vector.
sc::SCVector::element_op
virtual void element_op(const Ref< SCElementOp > &)=0
Perform the element operation op on each element of this.
sc::SymmSCMatrix::assign
void assign(double val)
Set all elements to val.
Definition: abstract.h:383
sc::DiagSCMatrix::clone
virtual DiagSCMatrix * clone()
Return a matrix with the same dimension but uninitialized memory.
sc::SCVector::print
void print(std::ostream &o=ExEnv::out0()) const
Print out the vector.
sc::DiagSCMatrix::get_element
virtual double get_element(int) const =0
Return or modify an element.
sc::SCVector::get_element
virtual double get_element(int i) const =0
Return the value of element i.
sc::SCMatrix::assign
void assign(double val)
Set all elements to val.
Definition: abstract.h:223
sc::SCMatrix::accumulate_row
virtual void accumulate_row(SCVector *v, int i)=0
Sum v to a row or column of this.
sc::SCMatrix::trace
virtual double trace()=0
Return the trace.
sc::SCMatrix::assign_row
virtual void assign_row(SCVector *v, int i)=0
Assign v to a row or column of this.
sc::SCMatrix::shift_diagonal
virtual void shift_diagonal(double val)
Shift the diagonal elements by val.
sc::DiagSCMatrix::maxabs
virtual double maxabs() const
Return the maximum absolute value element of this vector.
sc::DiagSCMatrix::all_blocks
virtual Ref< SCMatrixSubblockIter > all_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the all blocks used in this matrix.
sc::SCMatrix::nrow
int nrow() const
Return the number of rows.
Definition: abstract.h:215
sc::SymmSCMatrix::dim
RefSCDimension dim() const
Return the dimension.
Definition: abstract.h:420
sc::SCMatrix::maxabs
virtual double maxabs() const
Return the maximum absolute value element.
sc::SymmSCMatrix::trace
virtual double trace()=0
Return the trace.
sc::SCMatrix::get_row
virtual SCVector * get_row(int i)=0
Return a row or column of this.
sc::SCVector::n
int n() const
Return the length of the vector.
Definition: abstract.h:119
sc::DiagSCMatrix::invert_this
virtual double invert_this()=0
Invert this.
sc::SCMatrix::convert
virtual void convert(double *) const
Like the assign members, but these write values to the arguments.
sc::SCMatrix::svd_this
virtual void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V)
Compute the singular value decomposition for this, possibly destroying this.
sc::SymmSCMatrix::clone
virtual SymmSCMatrix * clone()
Return a matrix with the same dimension but uninitialized memory.
sc::DiagSCMatrix::gen_invert_this
virtual void gen_invert_this()=0
Do a generalized inversion of this.
sc::DiagSCMatrix::assign
void assign(double val)
Set all elements to val.
Definition: abstract.h:523
sc::DiagSCMatrix::accumulate
virtual void accumulate(const DiagSCMatrix *m)=0
Sum m into this.
sc::DiagSCMatrix::local_blocks
virtual Ref< SCMatrixSubblockIter > local_blocks(SCMatrixSubblockIter::Access)=0
Returns iterators for the local (rapidly accessible) blocks used in this matrix.

Generated at Sun Jan 26 2020 23:33:03 for MPQC 2.3.1 using the documentation package Doxygen 1.8.16.