mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
* Added generic unary operators (replace Opposite and Conjugate)
* functor templates are not template template parameter anymore (this allows to make templated functors !) * Main page: extented compiler discussion * A small hack to support gcc 3.4 and 4.0 (see the main page) * Fix a cast type issue in Cast * Various doxygen updates (mainly Cwise stuff and added doxygen groups in MatrixBase to split the huge memeber list, still not perfect though) * Updated Gael's email address
This commit is contained in:
@@ -26,12 +26,38 @@
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
// check minor separately in order to avoid the possible creation of a zero-sized
|
||||
// array. Comes from a compilation error with gcc-3.4 or gcc-4 with -ansi -pedantic.
|
||||
// Another solution would be to declare the array like this: T m_data[Size==0?1:Size]; in MatrixStorage
|
||||
// but this is probably not bad to raise such an error at compile time...
|
||||
template<typename Scalar, int _Rows, int _Cols> struct CheckMinor
|
||||
{
|
||||
typedef Matrix<Scalar, _Rows, _Cols> MatrixType;
|
||||
CheckMinor(MatrixType& m1, int r1, int c1)
|
||||
{
|
||||
int rows = m1.rows();
|
||||
int cols = m1.cols();
|
||||
|
||||
Matrix<Scalar, Dynamic, Dynamic> mi = m1.minor(0,0).eval();
|
||||
VERIFY_IS_APPROX(mi, m1.block(1,1,rows-1,cols-1));
|
||||
mi = m1.minor(r1,c1);
|
||||
VERIFY_IS_APPROX(mi.transpose(), m1.transpose().minor(c1,r1));
|
||||
//check operator(), both constant and non-constant, on minor()
|
||||
m1.minor(r1,c1)(0,0) = m1.minor(0,0)(0,0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Scalar> struct CheckMinor<Scalar,1,1>
|
||||
{
|
||||
typedef Matrix<Scalar, 1, 1> MatrixType;
|
||||
CheckMinor(MatrixType&, int, int) {}
|
||||
};
|
||||
|
||||
template<typename MatrixType> void submatrices(const MatrixType& m)
|
||||
{
|
||||
/* this test covers the following files:
|
||||
Row.h Column.h Block.h Minor.h DiagonalCoeffs.h
|
||||
*/
|
||||
|
||||
typedef typename MatrixType::Scalar Scalar;
|
||||
typedef Matrix<Scalar, MatrixType::Traits::RowsAtCompileTime, 1> VectorType;
|
||||
typedef Matrix<Scalar, 1, MatrixType::Traits::ColsAtCompileTime> RowVectorType;
|
||||
@@ -77,15 +103,7 @@ template<typename MatrixType> void submatrices(const MatrixType& m)
|
||||
m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0);
|
||||
|
||||
//check minor()
|
||||
if(rows > 1 && cols > 1)
|
||||
{
|
||||
Matrix<Scalar, Dynamic, Dynamic> mi = m1.minor(0,0).eval();
|
||||
VERIFY_IS_APPROX(mi, m1.block(1,1,rows-1,cols-1));
|
||||
mi = m1.minor(r1,c1);
|
||||
VERIFY_IS_APPROX(mi.transpose(), m1.transpose().minor(c1,r1));
|
||||
//check operator(), both constant and non-constant, on minor()
|
||||
m1.minor(r1,c1)(0,0) = m1.minor(0,0)(0,0);
|
||||
}
|
||||
CheckMinor<Scalar, MatrixType::Traits::RowsAtCompileTime, MatrixType::Traits::ColsAtCompileTime> checkminor(m1,r1,c1);
|
||||
|
||||
//check diagonal()
|
||||
VERIFY_IS_APPROX(m1.diagonal(), m1.transpose().diagonal());
|
||||
|
||||
Reference in New Issue
Block a user