CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
linearSystemInterface.hpp
1/*
2 * CoDiPack, a Code Differentiation Package
3 *
4 * Copyright (C) 2015-2024 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://scicomp.rptu.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum, Johannes Blühdorn (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of CoDiPack (http://scicomp.rptu.de/software/codi).
11 *
12 * CoDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, either version 3 of the
15 * License, or (at your option) any later version.
16 *
17 * CoDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty
19 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU General Public License for more details.
22 * You should have received a copy of the GNU
23 * General Public License along with CoDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * For other licensing options please contact us.
27 *
28 * Authors:
29 * - SciComp, University of Kaiserslautern-Landau:
30 * - Max Sagebaum
31 * - Johannes Blühdorn
32 * - Former members:
33 * - Tim Albring
34 */
35
36#pragma once
37
38#include <vector>
39
40#include "../../../config.h"
42
44namespace codi {
45
53 public:
54
55 using Type = CODI_ANY;
56
57 using Matrix = CODI_ANY;
58 using MatrixReal =
59 CODI_ANY;
62 using Vector = CODI_ANY;
63 using VectorReal =
64 CODI_ANY;
67 };
68
108 template<typename T_InterfaceTypes>
110 public:
111
113
114 using Type = typename InterfaceTypes::Type;
115
116 using Matrix = typename InterfaceTypes::Matrix;
117 using MatrixReal = typename InterfaceTypes::MatrixReal;
118 using MatrixIdentifier = typename InterfaceTypes::MatrixIdentifier;
119 using Vector = typename InterfaceTypes::Vector;
120 using VectorReal = typename InterfaceTypes::VectorReal;
121 using VectorIdentifier = typename InterfaceTypes::VectorIdentifier;
122
123 /*******************************************************************************/
126
129 template<typename M>
131
134 template<typename M>
136
139 template<typename V>
141
144 template<typename V>
146
149
152
155
158
160 /*******************************************************************************/
163
165 template<typename Func, typename MatrixA, typename MatrixB>
166 void iterateMatrix(Func func, MatrixA* matA, MatrixB* matB);
167
169 template<typename Func, typename MatrixA, typename MatrixB, typename MatrixC>
170 void iterateMatrix(Func func, MatrixA* matA, MatrixB* matB, MatrixC* matC);
171
173 template<typename Func, typename VectorA, typename VectorB>
174 void iterateVector(Func func, VectorA* vecA, VectorB* vecB);
175
177 template<typename Func, typename VectorA, typename VectorB, typename VectorC>
178 void iterateVector(Func func, VectorA* vecA, VectorB* vecB, VectorC* vecC);
179
181 template<typename Func, typename VectorA, typename VectorB, typename VectorC, typename VectorD>
182 void iterateVector(Func func, VectorA* vecA, VectorB* vecB, VectorC* vecC, VectorD* vecD);
183
185 /*******************************************************************************/
188
191 void solveSystem(MatrixReal const* A, VectorReal const* b, VectorReal* x);
192
194 /*******************************************************************************/
197
202 template<typename Func>
203 void iterateDyadic(Func func, MatrixIdentifier* mat_id, VectorReal* x_v, VectorReal* b_b) {
204 CODI_UNUSED(func, mat_id, x_v, b_b);
205 }
206
209 CODI_UNUSED(A_v);
210 return NULL;
211 }
212
214 /*******************************************************************************/
217
219 void subtractMultiply(VectorReal* t, VectorReal const* b_d, MatrixReal const* A_d, VectorReal const* x) {
220 CODI_UNUSED(t, b_d, A_d, x);
221 }
222
224 /*******************************************************************************/
227
231 void solveSystemPrimal(MatrixReal const* A, VectorReal const* b, VectorReal* x) {
232 CODI_UNUSED(A, b, x);
233 }
234
236 };
237}
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition macros.hpp:94
#define CODI_ANY
Used in default declarations of expression templates.
Definition macros.hpp:98
CoDiPack - Code Differentiation Package.
Definition codi.hpp:90
void CODI_UNUSED(Args const &...)
Disable unused warnings for an arbitrary number of arguments.
Definition macros.hpp:46
Definition linearSystemInterface.hpp:52
int VectorIdentifier
V<typename Type::Identifier>).
Definition linearSystemInterface.hpp:65
int VectorReal
The Vector with the Real type of the CoDiPack type Type (e.g. V<typename Type::Real>).
Definition linearSystemInterface.hpp:63
int Type
A CoDiPack type or a floating point type.
Definition linearSystemInterface.hpp:55
int Vector
The Vector with Type as the computation type (e.g. V<Type>).
Definition linearSystemInterface.hpp:62
int MatrixIdentifier
M<typename Type::Identifier>).
Definition linearSystemInterface.hpp:60
int MatrixReal
The Matrix with the Real type of the CoDiPack type Type (e.g. M<typename Type::Real>).
Definition linearSystemInterface.hpp:58
int Matrix
The Matrix with Type as the computation type (e.g. M<Type>).
Definition linearSystemInterface.hpp:57
Definition linearSystemInterface.hpp:109
typename InterfaceTypes::MatrixReal MatrixReal
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:117
void deleteMatrixReal(MatrixReal *A_v)
Delete a real matrix.
VectorReal * createVectorReal(V *vec)
MatrixReal * transposeMatrix(MatrixReal *A_v)
Create a transposed matrix.
Definition linearSystemInterface.hpp:208
typename InterfaceTypes::Matrix Matrix
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:116
void subtractMultiply(VectorReal *t, VectorReal const *b_d, MatrixReal const *A_d, VectorReal const *x)
Computes t = b_d - A_d * x.
Definition linearSystemInterface.hpp:219
typename InterfaceTypes::VectorReal VectorReal
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:120
VectorIdentifier * createVectorIdentifier(V *vec)
T_InterfaceTypes InterfaceTypes
See LinearSystemInterface.
Definition linearSystemInterface.hpp:112
void iterateMatrix(Func func, MatrixA *matA, MatrixB *matB)
Iterate over all elements in the matrices at the same time.
MatrixReal * createMatrixReal(M *mat)
void iterateDyadic(Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
Definition linearSystemInterface.hpp:203
void iterateVector(Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC)
Iterate over all elements in the vectors at the same time.
void deleteMatrixIdentifier(MatrixIdentifier *A_id)
Delete an identifier matrix.
void deleteVectorReal(VectorReal *vec_v)
Delete a real Vector.
typename InterfaceTypes::Type Type
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:114
void iterateVector(Func func, VectorA *vecA, VectorB *vecB, VectorC *vecC, VectorD *vecD)
Iterate over all elements in the vectors at the same time.
void solveSystem(MatrixReal const *A, VectorReal const *b, VectorReal *x)
typename InterfaceTypes::MatrixIdentifier MatrixIdentifier
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:118
void deleteVectorIdentifier(VectorIdentifier *vec_id)
Delete an identifier vector.
void solveSystemPrimal(MatrixReal const *A, VectorReal const *b, VectorReal *x)
Definition linearSystemInterface.hpp:231
typename InterfaceTypes::VectorIdentifier VectorIdentifier
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:121
void iterateMatrix(Func func, MatrixA *matA, MatrixB *matB, MatrixC *matC)
Iterate over all elements in the matrices at the same time.
void iterateVector(Func func, VectorA *vecA, VectorB *vecB)
Iterate over all elements in the vectors at the same time.
MatrixIdentifier * createMatrixIdentifier(M *mat)
typename InterfaceTypes::Vector Vector
See LinearSystemInterfaceTypes.
Definition linearSystemInterface.hpp:119