ug4
Loading...
Searching...
No Matches
matrix_use_member_functions.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2012: G-CSC, Goethe University Frankfurt
3 * Author: Martin Rupp
4 *
5 * This file is part of UG4.
6 *
7 * UG4 is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License version 3 (as published by the
9 * Free Software Foundation) with the following additional attribution
10 * requirements (according to LGPL/GPL v3 §7):
11 *
12 * (1) The following notice must be displayed in the Appropriate Legal Notices
13 * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 *
15 * (2) The following notice must be displayed at a prominent place in the
16 * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 *
18 * (3) The following bibliography is recommended for citation and must be
19 * preserved in all covered files:
20 * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 * parallel geometric multigrid solver on hierarchically distributed grids.
22 * Computing and visualization in science 16, 4 (2013), 151-164"
23 * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 * flexible software system for simulating pde based models on high performance
25 * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 */
32
33
34// MATRIX_USE_MEMBER_FUNCTIONS
36
37namespace ug
38{
39
40template<typename vector_t, typename matrix_t>
42{
44 static inline bool MatMult(vector_t &dest,
45 const number &beta1, const matrix_t &A1, const vector_t &w1)
46 {
47 return dest.mat_mult(beta1, A1, w1);
48 }
49
51 static inline bool MatMultAdd(vector_t &dest,
52 const number &alpha1, const vector_t &v1,
53 const number &beta1, const matrix_t &A1, const vector_t &w1)
54 {
55 return dest.mat_mult_add(alpha1, w1, beta1, A1, w1);
56 }
57
59 static inline bool MatMultAdd(vector_t &dest,
60 const number &alpha1, const vector_t &v1,
61 const number &alpha2, const vector_t &v2,
62 const number &beta1, const matrix_t &A1, const vector_t &w1)
63 {
64 return dest.mat_mult_add(alpha1, w1, alpha2, v2, beta1, A1, w1);
65 }
66
68 static inline bool MatMultAdd(vector_t &dest,
69 const number &beta1, const matrix_t &A1, const vector_t &w1,
70 const number &beta2, const matrix_t &A2, const vector_t &w2)
71 {
72 return dest.mat_mult_add(beta1, A1, w1, A2, w2);
73 }
74
76 static inline bool MatMultAdd(vector_t &dest,
77 const number &alpha1, const vector_t &v1,
78 const number &beta1, const matrix_t &A1, const vector_t &w1,
79 const number &beta2, const matrix_t &A2, const vector_t &w2)
80 {
81 return dest.mat_mult_add(alpha1, v1, beta1, A1, w1, beta2, A2, w2);
82 }
83
85 static inline bool MatMultTransposed(vector_t &dest,
86 const number &beta1, const matrix_t &A1, const vector_t &w1)
87 {
88 return dest.mat_mult_transposed(beta1, A1, w1);
89 }
90
92 static inline bool MatMultTransposedAdd(vector_t &dest,
93 const number &alpha1, const vector_t &v1,
94 const number &beta1, const matrix_t &A1, const vector_t &w1)
95 {
96 return dest.mat_mult_tranposed_add(alpha1, w1, beta1, A1, w1);
97 }
98};
99
100}
double number
Definition types.h:124
the ug namespace
@ MATRIX_USE_MEMBER_FUNCTIONS
Definition matrix_algebra_types.h:71
static bool MatMult(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = beta1 * A1;
Definition matrix_use_member_functions.h:44
static bool MatMultAdd(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1, const number &beta2, const matrix_t &A2, const vector_t &w2)
calculates dest = beta1 * A1 *w1 + beta2 * A2*w2;
Definition matrix_use_member_functions.h:68
static bool MatMultTransposedAdd(vector_t &dest, const number &alpha1, const vector_t &v1, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = alpha1*v1 + beta1 * A1^T *w1;
Definition matrix_use_member_functions.h:92
static bool MatMultAdd(vector_t &dest, const number &alpha1, const vector_t &v1, const number &beta1, const matrix_t &A1, const vector_t &w1, const number &beta2, const matrix_t &A2, const vector_t &w2)
calculates dest = alpha1*v1 + beta1 * A1 *w1 + beta2 * A2*w2;
Definition matrix_use_member_functions.h:76
static bool MatMultAdd(vector_t &dest, const number &alpha1, const vector_t &v1, const number &alpha2, const vector_t &v2, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = alpha1*v1 + beta1 * A1 *w1 + alpha2*v2;
Definition matrix_use_member_functions.h:59
static bool MatMultTransposed(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = beta1 * A1^T *w1;
Definition matrix_use_member_functions.h:85
static bool MatMultAdd(vector_t &dest, const number &alpha1, const vector_t &v1, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = alpha1*v1 + beta1 * A1 *w1;
Definition matrix_use_member_functions.h:51
Definition matrix_algebra_types.h:75