Loading...
Searching...
No Matches
newton_argument.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 newton_argument
26Description
27 A general newton argument is implemented
28SourceFiles
29 newton_argument.H
30\*---------------------------------------------------------------------------*/
31
35
36
37#include <Eigen/Eigen>
38
39#ifndef newton_argument_H
40#define newton_argument_H
41
43template<typename _Scalar, int NX = Eigen::Dynamic, int NY = Eigen::Dynamic>
45{
46 public:
47 typedef _Scalar Scalar;
48 enum
49 {
52 };
53 typedef Eigen::Matrix<Scalar, InputsAtCompileTime, 1> InputType;
54 typedef Eigen::Matrix<Scalar, ValuesAtCompileTime, 1> ValueType;
55 typedef Eigen::Matrix<Scalar, ValuesAtCompileTime, InputsAtCompileTime>
57
59
60
65
73
81 int operator()(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const
82 {
83 std::cout <<
84 "This is a virtual method, it needs to be overriden with a suitable residual function"
85 << std::endl;
86 return 0;
87 }
88
96 int df(const Eigen::VectorXd& x, Eigen::VectorXd& fvec) const
97 {
98 std::cout <<
99 "This is a virtual method, it needs to be overriden with a suitable jacobian function"
100 << std::endl;
101 return 0;
102 }
103
108 int inputs() const
109 {
110 return m_inputs;
111 }
112
113
118 int values() const
119 {
120 return m_values;
121 }
122};
123
124#endif
Template object created to solve non linear problems using the Eigen library.
int inputs() const
Return the inputs.
Eigen::Matrix< Scalar, ValuesAtCompileTime, 1 > ValueType
Eigen::Matrix< Scalar, InputsAtCompileTime, 1 > InputType
newton_argument(int inputs, int values)
Constructor.
newton_argument()
Constructor.
int df(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
Operator to compute the jacobian matrix.
int operator()(const Eigen::VectorXd &x, Eigen::VectorXd &fvec) const
Operator to compute the residual vector.
Eigen::Matrix< Scalar, ValuesAtCompileTime, InputsAtCompileTime > JacobianType
int values() const
Return the values.