CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
linearSystemSpecializationDetection.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://www.scicomp.uni-kl.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://www.scicomp.uni-kl.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"
41#include "../../../expressions/lhsExpressionInterface.hpp"
42#include "../../../misc/exceptions.hpp"
43#include "../../../traits/tapeTraits.hpp"
44#include "../../data/direction.hpp"
45#include "linearSystemFlags.hpp"
46#include "linearSystemInterface.hpp"
47
49namespace codi {
50
56 template<typename T_LinearSystem>
59 CODI_DD(T_LinearSystem,
61
62 using Type = CODI_DD(typename LinearSystem::Type,
63 CODI_DEFAULT_LHS_EXPRESSION);
64
65 using Matrix = typename LinearSystem::Matrix;
66 using MatrixReal = typename LinearSystem::MatrixReal;
67 using MatrixIdentifier = typename LinearSystem::MatrixIdentifier;
68 using Vector = typename LinearSystem::Vector;
69 using VectorReal = typename LinearSystem::VectorReal;
70 using VectorIdentifier = typename LinearSystem::VectorIdentifier;
71
72 private:
73
74 using Real = typename Type::Real;
75 using Identifier = typename Type::Identifier;
76
78
79 static void dyadicProxy(Identifier&, Real&, Real&) {}
80
81 public:
82
83 // gcc issues false warning for comparison with NULL.
84#ifdef __GNUC__
85 #pragma GCC diagnostic push
86 #pragma GCC diagnostic ignored "-Waddress"
87#endif
88
91 return static_cast<void (Interface::*)(decltype(dyadicProxy), MatrixIdentifier*, VectorReal*, VectorReal*)>(
92 &LinearSystem::iterateDyadic) !=
93 static_cast<void (Interface::*)(decltype(dyadicProxy), MatrixIdentifier*, VectorReal*, VectorReal*)>(
95 }
96
99 return &LinearSystem::transposeMatrix != &Interface::transposeMatrix;
100 }
101
104 return &LinearSystem::subtractMultiply != &Interface::subtractMultiply;
105 }
106
109 return &LinearSystem::solveSystemPrimal != &Interface::solveSystemPrimal;
110 }
111
112#ifdef __GNUC__
113 #pragma GCC diagnostic pop
114#endif
115
119 }
120
124 }
125 };
126}
#define CODI_INLINE
See codi::Config::ForcedInlines.
Definition: config.h:457
#define CODI_DD(Type, Default)
Abbreviation for CODI_DECLARE_DEFAULT.
Definition: macros.hpp:94
#define CODI_T(...)
Abbreviation for CODI_TEMPLATE.
Definition: macros.hpp:111
CoDiPack - Code Differentiation Package.
Definition: codi.hpp:90
Definition: linearSystemInterface.hpp:109
MatrixReal * transposeMatrix(MatrixReal *A_v)
Create a transposed matrix.
Definition: linearSystemInterface.hpp:208
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
void iterateDyadic(Func func, MatrixIdentifier *mat_id, VectorReal *x_v, VectorReal *b_b)
Definition: linearSystemInterface.hpp:203
void solveSystemPrimal(MatrixReal const *A, VectorReal const *b, VectorReal *x)
Definition: linearSystemInterface.hpp:231
Definition: linearSystemSpecializationDetection.hpp:57
typename LinearSystem::MatrixReal MatrixReal
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:66
typename LinearSystem::VectorIdentifier VectorIdentifier
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:70
typename LinearSystem::Vector Vector
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:68
static bool SupportsForwardMode()
True if all functions for the forward mode support are specialized.
Definition: linearSystemSpecializationDetection.hpp:122
static bool IsSubtractMultiplyImplemented()
Checks if subtractMultiply is specialized in LinearSystem.
Definition: linearSystemSpecializationDetection.hpp:103
static bool IsDyadicImplemented()
Checks if iterateDyadic is specialized in LinearSystem.
Definition: linearSystemSpecializationDetection.hpp:90
T_LinearSystem LinearSystem
See LinearSystemOverloadDetection.
Definition: linearSystemSpecializationDetection.hpp:60
typename LinearSystem::Matrix Matrix
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:65
typename LinearSystem::VectorReal VectorReal
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:69
static bool IsSolvePrimalImplemented()
Checks if solveSystemPrimal is specialized in LinearSystem.
Definition: linearSystemSpecializationDetection.hpp:108
static bool SupportsReverseMode()
True if all functions for the reverse mode support are specialized.
Definition: linearSystemSpecializationDetection.hpp:117
typename LinearSystem::MatrixIdentifier MatrixIdentifier
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:67
typename LinearSystem::Type Type
See LinearSystemInterfaceTypes.
Definition: linearSystemSpecializationDetection.hpp:63
static bool IsTransposeImplemented()
Checks if transposeMatrix is specialized in LinearSystem.
Definition: linearSystemSpecializationDetection.hpp:98