source: ThirdParty/mpqc_open/src/lib/math/scmat/NOTES@ b7e5b0

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since b7e5b0 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: 5.7 KB
Line 
1
2Covariant type conformance is used in member functions. This is
3indicated with the "current" type which is the type of the
4overriding class. Note that current might not be exactly the same
5type. It might be a implementation of a diagonal matrix corresponding
6to current, for example.
7
8Matrix multiplication is a bit of a mess because of the way the different
9types of matrices get involved. Say G=general, S=symmetric, and D=diagonal,
10then we get the following possible mxm accumulation routines: G+=G*G, G+=S*S,
11D+=D*D, G+=D*D, G+=G*S, G+=S*G, G+=G*D, G+=D*G, G+=S*D, G+=D*S, and S+=Sa*Sb
12if [Sa,Sb] = 0 (I use accumulation routines so storage isn't allocated
13unnecessarily where it isn't needed). Not all of these will be implemented
14in a given matrix implementation, so, unfortunately, there can be runtime
15type errors.
16
17The various accumulation routines are G+=G, G+=S, G+=D, S+=S, S+=D, and D+=D.
18
19Generic operations on matrices are done with the following:
20A->element_op(op)
21 For all elements in A do op.
22
23A->matrix_op(B,op)
24 For all elements in A
25 For all elements in B
26 do op.
27
28A->matrix_pair_op(B,C,D,op)
29 For all elements in (A,B)
30 For all elements in (C,D)
31 do op.
32(A and B must have exactly the same dimensions as well as C and D.)
33
34// Abstract class
35SCDimension
36 Specifies storage information for a dimension. Each matrix implementation
37 has a corresponding SCDimension implementation.
38
39 // abstract
40 virtual int dim()
41 The integer dimension is returned.
42 virtual corresponding_matrix_type create_matrix(SCDimension a)
43 A matrix is created with this as the rowdim and a as the coldim.
44 virtual corresponding_matrix_type create_symmmatrix()
45 A symmetric matrix is created with this as rowdim and coldim.
46 virtual corresponding_matrix_type create_diagmatrix()
47 A diagonal matrix is created with this as rowdim and coldim.
48 virtual corresponding_vector_type create_vector()
49 A diagonal matrix is created with this as dim.
50
51// Abstract class
52SCMatrix
53
54 // concrete:
55 CTOR()
56 current i()
57 Returns the inverse of this.
58 current t()
59 Returns the transpose of this.
60 current operator*(current a)
61 Returns this * a.
62 current operator+(current a)
63 Returns this + a.
64 current operator-(current a)
65 Returns this - a.
66 int nrow()
67 The number of rows in the matrix.
68 int ncol()
69 The number of columns in the matrix.
70 current clone()
71 Returns an identical matrix with uninitialized elements.
72 void scale(double a)
73 Scales all of the elements in this by a.
74 current assign(double a)
75 Assigns all of the elements to a;
76 void copy(current a)
77 Copy a to this. The dimensions must be the same. This is not
78 operator=(current), because operator=(current) has a different
79 meaning in the reference counting classes.
80 SCdouble operator()(int,int)
81 This lets users do things like a(1,1) = x; x = a(1,1);. Note that
82 printf("%f",(something of type SCdouble)) won't work, because
83 SCdouble can't be passed though '...'.
84
85 // abstract:
86 SCDimension rowdim()
87 The row dimension of the matrix.
88 SCDimension coldim()
89 The column dimension of the matrix.
90 double get_element(int,int)
91 Get the value of a matrix element.
92 void set_element(int,int,double)
93 Set the value of a matrix element.
94 current multiply_and_accumulate(current a, current b)
95 Performs the operation this += a * b. Returns this.
96 void accumulate(current a)
97 Performs this += a.
98 current transpose_this()
99 Transposes and returns this.
100 current invert_this()
101 Inverts and returns this.
102 void element_op(RefSCElementOp)
103 Performs some operation on each element of the matrix.
104 The member functions for all SCMatrixElementOp's must be available
105 on the node programs in a parallel environment.
106 void resize(SCDimension,SCDimension)
107 Resize this.
108
109// These are abstract classes which inherits virtually from SCMatrix.
110// Specializations of SCMatrix which are diagonal or symmetric should
111// inherit form the appropiate class. The inheritance hierarchy could
112// take on one of the following forms:
113// Single inheritance:
114// SCMatrix
115// | \
116// | SymmSCMatrix
117// SpecSCMatrix | \
118// | DiagSCMatrix
119// SpecSymmSCMatrix |
120// |
121// SpecDiagSCMatrix
122// Multiple inheritance:
123// SCMatrix
124// | \
125// | SymmSCMatrix
126// SpecSCMatrix | \
127// | | DiagSCMatrix
128// SpecSymmSCMatrix |
129// | |
130// SpecDiagSCMatrix
131//
132
133// Abstract class
134SymmSCMatrix: virtual SCMatrix
135 // concrete
136 CTOR()
137 implementations of rowdim and coldim
138 implement rowcol_clone(DimSpec rowdim,current colmatrix,DimSpec coldim)
139 override t(), i(), etc
140
141 // abstract
142 int ndim()
143 returns the integer dimension
144 SCDimension dim()
145 returns the dimension
146
147// Abstract class
148DiagSCMatrix: virtual SymmSCMatrix
149
150// Concrete class
151LocalSCMatrix: SCMatrix
152 // concrete:
153 CTOR(int,int)
154 implementations of all of SCMatrix's abstract functions
155
156// Concrete class
157LocalSymmSCMatrix: SymmSCMatrix
158 // concrete:
159 CTOR(int,int)
160 implementations of all of SCMatrix's abstract functions
161
162// Concrete class
163LocalDiagSCMatrix: DiagSCMatrix
164 // concrete:
165 CTOR(int,int)
166 implementations of all of SCMatrix's abstract functions
167
168// Concrete class
169DistSCMatrix: SCMatrix
170 // concrete:
171 CTOR(DistMap,DistMap)
172 implementations of all of SCMatrix's abstract functions
173
174// Concrete class
175DistSymmSCMatrix: SymmSCMatrix
176 // concrete:
177 CTOR(DistMap,DistMap)
178 implementations of all of SCMatrix's abstract functions
179
180// Concrete class
181DistDiagSCMatrix: DiagSCMatrix
182 // concrete:
183 CTOR(DistMap,DistMap)
184 implementations of all of SCMatrix's abstract functions
185
Note: See TracBrowser for help on using the repository browser.