ngsolve 6.2.2501.post16.dev1__cp313-cp313-macosx_10_15_universal2.whl → 6.2.2501.post34.dev1__cp313-cp313-macosx_10_15_universal2.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ngsolve might be problematic. Click here for more details.

Files changed (286) hide show
  1. ngsolve/webgui.py +1 -1
  2. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/METADATA +2 -2
  3. ngsolve-6.2.2501.post34.dev1.dist-info/RECORD +25 -0
  4. netgen/include/arnoldi.hpp +0 -55
  5. netgen/include/bandmatrix.hpp +0 -334
  6. netgen/include/basematrix.hpp +0 -957
  7. netgen/include/basevector.hpp +0 -1268
  8. netgen/include/bdbequations.hpp +0 -2752
  9. netgen/include/bdbintegrator.hpp +0 -1659
  10. netgen/include/bessel.hpp +0 -1064
  11. netgen/include/bilinearform.hpp +0 -963
  12. netgen/include/bla.hpp +0 -29
  13. netgen/include/blockalloc.hpp +0 -95
  14. netgen/include/blockjacobi.hpp +0 -316
  15. netgen/include/bspline.hpp +0 -114
  16. netgen/include/calcinverse.hpp +0 -141
  17. netgen/include/cg.hpp +0 -368
  18. netgen/include/chebyshev.hpp +0 -44
  19. netgen/include/cholesky.hpp +0 -720
  20. netgen/include/clapack.h +0 -7254
  21. netgen/include/code_generation.hpp +0 -296
  22. netgen/include/coefficient.hpp +0 -2006
  23. netgen/include/coefficient_impl.hpp +0 -18
  24. netgen/include/coefficient_stdmath.hpp +0 -157
  25. netgen/include/commutingAMG.hpp +0 -106
  26. netgen/include/comp.hpp +0 -79
  27. netgen/include/compatibility.hpp +0 -41
  28. netgen/include/complex_wrapper.hpp +0 -73
  29. netgen/include/compressedfespace.hpp +0 -110
  30. netgen/include/contact.hpp +0 -231
  31. netgen/include/diagonalmatrix.hpp +0 -154
  32. netgen/include/differentialoperator.hpp +0 -276
  33. netgen/include/diffop.hpp +0 -1286
  34. netgen/include/diffop_impl.hpp +0 -326
  35. netgen/include/discontinuous.hpp +0 -84
  36. netgen/include/dump.hpp +0 -949
  37. netgen/include/eigen.hpp +0 -60
  38. netgen/include/eigensystem.hpp +0 -18
  39. netgen/include/elasticity_equations.hpp +0 -595
  40. netgen/include/elementbyelement.hpp +0 -195
  41. netgen/include/elementtopology.hpp +0 -1760
  42. netgen/include/elementtransformation.hpp +0 -339
  43. netgen/include/evalfunc.hpp +0 -405
  44. netgen/include/expr.hpp +0 -1655
  45. netgen/include/facetfe.hpp +0 -175
  46. netgen/include/facetfespace.hpp +0 -178
  47. netgen/include/facethofe.hpp +0 -111
  48. netgen/include/facetsurffespace.hpp +0 -112
  49. netgen/include/fe_interfaces.hpp +0 -32
  50. netgen/include/fem.hpp +0 -87
  51. netgen/include/fesconvert.hpp +0 -14
  52. netgen/include/fespace.hpp +0 -1445
  53. netgen/include/finiteelement.hpp +0 -286
  54. netgen/include/globalinterfacespace.hpp +0 -77
  55. netgen/include/globalspace.hpp +0 -115
  56. netgen/include/gridfunction.hpp +0 -525
  57. netgen/include/h1amg.hpp +0 -41
  58. netgen/include/h1hofe.hpp +0 -188
  59. netgen/include/h1hofe_impl.hpp +0 -1262
  60. netgen/include/h1hofefo.hpp +0 -148
  61. netgen/include/h1hofefo_impl.hpp +0 -185
  62. netgen/include/h1hofespace.hpp +0 -167
  63. netgen/include/h1lofe.hpp +0 -1237
  64. netgen/include/h1lumping.hpp +0 -35
  65. netgen/include/hcurl_equations.hpp +0 -1352
  66. netgen/include/hcurlcurlfe.hpp +0 -2221
  67. netgen/include/hcurlcurlfespace.hpp +0 -78
  68. netgen/include/hcurlfe.hpp +0 -259
  69. netgen/include/hcurlfe_utils.hpp +0 -107
  70. netgen/include/hcurlhdiv_dshape.hpp +0 -857
  71. netgen/include/hcurlhdivfes.hpp +0 -308
  72. netgen/include/hcurlhofe.hpp +0 -175
  73. netgen/include/hcurlhofe_impl.hpp +0 -1871
  74. netgen/include/hcurlhofespace.hpp +0 -193
  75. netgen/include/hcurllofe.hpp +0 -1146
  76. netgen/include/hdiv_equations.hpp +0 -865
  77. netgen/include/hdivdivfe.hpp +0 -2923
  78. netgen/include/hdivdivsurfacespace.hpp +0 -76
  79. netgen/include/hdivfe.hpp +0 -206
  80. netgen/include/hdivfe_utils.hpp +0 -716
  81. netgen/include/hdivfes.hpp +0 -75
  82. netgen/include/hdivhofe.hpp +0 -447
  83. netgen/include/hdivhofe_impl.hpp +0 -1107
  84. netgen/include/hdivhofefo.hpp +0 -229
  85. netgen/include/hdivhofespace.hpp +0 -175
  86. netgen/include/hdivhosurfacefespace.hpp +0 -106
  87. netgen/include/hdivlofe.hpp +0 -773
  88. netgen/include/hidden.hpp +0 -74
  89. netgen/include/householder.hpp +0 -181
  90. netgen/include/hypre_ams_precond.hpp +0 -123
  91. netgen/include/hypre_precond.hpp +0 -73
  92. netgen/include/integrator.hpp +0 -2024
  93. netgen/include/integratorcf.hpp +0 -253
  94. netgen/include/interpolate.hpp +0 -49
  95. netgen/include/intrule.hpp +0 -2541
  96. netgen/include/irspace.hpp +0 -49
  97. netgen/include/jacobi.hpp +0 -136
  98. netgen/include/l2hofe.hpp +0 -193
  99. netgen/include/l2hofe_impl.hpp +0 -564
  100. netgen/include/l2hofefo.hpp +0 -542
  101. netgen/include/l2hofespace.hpp +0 -344
  102. netgen/include/la.hpp +0 -38
  103. netgen/include/linearform.hpp +0 -266
  104. netgen/include/matrix.hpp +0 -2140
  105. netgen/include/memusage.hpp +0 -41
  106. netgen/include/meshaccess.hpp +0 -1358
  107. netgen/include/mgpre.hpp +0 -204
  108. netgen/include/mptools.hpp +0 -2145
  109. netgen/include/multigrid.hpp +0 -42
  110. netgen/include/multivector.hpp +0 -447
  111. netgen/include/mumpsinverse.hpp +0 -187
  112. netgen/include/mycomplex.hpp +0 -361
  113. netgen/include/ng_lapack.hpp +0 -1661
  114. netgen/include/ngblas.hpp +0 -1099
  115. netgen/include/ngs_defines.hpp +0 -30
  116. netgen/include/ngs_stdcpp_include.hpp +0 -106
  117. netgen/include/ngs_utils.hpp +0 -121
  118. netgen/include/ngsobject.hpp +0 -1019
  119. netgen/include/ngsstream.hpp +0 -113
  120. netgen/include/ngstd.hpp +0 -72
  121. netgen/include/nodalhofe.hpp +0 -96
  122. netgen/include/nodalhofe_impl.hpp +0 -141
  123. netgen/include/normalfacetfe.hpp +0 -223
  124. netgen/include/normalfacetfespace.hpp +0 -98
  125. netgen/include/normalfacetsurfacefespace.hpp +0 -84
  126. netgen/include/order.hpp +0 -251
  127. netgen/include/parallel_matrices.hpp +0 -222
  128. netgen/include/paralleldofs.hpp +0 -340
  129. netgen/include/parallelngs.hpp +0 -23
  130. netgen/include/parallelvector.hpp +0 -269
  131. netgen/include/pardisoinverse.hpp +0 -200
  132. netgen/include/periodic.hpp +0 -125
  133. netgen/include/plateaufespace.hpp +0 -25
  134. netgen/include/pml.hpp +0 -275
  135. netgen/include/pmltrafo.hpp +0 -631
  136. netgen/include/postproc.hpp +0 -142
  137. netgen/include/precomp.hpp +0 -60
  138. netgen/include/preconditioner.hpp +0 -602
  139. netgen/include/prolongation.hpp +0 -235
  140. netgen/include/python_comp.hpp +0 -107
  141. netgen/include/python_fem.hpp +0 -89
  142. netgen/include/python_linalg.hpp +0 -58
  143. netgen/include/python_ngstd.hpp +0 -385
  144. netgen/include/recursive_pol.hpp +0 -4844
  145. netgen/include/recursive_pol_tet.hpp +0 -395
  146. netgen/include/recursive_pol_trig.hpp +0 -492
  147. netgen/include/reorderedfespace.hpp +0 -81
  148. netgen/include/sample_sort.hpp +0 -105
  149. netgen/include/scalarfe.hpp +0 -335
  150. netgen/include/shapefunction_utils.hpp +0 -113
  151. netgen/include/simd_complex.hpp +0 -284
  152. netgen/include/smoother.hpp +0 -253
  153. netgen/include/solve.hpp +0 -89
  154. netgen/include/sparsecholesky.hpp +0 -313
  155. netgen/include/sparsematrix.hpp +0 -1038
  156. netgen/include/sparsematrix_dyn.hpp +0 -91
  157. netgen/include/sparsematrix_impl.hpp +0 -920
  158. netgen/include/special_matrix.hpp +0 -461
  159. netgen/include/specialelement.hpp +0 -125
  160. netgen/include/statushandler.hpp +0 -33
  161. netgen/include/stringops.hpp +0 -12
  162. netgen/include/superluinverse.hpp +0 -136
  163. netgen/include/symbolicintegrator.hpp +0 -849
  164. netgen/include/symmetricmatrix.hpp +0 -144
  165. netgen/include/tangentialfacetfe.hpp +0 -224
  166. netgen/include/tangentialfacetfespace.hpp +0 -106
  167. netgen/include/tensor.hpp +0 -522
  168. netgen/include/tensorcoefficient.hpp +0 -446
  169. netgen/include/tensorproductintegrator.hpp +0 -113
  170. netgen/include/thcurlfe.hpp +0 -128
  171. netgen/include/thcurlfe_impl.hpp +0 -380
  172. netgen/include/thdivfe.hpp +0 -80
  173. netgen/include/thdivfe_impl.hpp +0 -426
  174. netgen/include/tpdiffop.hpp +0 -461
  175. netgen/include/tpfes.hpp +0 -133
  176. netgen/include/tpintrule.hpp +0 -224
  177. netgen/include/triangular.hpp +0 -465
  178. netgen/include/tscalarfe.hpp +0 -245
  179. netgen/include/tscalarfe_impl.hpp +0 -1029
  180. netgen/include/umfpackinverse.hpp +0 -148
  181. netgen/include/vector.hpp +0 -1219
  182. netgen/include/voxelcoefficientfunction.hpp +0 -41
  183. netgen/include/vtkoutput.hpp +0 -198
  184. netgen/include/vvector.hpp +0 -208
  185. netgen/include/webgui.hpp +0 -92
  186. netgen/libngbla.dylib +0 -0
  187. netgen/libngcomp.dylib +0 -0
  188. netgen/libngfem.dylib +0 -0
  189. netgen/libngla.dylib +0 -0
  190. netgen/libngsolve.dylib +0 -0
  191. netgen/libngstd.dylib +0 -0
  192. ngsolve/__init__.pyi +0 -231
  193. ngsolve/bla.pyi +0 -1139
  194. ngsolve/bvp.pyi +0 -32
  195. ngsolve/cmake/NGSolveConfig.cmake +0 -102
  196. ngsolve/cmake/ngsolve-targets-release.cmake +0 -69
  197. ngsolve/cmake/ngsolve-targets.cmake +0 -163
  198. ngsolve/comp/__init__.pyi +0 -5382
  199. ngsolve/comp/pml.pyi +0 -89
  200. ngsolve/config/__init__.py +0 -1
  201. ngsolve/config/__init__.pyi +0 -43
  202. ngsolve/config/__main__.py +0 -4
  203. ngsolve/config/config.py +0 -60
  204. ngsolve/config/config.pyi +0 -45
  205. ngsolve/demos/TensorProduct/__init__.py +0 -0
  206. ngsolve/demos/TensorProduct/tp_dg_1d_1d.py +0 -80
  207. ngsolve/demos/TensorProduct/tp_dg_1d_2d.py +0 -73
  208. ngsolve/demos/TensorProduct/tp_dg_2d_1d.py +0 -72
  209. ngsolve/demos/TensorProduct/tp_dg_2d_2d.py +0 -66
  210. ngsolve/demos/__init__.py +0 -0
  211. ngsolve/demos/howto/__init__.py +0 -0
  212. ngsolve/demos/howto/hhj.py +0 -44
  213. ngsolve/demos/howto/hybrid_dg.py +0 -53
  214. ngsolve/demos/howto/mixed.py +0 -30
  215. ngsolve/demos/howto/nonlin.py +0 -29
  216. ngsolve/demos/howto/pickling.py +0 -26
  217. ngsolve/demos/howto/pml.py +0 -31
  218. ngsolve/demos/howto/taskmanager.py +0 -20
  219. ngsolve/demos/howto/tdnns.py +0 -47
  220. ngsolve/demos/howto/timeDG-skeleton.py +0 -45
  221. ngsolve/demos/howto/timeDG.py +0 -38
  222. ngsolve/demos/howto/timeDGlap.py +0 -42
  223. ngsolve/demos/howto/timeDGwave.py +0 -61
  224. ngsolve/demos/intro/__init__.py +0 -0
  225. ngsolve/demos/intro/adaptive.py +0 -123
  226. ngsolve/demos/intro/cmagnet.py +0 -62
  227. ngsolve/demos/intro/elasticity.py +0 -76
  228. ngsolve/demos/intro/navierstokes.py +0 -74
  229. ngsolve/demos/intro/poisson.ipynb +0 -170
  230. ngsolve/demos/intro/poisson.py +0 -41
  231. ngsolve/demos/mpi/__init__.py +0 -0
  232. ngsolve/demos/mpi/mpi_cmagnet.py +0 -87
  233. ngsolve/demos/mpi/mpi_navierstokes.py +0 -117
  234. ngsolve/demos/mpi/mpi_poisson.py +0 -89
  235. ngsolve/demos/mpi/mpi_timeDG.py +0 -82
  236. ngsolve/directsolvers.pyi +0 -18
  237. ngsolve/eigenvalues.pyi +0 -30
  238. ngsolve/fem.pyi +0 -1707
  239. ngsolve/krylovspace.pyi +0 -309
  240. ngsolve/la.pyi +0 -1218
  241. ngsolve/ngslib.so +0 -0
  242. ngsolve/ngstd.pyi +0 -58
  243. ngsolve/nonlinearsolvers.pyi +0 -98
  244. ngsolve/preconditioners.pyi +0 -6
  245. ngsolve/solve.pyi +0 -108
  246. ngsolve/solvers.pyi +0 -14
  247. ngsolve/timestepping.pyi +0 -34
  248. ngsolve/timing.pyi +0 -57
  249. ngsolve/utils.pyi +0 -279
  250. ngsolve-6.2.2501.post16.dev1.data/data/Netgen.icns +0 -0
  251. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngscxx +0 -17
  252. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngsld +0 -13
  253. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngsolve.tcl +0 -648
  254. ngsolve-6.2.2501.post16.dev1.data/data/bin/ngspy +0 -2
  255. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/beam.geo +0 -17
  256. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/beam.vol +0 -240
  257. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/chip.in2d +0 -41
  258. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/chip.vol +0 -614
  259. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coil.geo +0 -12
  260. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coil.vol +0 -2560
  261. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coilshield.geo +0 -24
  262. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/coilshield.vol +0 -3179
  263. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/cube.geo +0 -19
  264. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/cube.vol +0 -1832
  265. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d10_DGdoubleglazing.pde +0 -50
  266. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d11_chip_nitsche.pde +0 -40
  267. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d1_square.pde +0 -43
  268. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d2_chip.pde +0 -35
  269. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d3_helmholtz.pde +0 -22
  270. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d4_cube.pde +0 -46
  271. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d5_beam.pde +0 -74
  272. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d6_shaft.pde +0 -73
  273. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d7_coil.pde +0 -50
  274. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d8_coilshield.pde +0 -49
  275. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/d9_hybridDG.pde +0 -72
  276. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/doubleglazing.in2d +0 -27
  277. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/doubleglazing.vol +0 -737
  278. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/piezo2d40round4.vol.gz +0 -0
  279. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/shaft.geo +0 -73
  280. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/shaft.vol +0 -4291
  281. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/square.in2d +0 -17
  282. ngsolve-6.2.2501.post16.dev1.data/data/share/ngsolve/square.vol +0 -149
  283. ngsolve-6.2.2501.post16.dev1.dist-info/RECORD +0 -304
  284. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/LICENSE +0 -0
  285. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/WHEEL +0 -0
  286. {ngsolve-6.2.2501.post16.dev1.dist-info → ngsolve-6.2.2501.post34.dev1.dist-info}/top_level.txt +0 -0
