OrderingMethods 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // This Source Code Form is subject to the terms of the Mozilla
  5. // Public License v. 2.0. If a copy of the MPL was not distributed
  6. // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. #ifndef EIGEN_ORDERINGMETHODS_MODULE_H
  8. #define EIGEN_ORDERINGMETHODS_MODULE_H
  9. #include "SparseCore"
  10. #include "src/Core/util/DisableStupidWarnings.h"
  11. /**
  12. * \defgroup OrderingMethods_Module OrderingMethods module
  13. *
  14. * This module is currently for internal use only
  15. *
  16. * It defines various built-in and external ordering methods for sparse matrices.
  17. * They are typically used to reduce the number of elements during
  18. * the sparse matrix decomposition (LLT, LU, QR).
  19. * Precisely, in a preprocessing step, a permutation matrix P is computed using
  20. * those ordering methods and applied to the columns of the matrix.
  21. * Using for instance the sparse Cholesky decomposition, it is expected that
  22. * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A).
  23. *
  24. *
  25. * Usage :
  26. * \code
  27. * #include <Eigen/OrderingMethods>
  28. * \endcode
  29. *
  30. * A simple usage is as a template parameter in the sparse decomposition classes :
  31. *
  32. * \code
  33. * SparseLU<MatrixType, COLAMDOrdering<int> > solver;
  34. * \endcode
  35. *
  36. * \code
  37. * SparseQR<MatrixType, COLAMDOrdering<int> > solver;
  38. * \endcode
  39. *
  40. * It is possible as well to call directly a particular ordering method for your own purpose,
  41. * \code
  42. * AMDOrdering<int> ordering;
  43. * PermutationMatrix<Dynamic, Dynamic, int> perm;
  44. * SparseMatrix<double> A;
  45. * //Fill the matrix ...
  46. *
  47. * ordering(A, perm); // Call AMD
  48. * \endcode
  49. *
  50. * \note Some of these methods (like AMD or METIS), need the sparsity pattern
  51. * of the input matrix to be symmetric. When the matrix is structurally unsymmetric,
  52. * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method.
  53. * If your matrix is already symmetric (at leat in structure), you can avoid that
  54. * by calling the method with a SelfAdjointView type.
  55. *
  56. * \code
  57. * // Call the ordering on the pattern of the lower triangular matrix A
  58. * ordering(A.selfadjointView<Lower>(), perm);
  59. * \endcode
  60. */
  61. #ifndef EIGEN_MPL2_ONLY
  62. #include "src/OrderingMethods/Amd.h"
  63. #endif
  64. #include "src/OrderingMethods/Ordering.h"
  65. #include "src/Core/util/ReenableStupidWarnings.h"
  66. #endif // EIGEN_ORDERINGMETHODS_MODULE_H