diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h index 0748e5f8b09..98cba67ebad 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_matrix.h @@ -4,22 +4,16 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_sparse_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` +The class `Eigen_sparse_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` that represents general matrices, be they symmetric or not. -The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` -Parameters --------------- - -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` \sa `CGAL::Eigen_sparse_symmetric_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org - */ template< typename T > class Eigen_sparse_matrix { @@ -43,21 +37,17 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_sparse_symmetric_matrix` is a C++ wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix`. +The class `Eigen_sparse_symmetric_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" matrix type `Eigen::SparseMatrix` As the matrix is symmetric only the lower triangle part is stored. \cgalModels `SparseLinearAlgebraTraits_d::Matrix` -Parameters --------------- - -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` -\sa `CGAL::Eigen_sparse_symmetric_matrix` +\sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_vector` -\sa http://eigen.tuxfamily.org */ template< typename T > @@ -75,4 +65,29 @@ typedef unspecified_type EigenType; /// @} }; /* end Eigen_sparse_symmetric_matrix */ + + +/*! +\ingroup PkgSolver + +The class `Eigen_matrix` is a wrapper around \ref thirdpartyEigen "Eigen" +matrix type +`Eigen::Matrix`. + + +\cgalModels `SvdTraits::Matrix` + +\tparam T Number type. + +\sa `CGAL::Eigen_svd` +\sa `CGAL::Eigen_vector` + +*/ +template< typename T > +class Eigen_matrix { +public: + +}; + + } /* end namespace CGAL */ diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h index 810308c7874..4bb7061d928 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_svd.h @@ -6,7 +6,7 @@ namespace CGAL { The class `Eigen_svd` provides an algorithm to solve in the least square sense a linear system with a singular value decomposition using -\ref thirdpartyEigen. The field type is `double`. +\ref thirdpartyEigen. \cgalModels `SvdTraits` @@ -15,7 +15,11 @@ square sense a linear system with a singular value decomposition using class Eigen_svd { public: + typedef double FT; + typedef Eigen_vector Vector; + + typedef Eigen_matrix Matrix; }; /* end Eigen_svd */ } /* end namespace CGAL */ diff --git a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h index 1b220eb1ea6..3ce95292cc4 100644 --- a/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h +++ b/Solver_interface/doc/Solver_interface/CGAL/Eigen_vector.h @@ -4,20 +4,19 @@ namespace CGAL { /*! \ingroup PkgSolver -The class `Eigen_vector` is a C++ wrapper around \ref thirdpartyEigen "Eigen" vector, which is a simple array of numbers. -The version 3.1 (or greater) of \ref thirdpartyEigen "Eigen" must be available on the system. +The class `Eigen_vector` is a wrapper around \ref thirdpartyEigen "Eigen" vector +type , +which is a simple array of numbers. +\cgalModels `SvdTraits::Vector` \cgalModels `SparseLinearAlgebraTraits_d::Vector`. -Parameters --------------- -`T`: Number type. +\tparam T Number type. \sa `CGAL::Eigen_solver_traits` \sa `CGAL::Eigen_sparse_matrix` \sa `CGAL::Eigen_sparse_symmetric_matrix` -\sa http://eigen.tuxfamily.org */ template< typename T > diff --git a/Solver_interface/doc/Solver_interface/Concepts/Matrix.h b/Solver_interface/doc/Solver_interface/Concepts/Matrix.h deleted file mode 100644 index c1728429535..00000000000 --- a/Solver_interface/doc/Solver_interface/Concepts/Matrix.h +++ /dev/null @@ -1,354 +0,0 @@ - -/*! -\ingroup PkgKernelDLinAlgConcepts -\cgalConcept - -An instance of data type `Matrix` is a matrix of -variables of number type `NT`. The types `Matrix` and `Vector` -together realize many functions of basic linear algebra. - -*/ - -class Matrix { -public: - -/// \name Types -/// @{ - -/*! -the ring type of the components. -*/ -typedef unspecified_type NT; - -/*! -bidirectional iterator for accessing -all components row-wise. -*/ -typedef unspecified_type iterator; - -/*! -bidirectional iterator for accessing -all components row-wise. -*/ -typedef unspecified_type const_iterator; - - -/*! -random access iterator for accessing row -entries. -*/ -typedef unspecified_type row_iterator; - -/*! -random access iterator for accessing row -entries. -*/ -typedef unspecified_type const_row_iterator; - -/*! -random access iterator for accessing -column entries. -*/ -typedef unspecified_type column_iterator; - -/*! -random access iterator for accessing -column entries. -*/ -typedef unspecified_type const_column_iterator; - -/*! -a tag class for identity initialization -*/ -typedef unspecified_type Identity; - -/*! -the vector type used. -*/ -typedef unspecified_type Vector; - -/// @} - -/// \name Creation -/// @{ - -/*! -creates an instance `M` of type -`Matrix`. -*/ -Matrix(); - -/*! -creates an instance `M` of type -`Matrix` of dimension \f$ n \times n\f$ initialized to the zero matrix. - -*/ -Matrix(int n); - -/*! -creates an instance `M` of -type `Matrix` of dimension \f$ m \times n\f$ initialized to the zero -matrix. -*/ -Matrix(int m, int n); - -/*! -creates an instance -`M` of type `Matrix` of dimension -`p.first`\f$ \times\f$`p.second` initialized to the zero matrix. -*/ -Matrix(std::pair p); - -/*! -creates an -instance `M` of type `Matrix` of dimension \f$ n \times n\f$ -initialized to the identity matrix (times `x`). -*/ -Matrix(int n, Identity, NT x = NT(1)); - -/*! -creates an instance `M` -of type `Matrix` of dimension \f$ m \times n\f$ initialized to the -matrix with `x` entries. -*/ -Matrix(int m, int n, NT x); - -/*! -creates an -instance `M` of type `Matrix`. Let \f$ S\f$ be the ordered set of -\f$ n\f$ column-vectors of common dimension \f$ m\f$ as given by the iterator -range `[first,last)`. `M` is initialized to an \f$ m \times n\f$ -matrix with the columns as specified by \f$ S\f$. - -\pre `Forward_iterator` has a value type `V` from which we require to provide a iterator type `V::const_iterator`, to have `V::value_type == NT`. - -Note that `Vector` or `std::vector` fulfill these requirements. -*/ -template -Matrix(Forward_iterator first, Forward_iterator last); - -/*! -creates an instance -`M` of type `Matrix`. Let \f$ A\f$ be an array of \f$ n\f$ -column-vectors of common dimension \f$ m\f$. `M` is initialized to an -\f$ m \times n\f$ matrix with the columns as specified by \f$ A\f$. -*/ -Matrix(std::vector< Vector > A); - -/// @} - -/// \name Operations -/// @{ - -/*! -returns \f$ n\f$, the number of rows of -`M`. -*/ -int row_dimension() ; - -/*! -returns \f$ m\f$, the number of columns -of `M`. -*/ -int column_dimension() ; - -/*! -returns \f$ (m,n)\f$, the -dimension pair of `M`. -*/ -std::pair dimension() ; - -/*! -returns the \f$ i\f$-th row of `M` (an -\f$ m\f$ - vector). - -\pre \f$ 0 \le i \le m - 1\f$. -*/ -Vector row(int i) ; - -/*! -returns the \f$ i\f$-th column of `M` -(an \f$ n\f$ - vector). - -\pre \f$ 0 \le i \le n - 1\f$. -*/ -Vector column(int i) ; - -/*! -returns \f$ M_{i,j}\f$. -\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le n-1\f$. -*/ -NT& operator()(int i, int j) ; - -/*! -swaps rows \f$ i\f$ and \f$ j\f$. -\pre \f$ 0\le i\le m-1\f$ and \f$ 0\le j\le m-1\f$. - -*/ -void swap_rows(int i, int j) ; - -/*! -swaps columns \f$ i\f$ and -\f$ j\f$. - -\pre \f$ 0\le i\le n-1\f$ and \f$ 0\le j\le n-1\f$. -*/ -void swap_columns(int i, int j) ; - -/*! -an iterator pointing to the -first entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -row_iterator row_begin(int i) ; - -/*! -an iterator pointing beyond -the last entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -row_iterator row_end(int i) ; - -/*! -an iterator pointing to the -first entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -const_row_iterator row_begin(int i) const; - -/*! -an iterator pointing beyond -the last entry of the \f$ i\f$th row. - -\pre \f$ 0\le i\le m-1\f$. -*/ -const_row_iterator row_end(int i) const; - -/*! -an iterator pointing -to the first entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. - -*/ -column_iterator column_begin(int i) ; - -/*! -an iterator pointing -beyond the last entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. -*/ -column_iterator column_end(int i) ; - -/*! -an iterator pointing -to the first entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. - -*/ -const_column_iterator column_begin(int i) const; - -/*! -an iterator pointing -beyond the last entry of the \f$ i\f$th column. - -\pre \f$ 0\le i\le n-1\f$. -*/ -const_column_iterator column_end(int i) const; - - -/*! -an iterator pointing to the first entry -of \f$ M\f$. -*/ -iterator begin(); - -/*! -an iterator pointing beyond the last entry -of \f$ M\f$. -*/ -terator end(); - -/*! -an iterator pointing to the first entry -of \f$ M\f$. -*/ -const_iterator begin() const; - -/*! -an iterator pointing beyond the last entry -of \f$ M\f$. -*/ -const_terator end() const; - - -/*! -Test for equality. -*/ -bool operator==(const Matrix& M1) ; - -/*! -Test for inequality. -*/ -bool operator!=(const Matrix& M1) ; - -/// @} - -/// \name Arithmetic Operators -/// @{ - -/*! -Addition. -\pre `M.row_dimension() == M1.row_dimension()` -\pre `M.column_dimension() == M1.column_dimension()` -*/ -Matrix operator+ (const Matrix& M1); - -/*! - -Subtraction. -\pre `M.row_dimension() == M1.row_dimension()` -\pre `M.column_dimension() == M1.column_dimension()` -*/ -Matrix operator- (const Matrix& M1); - -/*! -Negation. -*/ -Matrix operator-(); - -/*! -Multiplication. - -\pre `M.column_dimension() = M1.row_dimension()` -*/ -Matrix operator*(const Matrix& M1) -; - -/*! -Multiplication with -vector. - -\pre `M.column_dimension() = vec.dimension()` -*/ -Vector operator*(const Vector& vec) ; - -/*! -Multiplication of every entry with `x`. -*/ -Matrix operator*(const NT& x, const Matrix& M); - -/*! -Multiplication of every entry with `x`. -*/ -Matrix operator*(const Matrix& M, const NT& x) ; - -/// @} - -}; /* end Matrix */ - diff --git a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h index 5670f5113ac..d7aee80b141 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SparseLinearAlgebraTraits_d.h @@ -1,6 +1,7 @@ /*! \ingroup PkgSolverConcepts + \cgalConcept The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems A\f$ \times \f$ X = B. @@ -63,24 +64,22 @@ bool linear_solver(const Matrix& A, const Vector& B, Vector& X, NT& D); /// @} +}; /* end SparseLinearAlgebraTraits_d */ + + /*! -\ingroup PkgSolverConcepts \cgalConcept `SparseLinearAlgebraTraits_d::Vector` is a concept of a vector that can be multiplied by a sparse matrix. -\cgalRefines `LinearAlgebraTraits_d::Vector` - \cgalHasModel `CGAL::Eigen_vector` -\cgalHasModel `OpenNL::FullVector` in `OpenNL` package +\cgalHasModel `OpenNL::FullVector` in the `OpenNL` package \sa `SparseLinearAlgebraTraits_d` \sa `SparseLinearAlgebraTraits_d::Matrix` */ -}; /* end SparseLinearAlgebraTraits_d */ - class SparseLinearAlgebraTraits_d::Vector { public: @@ -142,13 +141,11 @@ NT& operator[](int row); }; /* end Vector */ /*! -\ingroup PkgSolverConcepts + \cgalConcept `SparseLinearAlgebraTraits_d::Matrix` is a concept of a sparse matrix class. -\cgalRefines `LinearAlgebraTraits_d::Matrix` - \cgalHasModel `CGAL::Eigen_sparse_matrix` \cgalHasModel `CGAL::Eigen_sparse_symmetric_matrix` \cgalHasModel `OpenNL::SparseMatrix` in `OpenNL` package diff --git a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h index 639ae5a158d..5271089b975 100644 --- a/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h +++ b/Solver_interface/doc/Solver_interface/Concepts/SvdTraits.h @@ -50,7 +50,6 @@ public: }; /* end SvdTraits */ /*! -\ingroup PkgSolverConcepts \cgalConcept Concept of vector type used by the concept SvdTraits. */ @@ -83,7 +82,6 @@ public: /*! -\ingroup PkgSolverConcepts \cgalConcept Concept of matrix type used by the concept SvdTraits. */ diff --git a/Solver_interface/doc/Solver_interface/Concepts/Vector.h b/Solver_interface/doc/Solver_interface/Concepts/Vector.h deleted file mode 100644 index ed8882ec327..00000000000 --- a/Solver_interface/doc/Solver_interface/Concepts/Vector.h +++ /dev/null @@ -1,177 +0,0 @@ - -/*! -\ingroup PkgKernelDLinAlgConcepts -\cgalConcept - -An instance of data type `Vector` is a vector of variables of -number type `NT`. Together with the type `Matrix` it realizes -the basic operations of linear algebra. - -*/ - -class Vector { -public: - -/// \name Types -/// @{ - -/*! -the ring type of the components. -*/ -typedef unspecified_type NT; - -/*! -the iterator type for accessing components. -*/ -typedef unspecified_type iterator; - -/*! -the const iterator type for accessing -components. -*/ -typedef unspecified_type const_iterator; - -/// @} - -/// \name Creation -/// @{ - -/*! -creates an instance `v` of type -`Vector`. -*/ -Vector(); - -/*! -creates an instance `v` of type -`Vector`. `v` is initialized to a vector of dimension \f$ d\f$. - -*/ -Vector(int d); - -/*! -creates an instance `v` of -type `Vector`. `v` is initialized to a vector of dimension -\f$ d\f$ with entries `x`. -*/ -Vector(int d, NT x); - -/*! -creates an -instance `v` of type `Vector`; `v` is initialized to the -vector with entries `set [first,last)`. -\cgalRequires `Forward_iterator` has value type `NT`. -*/ -template -Vector(Forward_iterator first, Forward_iterator last); - -/// @} - -/// \name Operations -/// @{ - -/*! -returns the dimension of `v`. -*/ -int dimension() ; - -/*! -returns true iff `v` is the zero -vector. -*/ -bool is_zero() ; - -/*! -returns the \f$ i\f$-th component of `v`. - -\pre \f$ 0\le i \le v.dimension()-1\f$. -*/ -NT& operator[](int i) ; - -/*! -iterator to the first component. -*/ -iterator begin() ; - -/*! -iterator beyond the last component. -*/ -iterator end() ; - -/*! -iterator to the first component. -*/ -const_iterator begin() const; - -/*! -iterator beyond the last component. -*/ -const_iterator end() const; - - -/*! -Addition. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector operator+(const Vector& v1) ; - -/*! -Subtraction. - -\pre `v.dimension() = v1.dimension()`. -*/ -Vector operator-(const Vector& v1) ; - -/*! -Inner Product. - -\pre `v.dimension() = v1.dimension()`. -*/ -NT operator*(const Vector& v1) ; - -/*! -Negation. -*/ -Vector operator-() ; - -/*! -Addition plus assignment. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector& operator+=(const Vector& v1); - -/*! -Subtraction plus assignment. - -\pre `v.dimension() == v1.dimension()`. -*/ -Vector& operator-=(const Vector& v1); - -/*! -Scalar multiplication plus -assignment. -*/ -Vector& operator*=(const NT& s); - -/*! -Scalar division plus assignment. - -*/ -Vector& operator/=(const NT& s); - -/*! -Component-wise multiplication with number \f$ r\f$. -*/ -Vector operator*(const NT& r, const Vector& v); - -/*! -Component-wise multiplication with number \f$ r\f$. -*/ -Vector operator*(const Vector& v, const NT& r); - -/// @} - -}; /* end Vector */ - diff --git a/Solver_interface/doc/Solver_interface/PackageDescription.txt b/Solver_interface/doc/Solver_interface/PackageDescription.txt index b59e1ad476c..31880f73a87 100644 --- a/Solver_interface/doc/Solver_interface/PackageDescription.txt +++ b/Solver_interface/doc/Solver_interface/PackageDescription.txt @@ -11,7 +11,7 @@ \cgalPkgPicture{solver.png} \cgalPkgSummaryBegin \cgalPkgAuthors{CGAL Editorial Board } -\cgalPkgDesc{This package provides } +\cgalPkgDesc{This package provides concepts and models for solving linear systems with dense or sparse matrices.} \cgalPkgManuals{Chapter_CGAL_and_Solvers,PkgSolver} \cgalPkgSummaryEnd \cgalPkgShortInfoBegin @@ -35,6 +35,8 @@ - `CGAL::Eigen_svd` - `CGAL::Eigen_matrix` - `CGAL::Eigen_vector` +- `CGAL::Eigen_sparse_matrix` +- `CGAL::Eigen_sparse_symmetric_matrix` */