solveTriangular.h
Go to the documentation of this file.
1 //===========================================================================
2 /*!
3  *
4  *
5  * \brief Some operations for matrices.
6  *
7  *
8  *
9  *
10  * \author O. Krause
11  * \date 2011
12  *
13  *
14  * \par Copyright 1995-2015 Shark Development Team
15  *
16  * <BR><HR>
17  * This file is part of Shark.
18  * <http://image.diku.dk/shark/>
19  *
20  * Shark is free software: you can redistribute it and/or modify
21  * it under the terms of the GNU Lesser General Public License as published
22  * by the Free Software Foundation, either version 3 of the License, or
23  * (at your option) any later version.
24  *
25  * Shark is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28  * GNU Lesser General Public License for more details.
29  *
30  * You should have received a copy of the GNU Lesser General Public License
31  * along with Shark. If not, see <http://www.gnu.org/licenses/>.
32  *
33  */
34 //===========================================================================
35 
36 #ifndef SHARK_LINALG_SOLVE_TRIANGULAR_SYSTEM_H
37 #define SHARK_LINALG_SOLVE_TRIANGULAR_SYSTEM_H
38 
39 #include <shark/LinAlg/Base.h>
40 
41 namespace shark{ namespace blas{
42 
43 //a few flags governing which type of system is to be solved
44 
45 ///\brief Flag indicating that a system AX=B is to be solved
46 struct SolveAXB{
47  static const bool left = true;
48 };
49 ///\brief Flag indicating that a system XA=B is to be solved
50 struct SolveXAB{
51  static const bool left = false;
52 };
53 
54 /// \brief In-place triangular linear equation solver.
55 ///
56 ///solves a System of linear equations Ax=b or xA=b
57 ///where A is a lower or upper triangular matrix
58 ///The solution is stored in b afterwards.
59 ///Be aware, that the matrix must have full rank!
60 ///This call needs to template parameters indicating which type of
61 ///system is to be solved : Ax=b or xA=b
62 ///The second flag indicates which type of diagonal is used:
63 ///lower unit, upper unit or non unit lower/upper.
64 template<class System, class DiagType,class MatT,class VecT>
66  const matrix_expression<MatT>& A,
68 );
69 /// \brief In-place triangular linear equation solver.
70 ///
71 ///Solves multiple systems of linear equations
72 ///Ax_1=b_1
73 ///Ax_1=b_2
74 ///...
75 ///=>AX=B or XA=B
76 ///where A is a lower or upper triangular m x m matrix.
77 ///And B = (b_1 b_2 ... b_n) is a m x n matrix.
78 ///The result of X is stored in B afterwards.
79 ///Be aware, that the matrix must have full rank!
80 ///This call needs two template parameters indicating which type of
81 ///system is to be solved : Ax=b or xA=b
82 ///The second flag indicates which type of diagonal is used:
83 ///lower unit, upper unit or non unit lower/upper.
84 template<class System, class DiagType,class MatA,class MatB>
86  const matrix_expression<MatA>& A,
88 );
89 
90 /// \brief In-Place solver if A was already cholesky decomposed
91 ///Solves multiple systems of linear equations
92 ///Ax_1=b_1
93 ///Ax_1=b_2
94 ///...
95 ///=>AX=B or XA=B
96 ///given an A which was already Cholesky-decomposed as
97 ///A=LL^T where L is a lower triangular matrix.
98 template<class System,class MatL,class MatB>
100  const matrix_expression<MatL>&L,
102 );
103 
104 /// \brief In-Place solver if A was already cholesky decomposed
105 ///Solves system of linear equations
106 ///Ax=b
107 ///given an A which was already Cholesky-decomposed as
108 ///A=LL^T where L is a lower triangular matrix.
109 template<class System,class MatL,class VecB>
111  const matrix_expression<MatL>& L,
113 );
114 
115 }}
116 #include "Impl/solveTriangular.inl"
117 #endif