MPQC  3.0.0-alpha
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 #include <util/group/message.h>
32 
33 #include <util/state/state.h>
34 #ifdef MPQC_NEW_FEATURES
35 # include <util/misc/xml.h>
36 #endif
37 #include <math/scmat/dim.h>
38 #include <math/scmat/block.h>
39 #include <iostream>
40 
41 namespace sc {
42 
43 class SCMatrix;
44 class SymmSCMatrix;
45 class DiagSCMatrix;
46 class SCVector;
47 
48 class SCElementOp;
49 class SCElementOp2;
50 class SCElementOp3;
51 
52 class RefSCDimension;
53 
57 class SCMatrixKit: public DescribedClass {
58  protected:
59  Ref<MessageGrp> grp_;
60 
61  public:
62  SCMatrixKit();
63  SCMatrixKit(const Ref<KeyVal>&);
64  ~SCMatrixKit();
65 
66  // these members are defined in repl.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  void convert(double* v) const { convert_p(v); }
139  void convert(SCVector*v) { convert_v(v); }
140  virtual void convert_p(double* v) const;
141  virtual void convert_v(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 
196 #ifdef MPQC_NEW_FEATURES
197 , public XMLWritable
198 #endif
199 {
200  protected:
201  RefSCDimension d1,d2;
202  Ref<SCMatrixKit> kit_;
203  public:
205  enum Transform { NormalTransform = 0, TransposeTransform = 1 };
206 
207  // concrete functions (some can be overridden)
209  virtual ~SCMatrix();
210 
212  virtual void save(StateOut&);
213  virtual void restore(StateIn&);
214 
215 #ifdef MPQC_NEW_FEATURES
216  virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
217 #endif
218 
220  Ref<SCMatrixKit> kit() const { return kit_; }
221 
223  int nrow() const { return d1->n(); }
225  int ncol() const { return d2->n(); }
227  virtual double maxabs() const;
229  virtual void randomize();
231  void assign(double val) { assign_val(val); }
233  void assign(const double* m) { assign_p(m); }
235  void assign(const double** m) { assign_pp(m); }
237  void assign(SCMatrix* m) { assign_r(m); }
239  virtual void assign_val(double val);
240  virtual void assign_p(const double* m);
241  virtual void assign_pp(const double** m);
242  virtual void assign_r(SCMatrix* m);
245  void convert(double*a) const { convert_p(a); }
246  void convert(double**a) const { convert_pp(a); }
247  void convert(SCMatrix*a) { convert_r(a); }
248  virtual void convert_p(double*) const;
249  virtual void convert_pp(double**) const;
250  virtual void convert_r(SCMatrix*a);
251  virtual void convert_accumulate(SCMatrix*);
253  virtual void scale(double val);
255  virtual void scale_diagonal(double val);
257  virtual void shift_diagonal(double val);
259  virtual void unit();
261  virtual SCMatrix* copy();
263  virtual SCMatrix* clone();
264 
265  // pure virtual functions
267  RefSCDimension rowdim() const { return d1; }
268  RefSCDimension coldim() const { return d2; }
270  virtual double get_element(int,int) const = 0;
271  virtual void set_element(int,int,double) = 0;
272  virtual void accumulate_element(int,int,double) = 0;
273 
277  virtual SCMatrix * get_subblock(int br, int er, int bc, int ec) =0;
278 
280  virtual void assign_subblock(SCMatrix *m, int, int, int, int, int=0, int=0) =0;
281 
283  virtual void accumulate_subblock(SCMatrix *m, int br, int er, int bc, int ec,
284  int source_br = 0, int source_bc = 0) =0;
285 
287  virtual SCVector * get_row(int i) =0;
288  virtual SCVector * get_column(int i) =0;
289 
291  virtual void assign_row(SCVector *v, int i) =0;
292  virtual void assign_column(SCVector *v, int i) =0;
293 
295  virtual void accumulate_row(SCVector *v, int i) =0;
296  virtual void accumulate_column(SCVector *v, int i) =0;
297 
299  virtual void accumulate(const SCMatrix* m) = 0;
300  virtual void accumulate(const SymmSCMatrix* m) = 0;
301  virtual void accumulate(const DiagSCMatrix* m) = 0;
302  virtual void accumulate(const SCVector*) = 0;
304  virtual void accumulate_outer_product(SCVector*,SCVector*) = 0;
305  void accumulate_product(SCMatrix*m1,SCMatrix*m2)
306  { accumulate_product_rr(m1,m2); }
307  void accumulate_product(SCMatrix*m1,SymmSCMatrix*m2)
308  { accumulate_product_rs(m1,m2); }
309  void accumulate_product(SCMatrix*m1,DiagSCMatrix*m2)
310  { accumulate_product_rd(m1,m2); }
311  void accumulate_product(SymmSCMatrix*m1,SCMatrix*m2)
312  { accumulate_product_sr(m1,m2); }
313  void accumulate_product(DiagSCMatrix*m1,SCMatrix*m2)
314  { accumulate_product_dr(m1,m2); }
315  void accumulate_product(SymmSCMatrix*m1,SymmSCMatrix*m2)
316  { accumulate_product_ss(m1,m2); }
317  void accumulate_product(SymmSCMatrix*m1,DiagSCMatrix*m2)
318  { accumulate_product_sd(m1,m2); }
319  void accumulate_product(DiagSCMatrix*m1,SymmSCMatrix*m2)
320  { accumulate_product_ds(m1,m2); }
321  virtual void accumulate_product_rr(SCMatrix*,SCMatrix*) = 0;
322  virtual void accumulate_product_rs(SCMatrix*,SymmSCMatrix*);
323  virtual void accumulate_product_rd(SCMatrix*,DiagSCMatrix*);
324  virtual void accumulate_product_sr(SymmSCMatrix*,SCMatrix*);
325  virtual void accumulate_product_dr(DiagSCMatrix*,SCMatrix*);
326  virtual void accumulate_product_ss(SymmSCMatrix*,SymmSCMatrix*);
327  virtual void accumulate_product_sd(SymmSCMatrix*,DiagSCMatrix*);
328  virtual void accumulate_product_ds(DiagSCMatrix*,SymmSCMatrix*);
330  virtual void transpose_this() = 0;
332  virtual double trace() =0;
334  virtual double invert_this() = 0;
336  virtual double determ_this() = 0;
337 
340  virtual void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V);
341  virtual double solve_this(SCVector*) = 0;
347  virtual void gen_invert_this(double condition_number_threshold = 1e8);
348 
351  virtual void schmidt_orthog(SymmSCMatrix*, int n) =0;
352 
356  virtual int schmidt_orthog_tol(SymmSCMatrix*, double tol, double*res=0)=0;
357 
359  virtual void element_op(const Ref<SCElementOp>&) = 0;
360  virtual void element_op(const Ref<SCElementOp2>&,
361  SCMatrix*) = 0;
362  virtual void element_op(const Ref<SCElementOp3>&,
363  SCMatrix*,SCMatrix*) = 0;
365  void print(std::ostream&o=ExEnv::out0()) const;
366  void print(const char* title=0,std::ostream& out=ExEnv::out0(),
367  int =10) const;
368  virtual void vprint(const char*title=0,
369  std::ostream&out=ExEnv::out0(),int =10) const = 0;
370 
372  Ref<MessageGrp> messagegrp() const;
373 
376  virtual Ref<SCMatrixSubblockIter> local_blocks(
377  SCMatrixSubblockIter::Access) = 0;
379  virtual Ref<SCMatrixSubblockIter> all_blocks(
380  SCMatrixSubblockIter::Access) = 0;
381 };
382 
386 #ifdef MPQC_NEW_FEATURES
387 , public XMLWritable
388 #endif
389 {
390  protected:
391  RefSCDimension d;
392  Ref<SCMatrixKit> kit_;
393  public:
395  ~SymmSCMatrix();
396 
398  Ref<SCMatrixKit> kit() const { return kit_; }
399 
401  virtual void save(StateOut&);
402  virtual void restore(StateIn&);
403 
404 #ifdef MPQC_NEW_FEATURES
405  virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
406 #endif
407 
409  virtual double maxabs() const;
411  virtual void randomize();
413  void assign(double val) { assign_val(val); }
415  void assign(const double* m) { assign_p(m); }
417  void assign(const double** m) { assign_pp(m); }
420  void assign(SymmSCMatrix* m) { assign_s(m); }
422  virtual void assign_val(double val);
423  virtual void assign_p(const double* m);
424  virtual void assign_pp(const double** m);
425  virtual void assign_s(SymmSCMatrix* m);
427  void convert(double*a) const { convert_p(a); }
428  void convert(double**a) const { convert_pp(a); }
429  void convert(SymmSCMatrix*a) { convert_s(a); }
430  virtual void convert_p(double*) const;
431  virtual void convert_pp(double**) const;
432  virtual void convert_s(SymmSCMatrix*);
433  virtual void convert_accumulate(SymmSCMatrix*);
435  virtual void scale(double);
437  virtual void scale_diagonal(double);
439  virtual void shift_diagonal(double);
441  virtual void unit();
443  int n() const { return d->n(); }
445  virtual SymmSCMatrix* copy();
447  virtual SymmSCMatrix* clone();
448 
449  // pure virtual functions
451  RefSCDimension dim() const { return d; }
453  virtual double get_element(int,int) const = 0;
454  virtual void set_element(int,int,double) = 0;
455  virtual void accumulate_element(int,int,double) = 0;
456 
460  virtual SCMatrix * get_subblock(int br, int er, int bc, int ec) =0;
461  virtual SymmSCMatrix * get_subblock(int br, int er) =0;
462 
464  virtual void assign_subblock(SCMatrix *m, int, int, int, int) =0;
465  virtual void assign_subblock(SymmSCMatrix *m, int, int) =0;
466 
468  virtual void accumulate_subblock(SCMatrix *m, int, int, int, int) =0;
469  virtual void accumulate_subblock(SymmSCMatrix *m, int, int) =0;
470 
472  virtual SCVector * get_row(int i) =0;
473 
475  virtual void assign_row(SCVector *v, int i) =0;
476 
478  virtual void accumulate_row(SCVector *v, int i) =0;
479 
482  virtual void diagonalize(DiagSCMatrix*d,SCMatrix*m) = 0;
487  virtual void eigensystem(SymmSCMatrix*s,DiagSCMatrix*d,SCMatrix*m) = 0;
489  virtual void accumulate(const SymmSCMatrix* m) = 0;
491  virtual void accumulate_symmetric_sum(SCMatrix* a) = 0;
493  virtual void accumulate_symmetric_product(SCMatrix* a);
494  virtual void accumulate_transform(SCMatrix*,SymmSCMatrix*,
495  SCMatrix::Transform = SCMatrix::NormalTransform);
496  virtual void accumulate_transform(SCMatrix*,DiagSCMatrix*,
497  SCMatrix::Transform = SCMatrix::NormalTransform);
498  virtual void accumulate_transform(SymmSCMatrix*,SymmSCMatrix*);
499  virtual void accumulate_symmetric_outer_product(SCVector*);
502  virtual double scalar_product(SCVector* v);
504  virtual double trace() = 0;
506  virtual double invert_this() = 0;
508  virtual double determ_this() = 0;
509 
510  virtual double solve_this(SCVector*) = 0;
512  virtual void gen_invert_this(double condition_number_threshold = 1e8) = 0;
513 
515  virtual void element_op(const Ref<SCElementOp>&) = 0;
525  virtual void element_op(const Ref<SCElementOp2>&,
526  SymmSCMatrix*) = 0;
527  virtual void element_op(const Ref<SCElementOp3>&,
528  SymmSCMatrix*,SymmSCMatrix*) = 0;
530  void print(std::ostream&o=ExEnv::out0()) const;
532  void print(const char* title=0,std::ostream& out=ExEnv::out0(),
533  int =10) const;
534  virtual void vprint(const char* title=0,
535  std::ostream& out=ExEnv::out0(), int =10) const;
536 
538  Ref<MessageGrp> messagegrp() const;
539 
543  SCMatrixSubblockIter::Access) = 0;
546  SCMatrixSubblockIter::Access) = 0;
547 };
548 
552 #ifdef MPQC_NEW_FEATURES
553 , public XMLWritable
554 #endif
555 {
556  protected:
557  RefSCDimension d;
558  Ref<SCMatrixKit> kit_;
559  public:
561  ~DiagSCMatrix();
562 
564  Ref<SCMatrixKit> kit() const { return kit_; }
565 
567  virtual void save(StateOut&);
568  virtual void restore(StateIn&);
569 
570 #ifdef MPQC_NEW_FEATURES
571  virtual boost::property_tree::ptree& write_xml(boost::property_tree::ptree& parent, const XMLWriter& writer);
572 #endif
573 
575  virtual double maxabs() const;
577  virtual void randomize();
579  void assign(double val) { assign_val(val); }
581  void assign(const double*p) { assign_p(p); }
584  void assign(DiagSCMatrix*d_a) { assign_d(d_a); }
586  virtual void assign_val(double val);
587  virtual void assign_p(const double*);
588  virtual void assign_d(DiagSCMatrix*);
590  void convert(double*a) const { convert_p(a); }
591  void convert(DiagSCMatrix*a) { convert_d(a); }
592  virtual void convert_p(double*) const;
593  virtual void convert_d(DiagSCMatrix*);
594  virtual void convert_accumulate(DiagSCMatrix*);
596  virtual void scale(double);
598  int n() const { return d->n(); }
600  virtual DiagSCMatrix* copy();
602  virtual DiagSCMatrix* clone();
603 
604  // pure virtual functions
606  RefSCDimension dim() const { return d; }
608  virtual double get_element(int) const = 0;
609  virtual void set_element(int,double) = 0;
610  virtual void accumulate_element(int,double) = 0;
612  virtual void accumulate(const DiagSCMatrix* m) = 0;
614  virtual double trace() = 0;
616  virtual double determ_this() = 0;
618  virtual double invert_this() = 0;
620  virtual void gen_invert_this(double condition_number_threshold = 1e8) = 0;
622  virtual void element_op(const Ref<SCElementOp>&) = 0;
623  virtual void element_op(const Ref<SCElementOp2>&,
624  DiagSCMatrix*) = 0;
625  virtual void element_op(const Ref<SCElementOp3>&,
626  DiagSCMatrix*,DiagSCMatrix*) = 0;
628  void print(std::ostream&o=ExEnv::out0()) const;
629  void print(const char* title=0,
630  std::ostream& out=ExEnv::out0(), int =10) const;
631  virtual void vprint(const char* title=0,
632  std::ostream& out=ExEnv::out0(), int =10) const;
633 
635  Ref<MessageGrp> messagegrp() const;
636 
640  SCMatrixSubblockIter::Access) = 0;
643  SCMatrixSubblockIter::Access) = 0;
644 };
645 
646 }
647 
648 #endif
649 
650 // Local Variables:
651 // mode: c++
652 // c-file-style: "CLJ"
653 // 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:415
sc::DiagSCMatrix::kit
Ref< SCMatrixKit > kit() const
Return the SCMatrixKit used to create this object.
Definition: abstract.h:564
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:584
sc::SCVector::maxabs
virtual double maxabs() const
Return the maximum absolute value element of this vector.
sc::SymmSCMatrix::convert
void convert(double *a) const
Like the assign members, but these write values to the arguments.
Definition: abstract.h:427
sc::SCMatrix::transpose_this
virtual void transpose_this()=0
Transpose this.
mpqc::ci::sigma
void sigma(const CI< Type, Index > &ci, const mpqc::Vector &h, const Matrix &V, ci::Vector &C, ci::Vector &S)
Computes sigma 1,2,3 contributions.
Definition: sigma.hpp:30
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:233
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:606
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::XMLWritable
Definition: xml.h:44
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:361
sc::SCMatrix::ncol
int ncol() const
Return the number of columns.
Definition: abstract.h:225
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:420
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:398
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:57
sc::SCMatrix::gen_invert_this
virtual void gen_invert_this(double condition_number_threshold=1e8)
Return the generalized inverse of this using SVD decomposition.
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:220
sc::SCMatrix::schmidt_orthog
virtual void schmidt_orthog(SymmSCMatrix *, int n)=0
Schmidt orthogonalize this.
sc::DiagSCMatrix::gen_invert_this
virtual void gen_invert_this(double condition_number_threshold=1e8)=0
Return the generalized inverse of this using SVD decomposition.
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
only applied to the unique elements 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::SymmSCMatrix::eigensystem
virtual void eigensystem(SymmSCMatrix *s, DiagSCMatrix *d, SCMatrix *m)=0
Solve generalized eigensystem for this with metric s, placing the eigenvalues in d and the eigenvecto...
sc::DiagSCMatrix
The SymmSCMatrix class is the abstract base class for diagonal double valued matrices.
Definition: abstract.h:551
sc::SCVector::set_element
virtual void set_element(int i, double val)=0
Set element i to val.
sc::SCMatrixKit::set_default_matrixkit
static void set_default_matrixkit(const Ref< SCMatrixKit > &)
change the default matrix kit
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
Definition: statein.h:79
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:152
sc::SymmSCMatrix::accumulate_symmetric_product
virtual void accumulate_symmetric_product(SCMatrix *a)
Sum into this a * a.t()
sc::SCMatrix::accumulate_subblock
virtual void accumulate_subblock(SCMatrix *m, int br, int er, int bc, int ec, int source_br=0, int source_bc=0)=0
Sum m into a subblock of this.
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::SCMatrixKit::default_matrixkit
static SCMatrixKit * default_matrixkit()
This returns the default matrix kit.
sc::SCMatrix::assign
void assign(SCMatrix *m)
Make this have the same elements as m. The dimensions must match.
Definition: abstract.h:237
sc::DiagSCMatrix::assign
void assign(const double *p)
Assign element i, i to m[i].
Definition: abstract.h:581
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:443
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:598
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:235
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:267
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
Definition: stateout.h:71
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::XMLWriter
Definition: xmlwriter.h:215
sc::DiagSCMatrix::save
virtual void save(StateOut &)
Save and restore this in an implementation independent way.
sc::DiagSCMatrix::convert
void convert(double *a) const
Like the assign member, but this writes values to the argument.
Definition: abstract.h:590
sc::SymmSCMatrix::assign
void assign(const double **m)
Assign element i, j to m[i][j].
Definition: abstract.h:417
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:385
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::SCMatrix::convert
void convert(double *a) const
Like the assign members, but these write values to the arguments.
Definition: abstract.h:245
sc::SCMatrix::Transform
Transform
types of matrix transforms. Only real-valued matrices are assumed.
Definition: abstract.h:205
sc::DescribedClass
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:233
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::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::SCVector::convert
void convert(double *v) const
Assign v[i] to element i for all i.
Definition: abstract.h:138
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:413
sc::SymmSCMatrix::accumulate_symmetric_sum
virtual void accumulate_symmetric_sum(SCMatrix *a)=0
Sum into a + a.t()
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.
mpqc::vector
Vector class derived from Eigen::Matrix with additional MPQC integration.
Definition: matrix.hpp:133
sc::SCMatrix::assign
void assign(double val)
Set all elements to val.
Definition: abstract.h:231
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::SymmSCMatrix::gen_invert_this
virtual void gen_invert_this(double condition_number_threshold=1e8)=0
Return the generalized inverse of this using SVD decomposition.
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:223
sc::SymmSCMatrix::dim
RefSCDimension dim() const
Return the dimension.
Definition: abstract.h:451
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::svd_this
virtual void svd_this(SCMatrix *U, DiagSCMatrix *sigma, SCMatrix *V)
Compute the singular value decomposition for this, possibly destroying this.
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::SymmSCMatrix::clone
virtual SymmSCMatrix * clone()
Return a matrix with the same dimension but uninitialized memory.
sc::DiagSCMatrix::assign
void assign(double val)
Set all elements to val.
Definition: abstract.h:579
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:24:00 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.