ug4
blas_mat_interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2015: 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 #ifndef BLAS_MAT_INTERFACE_H_
34 #define BLAS_MAT_INTERFACE_H_
35 
36 
37 
39 template<typename vector_t, typename matrix_t>
40 inline bool MatMultScale(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1);
41 
43 template<typename vector_t, typename matrix_t>
44 inline bool MatMult(vector_t &dest, const matrix_t &A1, const vector_t &w1);
45 
46 
48 template<typename vector_t, typename matrix_t>
49 inline bool MatMultAdd(vector_t &dest,
50  const number &alpha1, const vector_t &v1,
51  const number &beta1, const matrix_t &A1, const vector_t &w1 );
52 
54 template<typename vector_t, typename matrix_t>
55 inline bool MatMultAppend(vector_t &dest,
56  const matrix_t &A1, const vector_t &w1 );
57 
58 
60 template<typename vector_t, typename matrix_t>
61 inline bool MatMultScaleTransposed(vector_t &dest,
62  const number &beta1, const matrix_t &A1, const vector_t &w1 );
63 
65 template<typename vector_t, typename matrix_t>
66 inline bool MatMultScaleTransposed(vector_t &dest,
67  const matrix_t &A1, const vector_t &w1 );
68 
69 
71 template<typename vector_t, typename matrix_t>
72 inline bool MatMultTransposedScaledAdd(vector_t &dest,
73  const number &alpha1, const vector_t &v1,
74  const number &beta1, const matrix_t &A1, const vector_t &w1 )
75 {
76  return mat_operations_class<vector_t, matrix_t, matrix_algebra_type_traits<matrix_t>::type>
77  ::MatMultTransposedAdd(dest, alpha1, v1, beta1, A1, w1);
78 }
79 
80 // row functions
81 
83 template<typename vector_t, typename matrix_t>
84 inline bool MatMultAddRow(typename vector_t::value_type &dest,
85  const number &alpha1, const vector_t &v1,
86  const number &beta1, const matrix_t &A1, const vector_t &w1 )
87 {
88  return mat_operations_class<vector_t, matrix_t, matrix_algebra_type_traits<matrix_t>::type>
89  ::MatMultAdd(dest, alpha1, v1, beta1, A1, w1);
90 }
91 
92 #endif /* BLAS_MAT_INTERFACE_H_ */
bool MatMultScaleTransposed(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = beta1 * A1^T *w1;
bool MatMultTransposedScaledAdd(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: blas_mat_interface.h:72
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;
bool MatMultAddRow(typename vector_t::value_type &dest, const number &alpha1, const vector_t &v1, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest += beta1 * A1[row] *w1;
Definition: blas_mat_interface.h:84
bool MatMultScale(vector_t &dest, const number &beta1, const matrix_t &A1, const vector_t &w1)
calculates dest = beta1 * A1 * w1;
bool MatMultAppend(vector_t &dest, const matrix_t &A1, const vector_t &w1)
calculates dest += A1*w1
bool MatMult(vector_t &dest, const matrix_t &A1, const vector_t &w1)
calculates dest = A1 * w1;
double number
Definition: types.h:124
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 *w1;
Definition: operations_mat.h:121
T value_type
Definition: sparsematrix_interface.h:2