Ready for alpha2 release.

- complete documentation
- add TODO
- update copyright years
This commit is contained in:
Benoit Jacob 2008-01-07 09:34:21 +00:00
parent 5111ace0d6
commit 8ba3055447
50 changed files with 336 additions and 73 deletions

View File

@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = Eigen
PROJECT_NUMBER = 2.0-alpha1
PROJECT_NUMBER = 2.0-alpha2
OUTPUT_DIRECTORY = ./
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,19 @@
#ifndef EIGEN_DIFFERENCE_H
#define EIGEN_DIFFERENCE_H
/** \class Difference
*
* \brief Expression of the difference (substraction) of two matrices or vectors
*
* \param Lhs the type of the left-hand side
* \param Rhs the type of the right-hand side
*
* This class represents an expression of the difference of two matrices or vectors.
* It is the return type of the operator- between matrices or vectors, and most
* of the time this is the only way it is used.
*
* \sa class Sum, class Opposite
*/
template<typename Lhs, typename Rhs> class Difference : NoOperatorEquals,
public MatrixBase<typename Lhs::Scalar, Difference<Lhs, Rhs> >
{
@ -59,7 +72,12 @@ template<typename Lhs, typename Rhs> class Difference : NoOperatorEquals,
const RhsRef m_rhs;
};
/** \relates MatrixBase */
/** \relates MatrixBase
*
* \returns an expression of the difference of \a mat1 and \a mat2
*
* \sa class Difference, MatrixBase::operator-=()
*/
template<typename Scalar, typename Derived1, typename Derived2>
const Difference<Derived1, Derived2>
operator-(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
@ -67,6 +85,10 @@ operator-(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Der
return Difference<Derived1, Derived2>(mat1.ref(), mat2.ref());
}
/** replaces \c *this by \c *this - \a other.
*
* \returns a reference to \c *this
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
Derived &

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,22 @@
#ifndef EIGEN_FUZZY_H
#define EIGEN_FUZZY_H
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
* determined by \a prec.
*
* \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$
* are considered to be approximately equal within precision \f$ p \f$ if
* \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f]
* For matrices, the comparison is done on all columns.
*
* \note Because of the multiplicativeness of this comparison, one can't use this function
* to check whether \c *this is approximately equal to the zero matrix or vector.
* Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix
* or vector. If you want to test whether \c *this is zero, use isMuchSmallerThan(const
* RealScalar&, RealScalar) instead.
*
* \sa isMuchSmallerThan(const RealScalar&, RealScalar) const
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
bool MatrixBase<Scalar, Derived>::isApprox(
@ -48,6 +64,16 @@ bool MatrixBase<Scalar, Derived>::isApprox(
}
}
/** \returns \c true if the norm of \c *this is much smaller than \a other,
* within the precision determined by \a prec.
*
* \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
* considered to be much smaller than \f$ x \f$ within precision \f$ p \f$ if
* \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f]
* For matrices, the comparison is done on all columns.
*
* \sa isApprox(), isMuchSmallerThan(const MatrixBase<Scalar, OtherDerived>&, RealScalar) const
*/
template<typename Scalar, typename Derived>
bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(
const typename NumTraits<Scalar>::Real& other,
@ -67,6 +93,16 @@ bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(
}
}
/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other,
* within the precision determined by \a prec.
*
* \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is
* considered to be much smaller than a vector \f$ w \f$ within precision \f$ p \f$ if
* \f[ \Vert v \Vert \leqslant p\,\Vert w\Vert. \f]
* For matrices, the comparison is done on all columns.
*
* \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
bool MatrixBase<Scalar, Derived>::isMuchSmallerThan(

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -87,9 +87,11 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, _Storage
typedef MatrixRef<Matrix> Ref;
friend class MatrixRef<Matrix>;
/** \returns a const pointer to the data array of this matrix */
const Scalar* data() const
{ return Storage::m_data; }
/** \returns a pointer to the data array of this matrix */
Scalar* data()
{ return Storage::m_data; }

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -33,13 +33,10 @@
* This class is the base that is inherited by all matrix, vector, and expression
* types. Most of the Eigen API is contained in this class.
*
* This class takes two template parameters:
*
* \a Scalar is the type of the coefficients, e.g. float, double, etc.
*
* \a Derived is the derived type, e.g. a matrix type, or an expression, etc.
* Indeed, a separate MatrixBase type is generated for each derived type
* so one knows from inside MatrixBase, at compile-time, what the derived type is.
* \param Scalar is the type of the coefficients. Recall that Eigen allows
* only the following types for \a Scalar: \c int, \c float, \c double,
* \c std::complex<float>, \c std::complex<double>.
* \param Derived is the derived type, e.g. a matrix type, or an expression, etc.
*
* When writing a function taking Eigen objects as argument, if you want your function
* to take as argument any matrix, vector, or expression, just let it take a
@ -100,8 +97,14 @@ template<typename Scalar, typename Derived> class MatrixBase
typedef typename ForwardDecl<Derived>::Ref Ref;
/** This is the "real scalar" type; if the \a Scalar type is already real numbers
* (e.g. int, float or double) then RealScalar is just the same as \a Scalar. If
* \a Scalar is \a std::complex<T> then RealScalar is \a T. */
* (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If
* \a Scalar is \a std::complex<T> then RealScalar is \a T.
*
* In fact, \a RealScalar is defined as follows:
* \code typedef typename NumTraits<Scalar>::Real RealScalar; \endcode
*
* \sa class NumTraits
*/
typedef typename NumTraits<Scalar>::Real RealScalar;
/** \returns the number of rows. \sa cols(), Traits::RowsAtCompileTime */
@ -124,8 +127,9 @@ template<typename Scalar, typename Derived> class MatrixBase
template<typename OtherDerived>
Derived& operator=(const MatrixBase<Scalar, OtherDerived>& other);
// Special case of the above template operator=, in order to prevent the compiler
//from generating a default operator= (issue hit with g++ 4.1)
/** Special case of the template operator=, in order to prevent the compiler
* from generating a default operator= (issue hit with g++ 4.1)
*/
Derived& operator=(const MatrixBase& other)
{
return this->operator=<Derived>(other);
@ -191,7 +195,7 @@ template<typename Scalar, typename Derived> class MatrixBase
template<typename OtherDerived>
bool isApprox(const OtherDerived& other,
RealScalar prec = precision<Scalar>()) const;
bool isMuchSmallerThan(const typename NumTraits<Scalar>::Real& other,
bool isMuchSmallerThan(const RealScalar& other,
RealScalar prec = precision<Scalar>()) const;
template<typename OtherDerived>
bool isMuchSmallerThan(const MatrixBase<Scalar, OtherDerived>& other,

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,26 @@
#ifndef EIGEN_NUMTRAITS_H
#define EIGEN_NUMTRAITS_H
/** \class NumTraits
*
* \brief Holds some data about the various numeric (i.e. scalar) types allowed by Eigen.
*
* \param T the numeric type about which this class provides data. Recall that Eigen allows
* only the following types for \a T: \c int, \c float, \c double,
* \c std::complex<float>, \c std::complex<double>.
*
* The provided data consists of:
* \li A typedef \a Real, giving the "real part" type of \a T. If \a T is already real,
* then \a Real is just a typedef to \a T. If \a T is \c std::complex<U> then \a Real
* is a typedef to \a U.
* \li A typedef \a FloatingPoint, giving the "floating-point type" of \a T. If \a T is
* \c int, then \a FloatingPoint is a typedef to \c double. Otherwise, \a FloatingPoint
* is a typedef to \a T.
* \li A static const bool \a IsComplex. It is equal to \c true if \a T is a \c std::complex
* type, and to false otherwise.
* \li A static const bool \a HasFloatingPoint. It is equal to \c false if \a T is \c int,
* and to \c true otherwise.
*/
template<typename T> struct NumTraits;
template<> struct NumTraits<int>

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -2,7 +2,7 @@
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2007 Michael Olbrich <michael.olbrich@gmx.net>
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,18 @@
#ifndef EIGEN_OPPOSITE_H
#define EIGEN_OPPOSITE_H
/** \class Opposite
*
* \brief Expression of the opposite of a matrix or vector
*
* \param MatrixType the type of which we are taking the opposite
*
* This class represents an expression of the opposite of a matrix or vector.
* It is the return type of the unary operator- for matrices or vectors, and most
* of the time this is the only way it is used.
*
* \sa class Difference
*/
template<typename MatrixType> class Opposite : NoOperatorEquals,
public MatrixBase<typename MatrixType::Scalar, Opposite<MatrixType> >
{
@ -53,6 +65,8 @@ template<typename MatrixType> class Opposite : NoOperatorEquals,
MatRef m_matrix;
};
/** \returns an expression of the opposite of \c *this
*/
template<typename Scalar, typename Derived>
const Opposite<Derived>
MatrixBase<Scalar, Derived>::operator-() const

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -60,6 +60,19 @@ struct ProductUnroller<Index, 0, Lhs, Rhs>
static void run(int, int, const Lhs&, const Rhs&, typename Lhs::Scalar&) {}
};
/** \class Product
*
* \brief Expression of the product of two matrices
*
* \param Lhs the type of the left-hand side
* \param Rhs the type of the right-hand side
*
* This class represents an expression of the product of two matrices.
* It is the return type of MatrixBase::lazyProduct(), which is used internally by
* the operator* between matrices, and most of the time this is the only way it is used.
*
* \sa class Sum, class Difference
*/
template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
public MatrixBase<typename Lhs::Scalar, Product<Lhs, Rhs> >
{
@ -106,6 +119,15 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals,
const RhsRef m_rhs;
};
/** \returns an expression of the matrix product of \c this and \a other, in this order.
*
* This function is used internally by the operator* between matrices. The difference between
* lazyProduct() and that operator* is that lazyProduct() only constructs and returns an
* expression without actually computing the matrix product, while the operator* between
* matrices immediately evaluates the product and returns the resulting matrix.
*
* \sa class Product
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
const Product<Derived, OtherDerived>
@ -116,7 +138,8 @@ MatrixBase<Scalar, Derived>::lazyProduct(const MatrixBase<Scalar, OtherDerived>
/** \relates MatrixBase
*
* \returns the matrix product of \a mat1 and \a mat2.
* \returns the matrix product of \a mat1 and \a mat2. More precisely, the return statement is:
* \code return mat1.lazyProduct(mat2).eval(); \endcode
*
* \note This function causes an immediate evaluation. If you want to perform a matrix product
* without immediate evaluation, use MatrixBase::lazyProduct() instead.
@ -124,12 +147,16 @@ MatrixBase<Scalar, Derived>::lazyProduct(const MatrixBase<Scalar, OtherDerived>
* \sa MatrixBase::lazyProduct(), MatrixBase::operator*=(const MatrixBase&)
*/
template<typename Scalar, typename Derived1, typename Derived2>
Eval<Product<Derived1, Derived2> >
const Eval<Product<Derived1, Derived2> >
operator*(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
{
return mat1.lazyProduct(mat2).eval();
}
/** replaces \c *this by \c *this * \a other.
*
* \returns a reference to \c *this
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
Derived &

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,17 @@
#ifndef EIGEN_SCALARMULTIPLE_H
#define EIGEN_SCALARMULTIPLE_H
/** \class ScalarMultiple
*
* \brief Expression of the product of a matrix or vector by a scalar
*
* \param FactorTye the type of scalar by which to multiply
* \param MatrixType the type of the matrix or vector to multiply
*
* This class represents an expression of the product of a matrix or vector by a scalar.
* It is the return type of the operator* between a matrix or vector and a scalar, and most
* of the time this is the only way it is used.
*/
template<typename FactorType, typename MatrixType> class ScalarMultiple : NoOperatorEquals,
public MatrixBase<typename MatrixType::Scalar, ScalarMultiple<FactorType, MatrixType> >
{
@ -56,7 +67,7 @@ template<typename FactorType, typename MatrixType> class ScalarMultiple : NoOper
};
#define EIGEN_MAKE_SCALAR_OPS(FactorType) \
/** \relates MatrixBase */ \
/** \relates MatrixBase \sa class ScalarMultiple */ \
template<typename Scalar, typename Derived> \
const ScalarMultiple<FactorType, Derived> \
operator*(const MatrixBase<Scalar, Derived>& matrix, \
@ -65,7 +76,7 @@ operator*(const MatrixBase<Scalar, Derived>& matrix, \
return ScalarMultiple<FactorType, Derived>(matrix.ref(), scalar); \
} \
\
/** \relates MatrixBase */ \
/** \relates MatrixBase \sa class ScalarMultiple */ \
template<typename Scalar, typename Derived> \
const ScalarMultiple<FactorType, Derived> \
operator*(FactorType scalar, \
@ -74,7 +85,7 @@ operator*(FactorType scalar, \
return ScalarMultiple<FactorType, Derived>(matrix.ref(), scalar); \
} \
\
/** \relates MatrixBase */ \
/** \relates MatrixBase \sa class ScalarMultiple */ \
template<typename Scalar, typename Derived> \
const ScalarMultiple<typename NumTraits<FactorType>::FloatingPoint, Derived> \
operator/(const MatrixBase<Scalar, Derived>& matrix, \
@ -86,6 +97,7 @@ operator/(const MatrixBase<Scalar, Derived>& matrix, \
>(1) / scalar); \
} \
\
/** \sa class ScalarMultiple */ \
template<typename Scalar, typename Derived> \
Derived & \
MatrixBase<Scalar, Derived>::operator*=(const FactorType &other) \
@ -93,6 +105,7 @@ MatrixBase<Scalar, Derived>::operator*=(const FactorType &other) \
return *this = *this * other; \
} \
\
/** \sa class ScalarMultiple */ \
template<typename Scalar, typename Derived> \
Derived & \
MatrixBase<Scalar, Derived>::operator/=(const FactorType &other) \

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
@ -26,6 +26,19 @@
#ifndef EIGEN_SUM_H
#define EIGEN_SUM_H
/** \class Sum
*
* \brief Expression of the sum of two matrices or vectors
*
* \param Lhs the type of the left-hand side
* \param Rhs the type of the right-hand side
*
* This class represents an expression of the sum of two matrices or vectors.
* It is the return type of the operator+ between matrices or vectors, and most
* of the time this is the only way it is used.
*
* \sa class Difference
*/
template<typename Lhs, typename Rhs> class Sum : NoOperatorEquals,
public MatrixBase<typename Lhs::Scalar, Sum<Lhs, Rhs> >
{
@ -59,7 +72,12 @@ template<typename Lhs, typename Rhs> class Sum : NoOperatorEquals,
const RhsRef m_rhs;
};
/** \relates MatrixBase */
/** \relates MatrixBase
*
* \returns an expression of the sum of \a mat1 and \a mat2
*
* \sa class Sum, MatrixBase::operator+=()
*/
template<typename Scalar, typename Derived1, typename Derived2>
const Sum<Derived1, Derived2>
operator+(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived2> &mat2)
@ -67,6 +85,10 @@ operator+(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Der
return Sum<Derived1, Derived2>(mat1.ref(), mat2.ref());
}
/** replaces \c *this by \c *this + \a other.
*
* \returns a reference to \c *this
*/
template<typename Scalar, typename Derived>
template<typename OtherDerived>
Derived &

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -13,4 +13,7 @@ In order to generate the documentation of Eigen, please follow these steps:
After doing that, you will find the HTML documentation in the doc/html/ subdirectory of the build directory.
<h2>Note however that the documentation is available online here:
<a href="http://eigen.tuxfamily.org/2">http://eigen.tuxfamily.org/2</a>
*/

78
TODO Normal file
View File

@ -0,0 +1,78 @@
Things that need to be done for 2.0:
The Core modules is essentially ready. Now we need more modules:
- QR decomposition
-> ANY VOLUNTEER? I can provide a scanned copy of Golub&vanLoan.
-> investigate various algorithms, balance numerical stability vs. speed,
maybe go for a different algos for fixed-size (small) vs. dynamic-size
(typically bigger).
-> applications: eigenvalues, eigenspaces, operator norm...
-> more applications: by computing eigenvalues of a companion matrix,
we can provide a general polynomial solver. I can explain that to
a potential volunteer... also this is optional.
- SVD decomposition
-> ANY VOLUNTEER?
-> Same remarks as for QR.
-> applications include pseudo-inverse and linear regression (in Eigen1 we
did linear regression with LU but that was not very good).
- Array
-> ANY VOLUNTEER?
-> We should group in this module all the functionality that consists in
abusing a matrix as an array. Many people have asked for such
functionality:
-> coefficient-wise product (a.k.a. "Schur product" of matrices).
This should return a new expression. Look at Core/Sum.h for a starting
point.
-> Apply some function (such as "exp") to every coefficient of a matrix.
This should return a new expression. Look at Core/Conjugate.h for a
starting point.
-> stack matrices horizontally and vertically to form larger matrix
expressions. Look at Core/Block.h, Core/Minor.h for a starting point.
-> sum over the elements of a vector (look at Core/Trace.h to get
a starting point).
-> Given a matrix, return a vector whose i-th coefficient is the sum
of the coefficients in the i-th column of that matrix. Same for rows.
-> This should return an actual vector (i.e. evaluate immediately),
not an expression, because a loop is involved.
-> Yes, this can be done as "matrix * VectorType::ones()" but we
should implement it separately so as to not be too hard on the
compiler.
- Gaussian elimination
-> LEAVE IT TO ME as I did something similar in Eigen1.
-> I don't call this module LU because I want to code certain operations
such as inverse in an optimized way that bypasses the LU decomposition.
But yes, LU is one of the things that will be provided by this module.
-> Other things to do here: determinant, basis of kernel, basis of range,
antecedent etc...
-> Should be do a "simple linear solver" like in eigen1? Did anybody
use it?
-> linear regression should use SVD instead. However as a temporary
solution we could borrow the implementation from eigen1, using gaussian
elimination.
- Geometry
-> LEAVE IT TO ME as I did something similar in Eigen1.
->low-dimensional geometry (quaternions, cross product, rotations)
->projective geometry(opengl matrices, Qt matrices)
->euclidean geometry (Gram-Schmidt)
- Sparse objects support, by wrapping GMM++
-> ANY VOLUNTEER? I'm looking at the folks already used to GMM++. I will
provide support but am not used to GMM++ so wouldn't like to have to do
all that alone.
-> Goal: provide a nice wrapper around GMM++ with Qt-style copy-on-write
(I can code the copy-on-write part if you don't want to do it)
-> Very important for Krita 2.1 and Step
-> No expression templates here. So the API won't be quite identical to the
rest of Eigen. Should be release under a different name? "Speisen" comes
to mind ;)
-> No need to wrap all of GMM++. Only sparse objects. Only what's useful
for KOffice 2.1 and Step (if you want more, do it).
-> Step uses:
-gmm::cg, constrained_cg
-dantzig algorithm
-types: gmm::row_matrix, col_matrix, rsvector, array1D_reference
-> What is needed for Krita?

View File

@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = Eigen
PROJECT_NUMBER = 2.0-alpha1
PROJECT_NUMBER = 2.0-alpha2
OUTPUT_DIRECTORY = ${CMAKE_BINARY_DIR}/doc
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
@ -152,7 +152,7 @@ LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
EXTRA_PACKAGES = amssymb
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO

View File

@ -4,6 +4,7 @@ o /** @mainpage Eigen
<a href="#overview">Overview</a><br/>
<a href="#license">License</a><br/>
<a href="#features">Features</a><br/>
<a href="#compiler_support">Compiler Support</a><br/>
<a href="#news">News</a><br/>
<a href="#download">Download</a><br/>
<a href="#kde">Relation to KDE</a><br/>
@ -33,11 +34,25 @@ This is similar to the LGPL in spirit. The reason why we don't use the LGPL is t
WARNING: this alpha release is NOT feature complete -- far from it! It contains only the Core module, while several other modules are planned.
Here are general features of Eigen and more specific features of the Core module:
<ul>
<li>Add items</li>
<li>Add more items</li>
<li><a href="http://ubiety.uwaterloo.ca/~tveldhui/papers/Expression-Templates/exprtmpl.html">Expression templates</a> everywhere. This is an optimization (elimination of temporaries, lazy evaluation), but more importantly this allows for a much nicer API, especially as Eigen supports lvalue expressions. For example, the following is valid with Eigen and compiles to optimized code:
\code matrix.row(i) += factor * matrix.row(j); \endcode</li>
<li>Both fixed-size and dynamic-size objects are supported, in a way that allows Eigen to make
all usual optimizations in the case of fixed size, such as loop unrolling.</li>
<li>Both column-vectors and row-vectors are supported, as special cases of matrices.</li>
<li>The following scalar types are supported and well tested: \c int, \c float, \c double,
\c std::complex<float>, \c std::complex<double>. </li>
</ul>
<a name="compiler_support"></a>
<h2>Compiler Support</h2>
Eigen is well tested with recent versions of GCC and gives very good performance with GCC 4.2. For some reason the performance is not so great with GCC 4.1.
Eigen is also well tested on ICC, and gives even better performance with it than with GCC 4.2.
<a name="news"></a>
<h2>News</h2>
@ -45,7 +60,7 @@ If you want to stay informed of Eigen news and releases, please subscribe to our
<a name="download"></a>
<h2>Download</h2>
The source code of the latest release is here: <a href="http://download.tuxfamily.org/eigen/eigen-2.0-alpha1.tar.gz">eigen-2.0-alpha1.tar.gz</a><br/>
The source code of the latest release is here: <a href="http://download.tuxfamily.org/eigen/eigen-2.0-alpha2.tar.gz">eigen-2.0-alpha2.tar.gz</a><br/>
Alternatively, you can checkout the development tree by anonymous svn, by doing:
<pre>svn co svn://anonsvn.kde.org/home/kde/branches/work/eigen2</pre>
@ -70,24 +85,29 @@ Although Eigen itself doesn't have any dependency, the unit-tests require Qt.
<a name="examples"></a>
<h2>Examples</h2>
TODO: write more examples, update this section.
There are a lot of small examples throughout the documentation. TODO: write more interesting,
standalone "demos".
<a name="applications"></a>
<h2>Applications using Eigen</h2>
TODO: update this section
TODO: update this section; make web links
Currently: Kalzium, Avogadro, KSpread(a bit), Krita(a bit)
Planned: much more use in KOffice 2.1, Step (if we make Eigen good enough!)
Please tell us if you know of other interesting projects using Eigen!
<a name="authors"></a>
<h2>Authors</h2>
<b>Lead Developer:</b> Benoit Jacob (jacob at math jussieu fr)
<b>Main Developer:</b> Benoit Jacob (jacob at math jussieu fr)
<b>Contributors during the Eigen 2 development process:</b>
<ul>
<li>Michael Olbrich (michael olbrich at gmx net) : initial loop-unrolling metaprogram</li>
<li>Gael Guennebaud (gael guennebaud at gmail com) : Intel compiler (ICC) support
<li>Christian Mayer (mail at christianmayer de) : reviewed the source code, made many useful suggestions</li>
<li>Michael Olbrich (michael olbrich at gmx net) : initial loop-unrolling metaprogram</li>
<li>and thanks to everyone on the <a href="#mailinglist">mailing list</a> for your input!
</ul>

View File

@ -0,0 +1,2 @@
cout << Matrix2d::identity() << endl;
cout << MatrixXd::identity(3) << endl;

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software

View File

@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra. Eigen itself is part of the KDE project.
//
// Copyright (C) 2006-2007 Benoit Jacob <jacob@math.jussieu.fr>
// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr>
//
// Eigen is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software