Skip to content
Snippets Groups Projects
Commit e7e0735b authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

[MaL] Eigen: cleanup and unify documentation.

Wrong parameter names.
Empty statements.
Unify comment style. /* */ vs ///
parent a2691ee2
No related branches found
No related tags found
No related merge requests found
...@@ -22,8 +22,6 @@ namespace MathLib ...@@ -22,8 +22,6 @@ namespace MathLib
class EigenMatrix; class EigenMatrix;
/**
*/
class EigenLinearSolver final class EigenLinearSolver final
{ {
public: public:
...@@ -35,20 +33,17 @@ public: ...@@ -35,20 +33,17 @@ public:
} }
/** /**
* configure linear solvers * parse linear solvers configuration
* @param option
*/ */
void setOption(const boost::property_tree::ptree &option); void setOption(const boost::property_tree::ptree &option);
/** /**
* configure linear solvers * copy linear solvers options
* @param option
*/ */
void setOption(const EigenOption &option) { _option = option; } void setOption(const EigenOption &option) { _option = option; }
/** /**
* get linear solver options * get linear solver options
* @return
*/ */
EigenOption &getOption() { return _option; } EigenOption &getOption() { return _option; }
......
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
/** /**
* constructor * constructor
* @param n_rows the number of rows (that is equal to the number of columns) * @param n the number of rows (that is equal to the number of columns)
*/ */
explicit EigenMatrix(std::size_t n) :_mat(n, n) {} explicit EigenMatrix(std::size_t n) :_mat(n, n) {}
...@@ -95,16 +95,14 @@ public: ...@@ -95,16 +95,14 @@ public:
this->add(indices.rows, indices.columns, sub_matrix, fkt); this->add(indices.rows, indices.columns, sub_matrix, fkt);
} }
/** /// Add sub-matrix at positions \c row_pos and \c col_pos. If the entries doesn't
* Add sub-matrix at positions \c row_pos and \c col_pos. If the entries doesn't /// exist in the matrix, the values are inserted.
* exist in the matrix, the values are inserted. /// @param row_pos a vector of row position indices. The vector size should
* @param row_pos a vector of row position indices. The vector size should /// equal to the number of rows in the given sub-matrix.
* equal to the number of rows in the given sub-matrix. /// @param col_pos a vector of column position indices. The vector size should
* @param col_pos a vector of column position indices. The vector size should /// equal to the number of columns in the given sub-matrix.
* equal to the number of columns in the given sub-matrix. /// @param sub_matrix a sub-matrix to be added
* @param sub_matrix a sub-matrix to be added /// @param fkt a scaling factor applied to all entries in the sub-matrix
* @param fkt a scaling factor applied to all entries in the sub-matrix
*/
template <class T_DENSE_MATRIX> template <class T_DENSE_MATRIX>
void add(std::vector<std::size_t> const& row_pos, void add(std::vector<std::size_t> const& row_pos,
std::vector<std::size_t> const& col_pos, const T_DENSE_MATRIX &sub_matrix, std::vector<std::size_t> const& col_pos, const T_DENSE_MATRIX &sub_matrix,
......
...@@ -15,9 +15,7 @@ ...@@ -15,9 +15,7 @@
namespace MathLib namespace MathLib
{ {
/** /// \brief Option for Eigen sparse solver
* \brief Option for Eigen sparse solver
*/
struct EigenOption final struct EigenOption final
{ {
/// Solver type /// Solver type
...@@ -45,35 +43,29 @@ struct EigenOption final ...@@ -45,35 +43,29 @@ struct EigenOption final
/// Error tolerance /// Error tolerance
double error_tolerance; double error_tolerance;
/** /// Constructor
* Constructor ///
* /// Default options are CG, no preconditioner, iteration count 500 and
* Default options are CG, no preconditioner, iteration count 500 and /// tolerance 1e-10. Default matrix storage type is CRS.
* tolerance 1e-10. Default matrix storage type is CRS.
*/
EigenOption(); EigenOption();
/** /// return a linear solver type from the solver name
* return a linear solver type from the solver name ///
* /// @param solver_name
* @param solver_name /// @return a linear solver type
* @return a linear solver type /// If there is no solver type matched with the given name, INVALID
* If there is no solver type matched with the given name, INVALID /// is returned.
* is returned.
*/
static SolverType getSolverType(const std::string &solver_name); static SolverType getSolverType(const std::string &solver_name);
/** /// return a preconditioner type from the name
* return a preconditioner type from the name ///
* /// @param precon_name
* @param precon_name /// @return a preconditioner type
* @return a preconditioner type /// If there is no preconditioner type matched with the given name, NONE
* If there is no preconditioner type matched with the given name, NONE /// is returned.
* is returned.
*/
static PreconType getPreconType(const std::string &precon_name); static PreconType getPreconType(const std::string &precon_name);
}; };
} }
#endif //LIS_OPTION_H_ #endif // EIGENOPTION_H_
...@@ -21,18 +21,14 @@ ...@@ -21,18 +21,14 @@
namespace MathLib namespace MathLib
{ {
/** /// Global vector based on Eigen vector
* Global vector based on Eigen vector
*/
class EigenVector final class EigenVector final
{ {
public: public:
using RawVectorType = Eigen::VectorXd; using RawVectorType = Eigen::VectorXd;
/** /// Constructor for initialization of the number of rows
* Constructor for initialization of the number of rows /// @param length number of rows
* @param length number of rows
*/
explicit EigenVector(std::size_t length) : _vec(length) {} explicit EigenVector(std::size_t length) : _vec(length) {}
/// copy constructor /// copy constructor
...@@ -88,10 +84,10 @@ public: ...@@ -88,10 +84,10 @@ public:
void write (const std::string &filename) const { std::ofstream os(filename); os << _vec; } void write (const std::string &filename) const { std::ofstream os(filename); os << _vec; }
#endif #endif
/// return a raw Lis vector object /// return a raw Eigen vector object
RawVectorType& getRawVector() {return _vec; } RawVectorType& getRawVector() {return _vec; }
/// return a raw Lis vector object /// return a raw Eigen vector object
const RawVectorType& getRawVector() const {return _vec; } const RawVectorType& getRawVector() const {return _vec; }
/// vector operation: set data /// vector operation: set data
......
...@@ -38,20 +38,17 @@ public: ...@@ -38,20 +38,17 @@ public:
EigenLisLinearSolver(EigenMatrix &A, boost::property_tree::ptree const*const option = nullptr); EigenLisLinearSolver(EigenMatrix &A, boost::property_tree::ptree const*const option = nullptr);
/** /**
* configure linear solvers * parse linear solvers configuration
* @param option
*/ */
void setOption(const boost::property_tree::ptree &option); void setOption(const boost::property_tree::ptree &option);
/** /**
* configure linear solvers * copy linear solvers options
* @param option
*/ */
void setOption(const LisOption &option) { _option = option; } void setOption(const LisOption &option) { _option = option; }
/** /**
* get linear solver options * get linear solver options
* @return
*/ */
LisOption &getOption() { return _option; } LisOption &getOption() { return _option; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment