the version sent as small feature

This commit is contained in:
Andreas Fabri 2015-04-03 08:45:16 +02:00
parent 71aed48848
commit 06a102731b
8 changed files with 49 additions and 565 deletions

View File

@ -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 <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1SparseMatrix.html">`Eigen::SparseMatrix` </a>
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<T>`
\sa `CGAL::Eigen_sparse_symmetric_matrix<T>`
\sa `CGAL::Eigen_vector<T>`
\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 <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1SparseMatrix.html">`Eigen::SparseMatrix` </a>
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<T>`
\sa `CGAL::Eigen_sparse_symmetric_matrix<T>`
\sa `CGAL::Eigen_sparse_matrix<T>`
\sa `CGAL::Eigen_vector<T>`
\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
<a href="http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html">`Eigen::Matrix`</a>.
\cgalModels `SvdTraits::Matrix`
\tparam T Number type.
\sa `CGAL::Eigen_svd`
\sa `CGAL::Eigen_vector<T>`
*/
template< typename T >
class Eigen_matrix {
public:
};
} /* end namespace CGAL */

View File

@ -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<FT> Vector;
typedef Eigen_matrix<FT> Matrix;
}; /* end Eigen_svd */
} /* end namespace CGAL */

View File

@ -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 <a href="http://eigen.tuxfamily.org/dox/classEigen_1_1Matrix.html"> </a>,
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<T>`
\sa `CGAL::Eigen_sparse_matrix<T>`
\sa `CGAL::Eigen_sparse_symmetric_matrix<T>`
\sa http://eigen.tuxfamily.org
*/
template< typename T >

View File

@ -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<int,int> 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<NT>` fulfill these requirements.
*/
template <class Forward_iterator>
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<int,int> 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 */

View File

@ -1,6 +1,7 @@
/*!
\ingroup PkgSolverConcepts
\cgalConcept
The concept `SparseLinearAlgebraTraits_d` is used to solve sparse linear systems <I>A\f$ \times \f$ X = B</I>.
@ -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<T>`
\cgalHasModel `OpenNL::FullVector<T>` in `OpenNL` package
\cgalHasModel `OpenNL::FullVector<T>` 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<T>`
\cgalHasModel `CGAL::Eigen_sparse_symmetric_matrix<T>`
\cgalHasModel `OpenNL::SparseMatrix<T>` in `OpenNL` package

View File

@ -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.
*/

View File

@ -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 <class Forward_iterator>
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 */

View File

@ -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`
*/