All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LSE.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_PROBLEMS_LSE_H_
36 #define _BLAZE_MATH_PROBLEMS_LSE_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <cmath>
46 #include <blaze/math/Functions.h>
47 #include <blaze/math/Infinity.h>
48 #include <blaze/util/Types.h>
49 
50 
51 namespace blaze {
52 
53 //=================================================================================================
54 //
55 // CLASS DEFINITION
56 //
57 //=================================================================================================
58 
59 //*************************************************************************************************
65 struct LSE
66 {
67  public:
68  //**Utility functions***************************************************************************
71  inline size_t size () const;
72  inline void project ( size_t index );
73  inline real lbound ( size_t index ) const;
74  inline real ubound ( size_t index ) const;
75  inline real residual( size_t index ) const;
76  inline real residual() const;
78  //**********************************************************************************************
79 
80  //**Member variables****************************************************************************
84  VecN b_;
85  VecN x_;
86 
87  //**********************************************************************************************
88 };
89 //*************************************************************************************************
90 
91 
92 
93 
94 //=================================================================================================
95 //
96 // UTILITY FUNCTIONS
97 //
98 //=================================================================================================
99 
100 //*************************************************************************************************
105 inline size_t LSE::size() const
106 {
107  return x_.size();
108 }
109 //*************************************************************************************************
110 
111 
112 //*************************************************************************************************
118 inline void LSE::project( size_t /*index*/ )
119 {}
120 //*************************************************************************************************
121 
122 
123 //*************************************************************************************************
129 inline real LSE::lbound( size_t /*index*/ ) const
130 {
131  return -inf;
132 }
133 //*************************************************************************************************
134 
135 
136 //*************************************************************************************************
142 inline real LSE::ubound( size_t /*index*/ ) const
143 {
144  return inf;
145 }
146 //*************************************************************************************************
147 
148 
149 //*************************************************************************************************
155 inline real LSE::residual( size_t index ) const
156 {
157  return ( A_ * x_ )[index] + b_[index];
158 }
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
167 inline real LSE::residual() const
168 {
169  real rmax( 0 );
170 
171  for( size_t i=0; i<size(); ++i ) {
172  rmax = max( rmax, std::fabs( residual( i ) ) );
173  }
174 
175  return rmax;
176 }
177 //*************************************************************************************************
178 
179 } // namespace blaze
180 
181 #endif
VecN b_
The right-hand side vector .
Definition: LSE.h:84
Header file for mathematical functions.
VecN x_
The vector of unknowns .
Definition: LSE.h:85
const StaticMatrix< Type, 3UL, 3UL, false > fabs(const RotationMatrix< Type > &m)
Returns a matrix containing the absolute values of each single element of m.
Definition: RotationMatrix.h:1102
A linear system of equations (LSE) data structure.The LSE class represent a linear system of equation...
Definition: LSE.h:65
Numerical infinity for built-in data types.
size_t size() const
Returns the current size/dimension of the vector.
Definition: DynamicVector.h:1050
Header file for the complete DynamicVector implementation.
real lbound(size_t index) const
Returns the lower bound of the unknown at the given index.
Definition: LSE.h:129
real ubound(size_t index) const
Returns the upper bound of the unknown at the given index.
Definition: LSE.h:142
real residual() const
Calculates the maximum norm of the residual of the linear system of equations.
Definition: LSE.h:167
CMatMxN A_
The system matrix .
Definition: LSE.h:83
size_t size() const
Returns the size of the linear system of equations.
Definition: LSE.h:105
const Infinity inf
Global Infinity instance.The blaze::inf instance can be used wherever a built-in data type is expecte...
Definition: Infinity.h:1098
double real
Floating point data type of the Blaze library.This type definition offers the possibility to switch t...
Definition: Precision.h:47
Header file for the complete CompressedMatrix implementation.
Header file for basic type definitions.
void project(size_t index)
Projects the unknown at the given index on the solution range.
Definition: LSE.h:118