LUDecomposition.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /**
  2. * @file LUDecomposition.h
  3. * @brief: LU-Decomposition of a matrix
  4. * @author: Alexander Freytag, Wolfgang Ortmann
  5. * @date: 22-10-2012
  6. */
  7. // Note: for further matrix operations, you might use the ICE library available at http://www.inf-cv.uni-jena.de/ice.html
  8. #ifndef _NICE_LUDECOMPOSITION_
  9. #define _NICE_LUDECOMPOSITION_
  10. #include "core/vector/MatrixT.h"
  11. #include "core/vector/VectorT.h"
  12. #include "MatrixDecomposition.h"
  13. namespace NICE
  14. {
  15. /*!
  16. LU-Decomposition of a matrix
  17. */
  18. class LUDecomposition : MatrixDecomposition
  19. {
  20. public:
  21. /*!
  22. default constructor
  23. */
  24. LUDecomposition();
  25. /*!
  26. Destructor.
  27. */
  28. virtual ~LUDecomposition();
  29. /**
  30. * @brief decompose a square matrix m into lower and upper triangular matrices L and U
  31. * @date 22-10-2012
  32. * @author Alexander Freytag
  33. * @param m a square matrix
  34. * @param L the resulting lower triangular matrix
  35. * @param U the resulting upper triangular matrix
  36. */
  37. void decompose( const NICE::Matrix & m, NICE::Matrix & L, NICE::Matrix & U);
  38. /**
  39. * @brief solve a linear equation system, using the LU-decomposition of a square matrix m
  40. * @date 22-10-2012
  41. * @author Alexander Freytag
  42. * @param LU the given LU-decomposition of a square matrix m
  43. * @param indx vector containing information about the exchange of rows during the decomposition (when pivotization is done)
  44. * @param b the right-hand-side of the linear equation system
  45. */
  46. NICE::Vector solve( const NICE::Matrix &LU,const NICE::VectorT<int> &indx, const NICE::Vector &b);
  47. /**
  48. * @brief decompose a square matrix m into lower and upper triangular matrices L and U, which are packed into a single matrix
  49. * @date 22-10-2012
  50. * @author Alexander Freytag
  51. * @param m a square matrix
  52. * @param LU the decomposition of m in a single matrix (LU_ij: i<=j -> LU_ij=U_ij, i>j -> LU_ij=L_ij, L_ii = 1.0)
  53. * @param indx vector containing information about the exchange of rows during the decomposition (when pivotization is done)
  54. * @param pivot use pivotization? (default true)
  55. */
  56. void decomposePacked(const NICE::Matrix & m, NICE::Matrix & LU, NICE::VectorT<int> & indx, bool pivot=true);
  57. /**
  58. * @brief decompose a square matrix m into lower and upper triangular matrices L and U, which are packed into a single matrix, NO pivotization
  59. * @date 22-10-2012
  60. * @author Alexander Freytag
  61. * @param m a square matrix
  62. * @param LU the decomposition of m in a single matrix (LU_ij: i<=j -> LU_ij=U_ij, i>j -> LU_ij=L_ij, L_ii = 1.0)
  63. */
  64. void decomposePacked(const NICE::Matrix & m, NICE::Matrix & LU);
  65. protected:
  66. };
  67. } //namespace
  68. #endif