Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:48:23

0001 /**
0002  * @file LinAlgUtils.h
0003  * @author Nabil CHOUIKA (SPhN / CEA Saclay)
0004  * @date Feb 4 2016
0005  * @version 1.0
0006  */
0007 
0008 #ifndef LINALGUTILS_H_
0009 #define LINALGUTILS_H_
0010 
0011 #include "matrix/MatrixD.h"
0012 #include "vector/VectorD.h"
0013 
0014 namespace ElemUtils {
0015 class Formatter;
0016 } /* namespace ElemUtils */
0017 
0018 namespace NumA {
0019 class MatrixD;
0020 } /* namespace NumA */
0021 
0022 namespace NumA {
0023 
0024 /**
0025  * @class LinAlgUtils
0026  * @brief Linear algebra routines such as linear solvers. Serves as wrapper for Eigen.
0027  */
0028 
0029 class LinAlgUtils {
0030 public:
0031     enum Method {
0032         ColQR = 0, FullQR, QR, PartialLU, FullLU
0033     };
0034 
0035     /** @brief Solves the linear system \f$ A X = Y \f$ and returns \f$ X \f$ .
0036      *
0037      * @param A Matrix to invert.
0038      * @param Y Right hand side.
0039      * @param method Solver method.
0040      * @return X Solution: VectorD
0041      */
0042     static VectorD solve(const MatrixD & A, const VectorD & Y, Method method =
0043             ColQR);
0044 
0045     /**
0046      * @brief Computes the rank of the matrix with the given method.
0047      * @param A MatrixD
0048      * @param method
0049      * @return rank unsigned int
0050      */
0051     static unsigned int rank(const MatrixD & A, Method method = ColQR);
0052 };
0053 
0054 } // namespace NumA
0055 
0056 #endif /* LINALGUTILS_H_ */