@@ -1,957 +0,0 @@
1
- #ifndef FILE_NGS_BASEMATRIX
2
- #define FILE_NGS_BASEMATRIX
3
-
4
-
5
- /*********************************************************************/
6
- /* File: basematrix.hpp */
7
- /* Author: Joachim Schoeberl */
8
- /* Date: 25. Mar. 2000 */
9
- /*********************************************************************/
10
-
11
-
12
- #include "basevector.hpp"
13
- #include "multivector.hpp"
14
- // #include "paralleldofs.hpp"
15
-
16
- namespace ngla
17
- {
18
- class ParallelDofs;
19
-
20
- // sets the solver which is used for InverseMatrix
21
- enum INVERSETYPE { PARDISO, PARDISOSPD, SPARSECHOLESKY, SUPERLU, SUPERLU_DIST, MUMPS, MASTERINVERSE, UMFPACK };
22
- extern string GetInverseName (INVERSETYPE type);
23
-
24
- class BaseSparseMatrix;
25
-
26
- /**
27
- The base for all matrices in the linalg.
28
- */
29
- class NGS_DLL_HEADER BaseMatrix : public enable_shared_from_this_virtual<BaseMatrix>
30
- {
31
- protected:
32
- shared_ptr<ParallelDofs> paralleldofs;
33
- mutable char safety_check = 0;
34
- bool is_complex = false;
35
-
36
- protected:
37
- ///
38
- BaseMatrix ();
39
- ///
40
- BaseMatrix (shared_ptr<ParallelDofs> aparalleldofs);
41
-
42
- public:
43
- ///
44
- virtual ~BaseMatrix ();
45
- /// virtual function must be overloaded
46
- virtual int VHeight() const;
47
-
48
- /// virtual function must be overloaded
49
- virtual int VWidth() const;
50
-
51
- /// inline function VHeight
52
- size_t Height() const
53
- {
54
- return VHeight();
55
- }
56
-
57
- /// inline function VWidth
58
- size_t Width() const
59
- {
60
- return VWidth();
61
- }
62
-
63
- virtual tuple<size_t, size_t> Shape() const { return { Height(), Width() }; }
64
-
65
- virtual xbool IsSymmetric() const { return maybe; }
66
-
67
- /// is matrix complex ?
68
- virtual bool IsComplex() const { return is_complex; }
69
-
70
- /// scalar assignment
71
- BaseMatrix & operator= (double s)
72
- {
73
- AsVector().SetScalar(s);
74
- return *this;
75
- }
76
-
77
- /// linear access of matrix memory
78
- virtual BaseVector & AsVector();
79
- /// linear access of matrix memory
80
- virtual const BaseVector & AsVector() const;
81
- ///
82
- virtual void SetZero();
83
-
84
- virtual ostream & Print (ostream & ost) const;
85
- virtual Array<MemoryUsage> GetMemoryUsage () const;
86
- virtual size_t NZE () const;
87
-
88
- template <typename T>
89
- shared_ptr<T> SharedFromThis()
90
- { return dynamic_pointer_cast<T> (shared_from_this()); }
91
- /// whatever it means ... e.g. refactor sparse factorization
92
- virtual void Update();
93
- /// creates matrix of same type
94
- virtual shared_ptr<BaseMatrix> CreateMatrix () const;
95
- /// creates a matching vector, size = width
96
- virtual AutoVector CreateRowVector () const = 0;
97
- /// creates a matching vector, size = height
98
- virtual AutoVector CreateColVector () const = 0;
99
- /// creates a matching vector (for square matrices)
100
- [[deprecated("use CreateRowVector or CreateColVector instead")]]
101
- virtual AutoVector CreateVector () const;
102
-
103
- virtual AutoVector Evaluate(BaseVector & v) const
104
- {
105
- auto res = CreateColVector();
106
- Mult (v, res);
107
- return res;
108
- }
109
-
110
- /// y = matrix * x.
111
- virtual void Mult (const BaseVector & x, BaseVector & y) const;
112
- ///
113
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const;
114
- /// y += s matrix * x
115
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const;
116
- /// y += s matrix * x
117
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const;
118
-
119
- /// y += s Trans(matrix) * x
120
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const;
121
- /// y += s Trans(matrix) * x
122
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const;
123
- /// y += s Trans(matrix) * x
124
- virtual void MultConjTransAdd (Complex s, const BaseVector & x, BaseVector & y) const;
125
-
126
- /// y += alpha M x
127
- virtual void MultAdd (FlatVector<double> alpha, const MultiVector & x, MultiVector & y) const;
128
-
129
- /**
130
- to split mat x vec for symmetric matrices
131
- only rows with inner or cluster true need by added (but more can be ...)
132
- */
133
- virtual void MultAdd1 (double s, const BaseVector & x, BaseVector & y,
134
- const BitArray * ainner = NULL,
135
- const Array<int> * acluster = NULL) const;
136
-
137
- /// only cols with inner or cluster true need by added (but more can be ...)
138
- virtual void MultAdd2 (double s, const BaseVector & x, BaseVector & y,
139
- const BitArray * ainner = NULL,
140
- const Array<int> * acluster = NULL) const;
141
-
142
-
143
- void SetParallelDofs (shared_ptr<ParallelDofs> pardofs) { paralleldofs = pardofs; }
144
- shared_ptr<ParallelDofs> GetParallelDofs () const { return paralleldofs; }
145
- virtual optional<NgMPI_Comm> GetCommunicator() const { return nullopt; }
146
-
147
- virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<BitArray> subset = nullptr) const;
148
- virtual shared_ptr<BaseMatrix> InverseMatrix (shared_ptr<const Array<int>> clusters) const;
149
- virtual INVERSETYPE SetInverseType ( INVERSETYPE ainversetype ) const;
150
- virtual INVERSETYPE SetInverseType ( string ainversetype ) const;
151
- virtual INVERSETYPE GetInverseType () const;
152
-
153
- typedef std::function<shared_ptr<BaseMatrix>(shared_ptr<BaseMatrix>,
154
- shared_ptr<BitArray>,
155
- shared_ptr<const Array<int>>)> T_INVCREATOR;
156
- mutable T_INVCREATOR invcreator;
157
- void SetInverseCreator(T_INVCREATOR ainvcreator) const { invcreator = ainvcreator; }
158
-
159
- static SymbolTable<T_INVCREATOR> invcreators;
160
- static void RegisterInverseCreator(string name, T_INVCREATOR creator);
161
-
162
- virtual void SetInverseFlags (const Flags & flags) { ; }
163
- virtual shared_ptr<BaseMatrix> DeleteZeroElements(double tol) const
164
- {
165
- throw Exception (string("DeleteZeroElements not overloaded, type =")+typeid(*this).name());
166
- }
167
-
168
-
169
- virtual void DoArchive (Archive & ar);
170
-
171
-
172
- template <typename TSCAL>
173
- Matrix<TSCAL> ToDense() const;
174
-
175
- virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const;
176
-
177
- // time per run
178
- double Timing (int runs = 10) const;
179
-
180
- class OperatorInfo
181
- {
182
- public:
183
- string name = "undef";
184
- size_t height = 0, width = 0;
185
- Array<const BaseMatrix*> childs;
186
- OperatorInfo() = default;
187
- OperatorInfo(string aname, size_t ah, size_t aw)
188
- : name(aname), height(ah), width(aw) { }
189
- };
190
-
191
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const;
192
- void PrintOperatorInfo (ostream & ost, int level = 0) const;
193
-
194
- // base class checks for sizes, derived BlockMatrix and ParallelMatrix check more
195
- virtual xbool SameShape (BaseMatrix & other) const;
196
- // *this * other
197
- virtual xbool CanCompose (BaseMatrix & other) const;
198
-
199
- virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const;
200
- static std::map<type_index, function<shared_ptr<BaseMatrix>(const BaseMatrix&)>> devmatcreator;
201
- static void RegisterDeviceMatrixCreator (type_index type,
202
- function<shared_ptr<BaseMatrix>(const BaseMatrix&)> creator)
203
- {
204
- devmatcreator[type] = creator;
205
- }
206
-
207
- private:
208
- BaseMatrix & operator= (const BaseMatrix & m2) { return *this; }
209
-
210
- MemoryTracer mt = { "BaseMatrix" };
211
- public:
212
- const MemoryTracer& GetMemoryTracer() const { return mt; }
213
- };
214
-
215
-
216
-
217
-
218
-
219
-
220
- /// specifies the scalar type.
221
- template <typename SCAL>
222
- class NGS_DLL_HEADER S_BaseMatrix : virtual public BaseMatrix
223
- {
224
- public:
225
- S_BaseMatrix () = default;
226
- virtual ~S_BaseMatrix () = default;
227
- // virtual bool IsComplex() const { return false; }
228
- };
229
-
230
- // specifies the scalar type Complex.
231
- template <>
232
- class S_BaseMatrix<Complex> : virtual public BaseMatrix
233
- {
234
- public:
235
- ///
236
- S_BaseMatrix () { is_complex = true; }
237
- virtual ~S_BaseMatrix () = default;
238
-
239
- // virtual bool IsComplex() const { return true; }
240
-
241
- /*
242
- /// calls MultAdd (Complex s);
243
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const;
244
- /// must be overloaded
245
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const;
246
-
247
- /// calls MultTransAdd (Complex s);
248
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const;
249
- /// should be overloaded
250
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const;
251
- */
252
- };
253
-
254
-
255
-
256
-
257
-
258
-
259
-
260
- /* *************************** Matrix * Vector ******************** */
261
-
262
-
263
- ///
264
- class VMatVecExpr
265
- {
266
- const BaseMatrix & m;
267
- const BaseVector & x;
268
-
269
- public:
270
- VMatVecExpr (const BaseMatrix & am, const BaseVector & ax) : m(am), x(ax) { ; }
271
-
272
- template <class TS>
273
- void AssignTo (TS s, BaseVector & v) const
274
- {
275
- CheckSize (v);
276
- m.Mult (x, v);
277
- v *= s;
278
- }
279
-
280
- template <class TS>
281
- void AddTo (TS s, BaseVector & v) const
282
- {
283
- CheckSize (v);
284
- m.MultAdd (s, x, v);
285
- }
286
-
287
- NGS_DLL_HEADER void CheckSize (BaseVector & dest_vec) const;
288
- };
289
-
290
-
291
- /// BaseMatrix times Vector - expression template
292
- inline VVecExpr<VMatVecExpr>
293
- operator* (const BaseMatrix & a, const BaseVector & b)
294
- {
295
- return VMatVecExpr (a, b);
296
- }
297
-
298
-
299
-
300
- class NGS_DLL_HEADER DynamicMatVecExpression : public DynamicBaseExpression
301
- {
302
- shared_ptr<BaseMatrix> m;
303
- shared_ptr<BaseVector> v;
304
-
305
- AutoVector CreateVector() const override
306
- { return m->CreateColVector(); }
307
-
308
- AutoVector Evaluate() const override
309
- {
310
- return m->Evaluate(*v);
311
- }
312
-
313
- void AssignTo (double s, BaseVector & v2) const override
314
- {
315
- m->Mult(*v, v2);
316
- v2 *= s;
317
- }
318
- void AddTo (double s, BaseVector & v2) const override
319
- {
320
- m->MultAdd (s, *v, v2);
321
- }
322
- void AssignTo (Complex s, BaseVector & v2) const override
323
- {
324
- m->Mult(*v, v2);
325
- v2 *= s;
326
- }
327
- void AddTo (Complex s, BaseVector & v2) const override
328
- {
329
- m->MultAdd (s, *v, v2);
330
- }
331
- public:
332
- DynamicMatVecExpression (shared_ptr<BaseMatrix> am, shared_ptr<BaseVector> av)
333
- : m(am), v(av) { }
334
- };
335
-
336
-
337
-
338
- /* ************************** Transpose ************************* */
339
-
340
- /**
341
- The Transpose of a BaseMatrix.
342
- */
343
- class NGS_DLL_HEADER Transpose : public BaseMatrix
344
- {
345
- const BaseMatrix & bm;
346
- shared_ptr<BaseMatrix> spbm;
347
- public:
348
- ///
349
- Transpose (const BaseMatrix & abm) : bm(abm) { ; }
350
- Transpose (shared_ptr<BaseMatrix> aspbm) : bm(*aspbm), spbm(aspbm) { ; }
351
- ///
352
- virtual bool IsComplex() const override { return bm.IsComplex(); }
353
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
354
-
355
- virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
356
-
357
- virtual AutoVector CreateRowVector () const override { return bm.CreateColVector(); }
358
- virtual AutoVector CreateColVector () const override { return bm.CreateRowVector(); }
359
-
360
- virtual void Mult (const BaseVector & x, BaseVector & y) const override
361
- {
362
- bm.MultTrans (x, y);
363
- }
364
-
365
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override
366
- {
367
- bm.Mult (x, y);
368
- }
369
-
370
- ///
371
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
372
- {
373
- bm.MultTransAdd (s, x, y);
374
- }
375
- ///
376
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
377
- {
378
- bm.MultTransAdd (s, x, y);
379
- }
380
- ///
381
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
382
- {
383
- bm.MultAdd (s, x, y);
384
- }
385
- ///
386
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
387
- {
388
- bm.MultAdd (s, x, y);
389
- }
390
-
391
- virtual int VHeight() const override { return bm.VWidth(); }
392
- virtual int VWidth() const override { return bm.VHeight(); }
393
-
394
- auto SPtrMat() const { return spbm; }
395
-
396
- virtual ostream & Print (ostream & ost) const override
397
- {
398
- ost << "Transpose of " << endl;
399
- bm.Print(ost);
400
- return ost;
401
- }
402
-
403
- virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
404
- {
405
- return make_shared<Transpose>(bm.CreateDeviceMatrix());
406
- }
407
-
408
- };
409
-
410
-
411
-
412
- /* ************************** ConjTrans ************************* */
413
-
414
- /**
415
- The conjugate transpose of a BaseMatrix.
416
- */
417
- class NGS_DLL_HEADER ConjTrans : public BaseMatrix
418
- {
419
- shared_ptr<BaseMatrix> spbm;
420
- public:
421
- ConjTrans (shared_ptr<BaseMatrix> aspbm) : spbm(aspbm) { ; }
422
- ///
423
- virtual bool IsComplex() const override { return spbm->IsComplex(); }
424
-
425
- virtual AutoVector CreateRowVector () const override { return spbm->CreateColVector(); }
426
- virtual AutoVector CreateColVector () const override { return spbm->CreateRowVector(); }
427
-
428
- virtual void Mult (const BaseVector & x, BaseVector & y) const override
429
- {
430
- y = 0.0;
431
- spbm->MultConjTransAdd (1, x, y);
432
- }
433
-
434
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override
435
- {
436
- throw Exception("Trans of ConjTrans not available");
437
- }
438
-
439
- ///
440
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
441
- {
442
- spbm->MultConjTransAdd (s, x, y);
443
- }
444
- ///
445
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
446
- {
447
- spbm->MultConjTransAdd (s, x, y);
448
- }
449
- ///
450
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
451
- {
452
- throw Exception("Trans of ConjTrans not available");
453
- }
454
- ///
455
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
456
- {
457
- throw Exception("Trans of ConjTrans not available");
458
- }
459
-
460
- virtual int VHeight() const override { return spbm->VWidth(); }
461
- virtual int VWidth() const override { return spbm->VHeight(); }
462
-
463
-
464
- virtual ostream & Print (ostream & ost) const override
465
- {
466
- ost << "ConjTrans of " << endl;
467
- spbm->Print(ost);
468
- return ost;
469
- }
470
- };
471
-
472
-
473
-
474
-
475
- /* ************************** Product ************************* */
476
-
477
- /// action of product of two matrices
478
- class NGS_DLL_HEADER ProductMatrix : public BaseMatrix
479
- {
480
- const BaseMatrix & bma;
481
- const BaseMatrix & bmb;
482
- shared_ptr<BaseMatrix> spbma;
483
- shared_ptr<BaseMatrix> spbmb;
484
- mutable AutoVector tempvec;
485
- public:
486
- ///
487
- ProductMatrix (const BaseMatrix & abma, const BaseMatrix & abmb)
488
- : bma(abma), bmb(abmb), tempvec(abmb.CreateColVector())
489
- { ; }
490
- ProductMatrix (shared_ptr<BaseMatrix> aspbma, shared_ptr<BaseMatrix> aspbmb)
491
- : bma(*aspbma), bmb(*aspbmb), spbma(aspbma), spbmb(aspbmb)
492
- // tempvec(aspbmb->CreateColVector())
493
- {
494
- try
495
- {
496
- tempvec.AssignPointer(bmb.CreateColVector());
497
- }
498
- catch (Exception & e)
499
- {
500
- tempvec.AssignPointer(bma.CreateRowVector());
501
- }
502
- }
503
- ///
504
- virtual bool IsComplex() const override { return bma.IsComplex() || bmb.IsComplex(); }
505
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
506
-
507
- virtual AutoVector CreateRowVector () const override { return bmb.CreateRowVector(); }
508
- virtual AutoVector CreateColVector () const override { return bma.CreateColVector(); }
509
-
510
- auto SPtrA() const { return spbma; }
511
- auto SPtrB() const { return spbmb; }
512
-
513
-
514
- ///
515
- virtual void Mult (const BaseVector & x, BaseVector & y) const override
516
- {
517
- static Timer t("ProductMatrix::Mult"); RegionTimer reg(t);
518
- bmb.Mult (x, tempvec);
519
- bma.Mult (tempvec, y);
520
- }
521
-
522
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override
523
- {
524
- static Timer t("ProductMatrix::Mult"); RegionTimer reg(t);
525
- bma.MultTrans (x, tempvec);
526
- bmb.MultTrans (tempvec, y);
527
- }
528
-
529
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
530
- {
531
- static Timer t("ProductMatrix::MultAdd"); RegionTimer reg(t);
532
- bmb.Mult (x, tempvec);
533
- bma.MultAdd (s, tempvec, y);
534
- }
535
- ///
536
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
537
- {
538
- static Timer t("ProductMatrix::MultAdd complex"); RegionTimer reg(t);
539
- bmb.Mult (x, tempvec);
540
- bma.MultAdd (s, tempvec, y);
541
- }
542
- ///
543
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
544
- {
545
- static Timer t("ProductMatrix::MultTransAdd"); RegionTimer reg(t);
546
- bma.MultTrans (x, tempvec);
547
- bmb.MultTransAdd (s, tempvec, y);
548
- }
549
- ///
550
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
551
- {
552
- static Timer t("ProductMatrix::MultTransAdd complex"); RegionTimer reg(t);
553
- bma.MultTrans (x, tempvec);
554
- bmb.MultTransAdd (s, tempvec, y);
555
- }
556
-
557
- virtual void MultAdd (FlatVector<double> alpha, const MultiVector & x, MultiVector & y) const override
558
- {
559
- static Timer t("ProductMatrix::MultAdd(mv)"); RegionTimer reg(t);
560
- auto tempvec = shared_ptr<BaseVector>(bmb.CreateColVector())->CreateMultiVector(x.Size());
561
- *tempvec = 0;
562
- Vector ones(x.Size());
563
- ones = 1.0;
564
- bmb.MultAdd (ones, x, *tempvec);
565
- bma.MultAdd (alpha, *tempvec, y);
566
- }
567
-
568
-
569
- virtual int VHeight() const override { return bma.VHeight(); }
570
- virtual int VWidth() const override { return bmb.VWidth(); }
571
-
572
- virtual ostream & Print (ostream & ost) const override
573
- {
574
- ost << "Product of" << endl;
575
- bma.Print(ost);
576
- bmb.Print(ost);
577
- return ost;
578
- }
579
-
580
- virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
581
-
582
- virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
583
- {
584
- return make_shared<ProductMatrix>(bma.CreateDeviceMatrix(), bmb.CreateDeviceMatrix());
585
- }
586
-
587
- };
588
-
589
-
590
- /* ************************** Sum ************************* */
591
-
592
- /// action of product of two matrices
593
- class NGS_DLL_HEADER SumMatrix : public BaseMatrix
594
- {
595
- const BaseMatrix & bma;
596
- const BaseMatrix & bmb;
597
- shared_ptr<BaseMatrix> spbma;
598
- shared_ptr<BaseMatrix> spbmb;
599
- double a, b;
600
- public:
601
- ///
602
- SumMatrix (const BaseMatrix & abma, const BaseMatrix & abmb,
603
- double aa = 1, double ab = 1)
604
- : bma(abma), bmb(abmb), a(aa), b(ab)
605
- { ; }
606
- SumMatrix (shared_ptr<BaseMatrix> aspbma, shared_ptr<BaseMatrix> aspbmb,
607
- double aa = 1, double ab = 1);
608
-
609
- ///
610
- virtual bool IsComplex() const override { return bma.IsComplex() || bmb.IsComplex(); }
611
-
612
- auto SPtrA() const { return spbma; }
613
- auto SPtrB() const { return spbmb; }
614
-
615
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
616
-
617
- virtual AutoVector CreateRowVector () const override
618
- {
619
- try
620
- {
621
- return bma.CreateRowVector();
622
- }
623
- catch (Exception & e)
624
- {
625
- return bmb.CreateRowVector();
626
- }
627
- }
628
- virtual AutoVector CreateColVector () const override
629
- {
630
- try
631
- {
632
- return bma.CreateColVector();
633
- }
634
- catch (Exception & e)
635
- {
636
- return bmb.CreateColVector();
637
- }
638
- }
639
-
640
- virtual void Mult (const BaseVector & x, BaseVector & y) const override
641
- {
642
- static Timer t("SumMatrix::Mult"); RegionTimer reg(t);
643
- if (a == 1)
644
- bma.Mult (x, y);
645
- else
646
- {
647
- y = 0.0;
648
- bma.MultAdd (a, x, y);
649
- }
650
- bmb.MultAdd (b, x, y);
651
- }
652
-
653
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override
654
- {
655
- static Timer t("SumMatrix::MultTrans"); RegionTimer reg(t);
656
- if (a == 1)
657
- bma.MultTrans (x, y);
658
- else
659
- {
660
- y = 0.0;
661
- bma.MultTransAdd (a, x, y);
662
- }
663
- bmb.MultTransAdd (b, x, y);
664
- }
665
-
666
- ///
667
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
668
- {
669
- static Timer t("SumMatrix::MultAdd"); RegionTimer reg(t);
670
- bma.MultAdd (a*s, x, y);
671
- bmb.MultAdd (b*s, x, y);
672
- }
673
- ///
674
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
675
- {
676
- static Timer t("SumMatrix::MultAdd complex"); RegionTimer reg(t);
677
- bma.MultAdd (a*s, x, y);
678
- bmb.MultAdd (b*s, x, y);
679
- }
680
- ///
681
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
682
- {
683
- static Timer t("SumMatrix::MultTransAdd"); RegionTimer reg(t);
684
- bma.MultTransAdd (a*s, x, y);
685
- bmb.MultTransAdd (b*s, x, y);
686
- }
687
- ///
688
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
689
- {
690
- static Timer t("SumMatrix::MultAdd complex"); RegionTimer reg(t);
691
- bma.MultTransAdd (a*s, x, y);
692
- bmb.MultTransAdd (b*s, x, y);
693
- }
694
-
695
- /// y += alpha M x
696
- virtual void MultAdd (FlatVector<double> alpha, const MultiVector & x, MultiVector & y) const override
697
- {
698
- static Timer t("SumMatrix::MultAdd(mv)"); RegionTimer reg(t);
699
- bma.MultAdd (Vector(a*alpha), x, y);
700
- bmb.MultAdd (Vector(b*alpha), x, y);
701
- }
702
-
703
- virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
704
-
705
- virtual int VHeight() const override
706
- {
707
- try
708
- {
709
- return bma.VHeight();
710
- }
711
- catch (Exception &)
712
- {
713
- return bmb.VHeight();
714
- }
715
- }
716
-
717
- virtual int VWidth() const override
718
- {
719
- try
720
- {
721
- return bma.VWidth();
722
- }
723
- catch (Exception &)
724
- {
725
- return bmb.VWidth();
726
- }
727
- }
728
-
729
- virtual ostream & Print (ostream & ost) const override
730
- {
731
- ost << "Sum of" << endl;
732
- ost << "Scale a = " << a << endl;
733
- bma.Print(ost);
734
- ost << "Scale b = " << b << endl;
735
- bmb.Print(ost);
736
- return ost;
737
- }
738
-
739
- virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
740
- {
741
- return make_shared<SumMatrix>(bma.CreateDeviceMatrix(), bmb.CreateDeviceMatrix(), a, b);
742
- }
743
-
744
- };
745
-
746
-
747
- /* ************************** Scale ************************* */
748
-
749
- template <typename TSCAL>
750
- class VScaleMatrix : public BaseMatrix
751
- {
752
- const BaseMatrix & bm;
753
- shared_ptr<BaseMatrix> spbm;
754
- TSCAL scale;
755
- public:
756
- ///
757
- VScaleMatrix (const BaseMatrix & abm, TSCAL ascale) : bm(abm), scale(ascale) { ; }
758
- VScaleMatrix (shared_ptr<BaseMatrix> aspbm, TSCAL ascale)
759
- : bm(*aspbm), spbm(aspbm), scale(ascale) { ; }
760
- TSCAL GetScalingFactor() const { return scale; }
761
- virtual bool IsComplex() const override
762
- { return bm.IsComplex() || typeid(TSCAL)==typeid(Complex); }
763
- ///
764
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
765
- {
766
- static Timer t("ScaleMatrix::MultAdd"); RegionTimer reg(t);
767
- bm.MultAdd (s*scale, x, y);
768
- }
769
- ///
770
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
771
- {
772
- static Timer t("ScaleMatrix::MultAdd complex"); RegionTimer reg(t);
773
- bm.MultAdd (s*scale, x, y);
774
- }
775
- ///
776
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
777
- {
778
- static Timer t("ScaleMatrix::MultTransAdd"); RegionTimer reg(t);
779
- bm.MultTransAdd (s*scale, x, y);
780
- }
781
- ///
782
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
783
- {
784
- static Timer t("ScaleMatrix::MultTransAdd complex"); RegionTimer reg(t);
785
- bm.MultTransAdd (s*scale, x, y);
786
- }
787
-
788
- virtual void MultAdd (FlatVector<double> alpha, const MultiVector & x, MultiVector & y) const override
789
- {
790
- static Timer t("ScaleMatrix::MultAdd(mv)"); RegionTimer reg(t);
791
- if constexpr (is_same<TSCAL, double>())
792
- {
793
- bm.MultAdd (Vector(scale*alpha), x, y);
794
- }
795
- else
796
- BaseMatrix::MultAdd(alpha, x, y);
797
- }
798
-
799
-
800
-
801
-
802
- virtual int VHeight() const override { return bm.VHeight(); }
803
- virtual int VWidth() const override { return bm.VWidth(); }
804
- virtual AutoVector CreateRowVector () const override { return bm.CreateRowVector(); }
805
- virtual AutoVector CreateColVector () const override { return bm.CreateColVector(); }
806
- virtual ostream & Print (ostream & ost) const override
807
- {
808
- ost << "Scale with " << scale << ":" << endl;
809
- bm.Print(ost);
810
- return ost;
811
- }
812
-
813
- auto SPtrMat() const { return spbm; }
814
-
815
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override
816
- {
817
- OperatorInfo info;
818
- info.name = "ScaleMatrix, scale = "+ToString(scale);
819
- info.height = Height();
820
- info.width = Width();
821
- info.childs += &bm;
822
- return info;
823
- }
824
-
825
- virtual shared_ptr<BaseSparseMatrix> CreateSparseMatrix() const override;
826
-
827
- virtual shared_ptr<BaseMatrix> CreateDeviceMatrix() const override
828
- {
829
- return make_shared<VScaleMatrix<TSCAL>>(bm.CreateDeviceMatrix(), scale);
830
- }
831
- };
832
-
833
- inline VScaleMatrix<double> operator* (double d, const BaseMatrix & m)
834
- {
835
- return VScaleMatrix<double> (m, d);
836
- }
837
-
838
-
839
- /* ************************** Identity ************************* */
840
-
841
- class NGS_DLL_HEADER IdentityMatrix : public BaseMatrix
842
- {
843
- bool has_format;
844
- size_t size;
845
- public:
846
- ///
847
- IdentityMatrix ()
848
- : has_format(false) { ; }
849
- IdentityMatrix (size_t asize, bool ais_complex)
850
- : has_format(true), size(asize) { is_complex=ais_complex; }
851
-
852
- virtual BaseMatrix::OperatorInfo GetOperatorInfo () const override;
853
-
854
- ///
855
- virtual void Mult (const BaseVector & x, BaseVector & y) const override
856
- {
857
- static Timer t("IdentityMatrix::Mult"); RegionTimer reg(t);
858
- y = x;
859
- }
860
- virtual void MultTrans (const BaseVector & x, BaseVector & y) const override
861
- {
862
- static Timer t("IdentityMatrix::MultTrans"); RegionTimer reg(t);
863
- y = x;
864
- }
865
- ///
866
- virtual void MultAdd (double s, const BaseVector & x, BaseVector & y) const override
867
- {
868
- static Timer t("IdentityMatrix::MultAdd"); RegionTimer reg(t);
869
- y += s*x;
870
- }
871
- ///
872
- virtual void MultAdd (Complex s, const BaseVector & x, BaseVector & y) const override
873
- {
874
- static Timer t("IdentityMatrix::MultAdd Complex"); RegionTimer reg(t);
875
- y += s*x;
876
- }
877
- ///
878
- virtual void MultTransAdd (double s, const BaseVector & x, BaseVector & y) const override
879
- {
880
- static Timer t("IdentityMatrix::MultTransAdd"); RegionTimer reg(t);
881
- y += s*x;
882
- }
883
- ///
884
- virtual void MultTransAdd (Complex s, const BaseVector & x, BaseVector & y) const override
885
- {
886
- static Timer t("IdentityMatrix::MultTransAdd Complex"); RegionTimer reg(t);
887
- y += s*x;
888
- }
889
-
890
- virtual int VHeight() const override
891
- {
892
- if (has_format) return size;
893
- throw Exception("Identity: no Height");
894
- }
895
- virtual int VWidth() const override
896
- {
897
- if (has_format) return size;
898
- throw Exception("Identity: no Width");
899
- }
900
- virtual AutoVector CreateRowVector () const override
901
- {
902
- if (has_format)
903
- return CreateBaseVector(size, is_complex, 1);
904
- throw Exception("Identity: no RowVector");
905
- }
906
- virtual AutoVector CreateColVector () const override
907
- {
908
- if (has_format)
909
- return CreateBaseVector(size, is_complex, 1);
910
- throw Exception("Identity: no ColVector");
911
- }
912
-
913
- virtual ostream & Print (ostream & ost) const override
914
- {
915
- ost << "Identity" << endl;
916
- return ost;
917
- }
918
-
919
- };
920
-
921
-
922
- /* *********************** operators ********************** */
923
-
924
- // default is ProductMatrix, but optimizations for
925
- // ParallelMatrices
926
- // Embedding Matrices
927
- // ....
928
- shared_ptr<BaseMatrix> ComposeOperators (shared_ptr<BaseMatrix> a,
929
- shared_ptr<BaseMatrix> b);
930
- shared_ptr<BaseMatrix> AddOperators (shared_ptr<BaseMatrix> a,
931
- shared_ptr<BaseMatrix> b,
932
- double faca, double facb);
933
-
934
- inline shared_ptr<BaseMatrix> operator* (shared_ptr<BaseMatrix> a,
935
- shared_ptr<BaseMatrix> b)
936
- {
937
- return ComposeOperators(a,b);
938
- }
939
-
940
- inline shared_ptr<BaseMatrix> operator+ (shared_ptr<BaseMatrix> a,
941
- shared_ptr<BaseMatrix> b)
942
- {
943
- return AddOperators(a,b,1,1);
944
- }
945
-
946
-
947
- shared_ptr<BaseMatrix> TransposeOperator (shared_ptr<BaseMatrix> mat);
948
-
949
-
950
- inline ostream & operator<< (ostream & ost, const BaseMatrix & m)
951
- {
952
- return m.Print(ost);
953
- }
954
-
955
- }
956
-
957
- #endif