CppNoddy  0.92
Loading...
Searching...
No Matches
BandedLinearSystem.h
Go to the documentation of this file.
1/// \file BandedLinearSystem.h
2/// Specification of the linear system class.
3
4#ifndef BANDEDLINEARSYSTEM_H
5#define BANDEDLINEARSYSTEM_H
6
7#include <Types.h>
8
9namespace CppNoddy {
10
11 /// A linear system class for vector right-hand sides.
12 /// The class is constructed for dense typed problems of the form
13 /// \f[ A_{NxN} \,{\underline x}_i = B_{1xN} \f].
14 template <typename _Type>
16
17 public:
18
19 /// Constructor for a banded linear system object.
20 /// \param Aptr A pointer to the 'A matrix', an NxN double/complex banded matrix
21 /// \param Bptr A pointer to the 'B vector' a size N double/complex dense vector
22 /// \param which A string that indicates which solver to use
23 BandedLinearSystem(BandedMatrix<_Type>* Aptr, DenseVector<_Type>* Bptr, std::string which = "native");
24
25 /// Destructor for a linear system object.
27 {}
28
29 /// Solve the banded system
30 void solve();
31
32 /// Resolve the banded system
34
35 /// Get the sign of the determinant of the LHS matrix
36 /// from the linear system just computed.
37 /// \return The sign of the determinant of the
38 /// LAST solved system.
39 int get_det_sign() const;
40
41 /// Store the sign of the determinant of the LHS matrix
42 /// every time a solve is requested on a real system.
43 /// \param flag The boolean value to set.
44 void set_monitor_det(bool flag);
45
46 private:
47
48 /// Solve the linear system using LAPACK's LU solver
49 void solve_lapack();
50
51 /// Solve the linear system using the native elimination.
52 /// Note that access to the banded matrix is done through
53 /// the operator() methods and this method is sloooow!
54 void solve_native();
55
56 /// A wrapped up less_than check that throws an exception
57 /// if the matrix elements are complex.
58 bool lt(_Type value) const;
59
60 /// Back substitution routine for dense systems.
61 /// \param A The upper triangular matrix LHS
62 /// \param B The dense vector RHS
63 void backsub() const;
64
65 /// Compute the signature of the permutation vector
66 int signature(const std::vector<int> &pivots) const;
67
68 /// pointers to the associated containers
71
72 /// a string ID to pick out the appropriate solver
73 std::string m_version;
74
75 /// the sign of the determinant of the last solved system LHS
76 int m_detSign;
77
78 /// a flag that determines of the determinant sign should be monitored
79 bool m_monitorDet;
80
81 /// to allow resolves, we store pivots
82 std::vector<int> m_pivots;
83 };
84
85} //end namepsace
86#endif
Some standard typedefs.
A linear system class for vector right-hand sides.
void re_solve_lapack()
Resolve the banded system.
void solve()
Solve the banded system.
void set_monitor_det(bool flag)
Store the sign of the determinant of the LHS matrix every time a solve is requested on a real system.
int get_det_sign() const
Get the sign of the determinant of the LHS matrix from the linear system just computed.
~BandedLinearSystem()
Destructor for a linear system object.
A matrix class that constructs a BANDED matrix.
Definition: BandedMatrix.h:16
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt