mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-21 09:09:36 +08:00
Introduce generic Flagged xpr, remove already Lazy.h and Temporary.h
Rename DefaultLostFlagMask --> HerediraryBits
This commit is contained in:
parent
fd2e9e5c3c
commit
5da60897ab
@ -30,9 +30,8 @@ namespace Eigen {
|
|||||||
#include "src/Core/Coeffs.h"
|
#include "src/Core/Coeffs.h"
|
||||||
#include "src/Core/Assign.h"
|
#include "src/Core/Assign.h"
|
||||||
#include "src/Core/MatrixStorage.h"
|
#include "src/Core/MatrixStorage.h"
|
||||||
|
#include "src/Core/Flagged.h"
|
||||||
#include "src/Core/Matrix.h"
|
#include "src/Core/Matrix.h"
|
||||||
#include "src/Core/Lazy.h"
|
|
||||||
#include "src/Core/Temporary.h"
|
|
||||||
#include "src/Core/CwiseBinaryOp.h"
|
#include "src/Core/CwiseBinaryOp.h"
|
||||||
#include "src/Core/CwiseUnaryOp.h"
|
#include "src/Core/CwiseUnaryOp.h"
|
||||||
#include "src/Core/CwiseNullaryOp.h"
|
#include "src/Core/CwiseNullaryOp.h"
|
||||||
|
@ -71,7 +71,7 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols> >
|
|||||||
|| (ColsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime == Dynamic))
|
|| (ColsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime == Dynamic))
|
||||||
? ~LargeBit
|
? ~LargeBit
|
||||||
: ~(unsigned int)0,
|
: ~(unsigned int)0,
|
||||||
Flags = MatrixType::Flags & (DefaultLostFlagMask | VectorizableBit | DirectAccessBit) & FlagsMaskLargeBit,
|
Flags = MatrixType::Flags & (HereditaryBits | VectorizableBit | DirectAccessBit) & FlagsMaskLargeBit,
|
||||||
CoeffReadCost = MatrixType::CoeffReadCost
|
CoeffReadCost = MatrixType::CoeffReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -69,7 +69,7 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
|||||||
MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = Lhs::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = Lhs::MaxColsAtCompileTime,
|
||||||
Flags = ((int(LhsFlags) | int(RhsFlags)) & (
|
Flags = ((int(LhsFlags) | int(RhsFlags)) & (
|
||||||
DefaultLostFlagMask
|
HereditaryBits
|
||||||
| Like1DArrayBit
|
| Like1DArrayBit
|
||||||
| (ei_functor_traits<BinaryOp>::IsVectorizable && ((int(LhsFlags) & RowMajorBit)==(int(RhsFlags) & RowMajorBit))
|
| (ei_functor_traits<BinaryOp>::IsVectorizable && ((int(LhsFlags) & RowMajorBit)==(int(RhsFlags) & RowMajorBit))
|
||||||
? int(LhsFlags) & int(RhsFlags) & VectorizableBit : 0))),
|
? int(LhsFlags) & int(RhsFlags) & VectorizableBit : 0))),
|
||||||
|
@ -49,7 +49,7 @@ struct ei_traits<CwiseNullaryOp<NullaryOp, MatrixType> >
|
|||||||
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||||
Flags = (MatrixType::Flags
|
Flags = (MatrixType::Flags
|
||||||
& (DefaultLostFlagMask | Like1DArrayBit | (ei_functor_traits<NullaryOp>::IsVectorizable ? VectorizableBit : 0)))
|
& (HereditaryBits | Like1DArrayBit | (ei_functor_traits<NullaryOp>::IsVectorizable ? VectorizableBit : 0)))
|
||||||
| (ei_functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
|
| (ei_functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
|
||||||
CoeffReadCost = ei_functor_traits<NullaryOp>::Cost
|
CoeffReadCost = ei_functor_traits<NullaryOp>::Cost
|
||||||
};
|
};
|
||||||
|
@ -55,7 +55,7 @@ struct ei_traits<CwiseUnaryOp<UnaryOp, MatrixType> >
|
|||||||
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||||
Flags = (MatrixTypeFlags & (
|
Flags = (MatrixTypeFlags & (
|
||||||
DefaultLostFlagMask | Like1DArrayBit
|
HereditaryBits | Like1DArrayBit
|
||||||
| (ei_functor_traits<UnaryOp>::IsVectorizable ? VectorizableBit : 0))),
|
| (ei_functor_traits<UnaryOp>::IsVectorizable ? VectorizableBit : 0))),
|
||||||
CoeffReadCost = MatrixTypeCoeffReadCost + ei_functor_traits<UnaryOp>::Cost
|
CoeffReadCost = MatrixTypeCoeffReadCost + ei_functor_traits<UnaryOp>::Cost
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ struct ei_traits<DiagonalCoeffs<MatrixType> >
|
|||||||
MaxColsAtCompileTime = 1,
|
MaxColsAtCompileTime = 1,
|
||||||
Flags = (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic
|
Flags = (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic
|
||||||
? (unsigned int)_MatrixTypeNested::Flags
|
? (unsigned int)_MatrixTypeNested::Flags
|
||||||
: (unsigned int)_MatrixTypeNested::Flags &~ LargeBit) & DefaultLostFlagMask,
|
: (unsigned int)_MatrixTypeNested::Flags &~ LargeBit) & HereditaryBits,
|
||||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ struct ei_traits<DiagonalMatrix<CoeffsVectorType> >
|
|||||||
ColsAtCompileTime = CoeffsVectorType::SizeAtCompileTime,
|
ColsAtCompileTime = CoeffsVectorType::SizeAtCompileTime,
|
||||||
MaxRowsAtCompileTime = CoeffsVectorType::MaxSizeAtCompileTime,
|
MaxRowsAtCompileTime = CoeffsVectorType::MaxSizeAtCompileTime,
|
||||||
MaxColsAtCompileTime = CoeffsVectorType::MaxSizeAtCompileTime,
|
MaxColsAtCompileTime = CoeffsVectorType::MaxSizeAtCompileTime,
|
||||||
Flags = _CoeffsVectorTypeTypeNested::Flags & DefaultLostFlagMask,
|
Flags = _CoeffsVectorTypeTypeNested::Flags & HereditaryBits,
|
||||||
CoeffReadCost = _CoeffsVectorTypeTypeNested::CoeffReadCost
|
CoeffReadCost = _CoeffsVectorTypeTypeNested::CoeffReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// This file is part of Eigen, a lightweight C++ template library
|
// This file is part of Eigen, a lightweight C++ template library
|
||||||
// for linear algebra. Eigen itself is part of the KDE project.
|
// for linear algebra. Eigen itself is part of the KDE project.
|
||||||
//
|
//
|
||||||
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
// Copyright (C) 2008 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
|
// Eigen is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
@ -23,23 +22,25 @@
|
|||||||
// License and a copy of the GNU General Public License along with
|
// License and a copy of the GNU General Public License along with
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#ifndef EIGEN_TEMPORARY_H
|
#ifndef EIGEN_FLAGGED_H
|
||||||
#define EIGEN_TEMPORARY_H
|
#define EIGEN_FLAGGED_H
|
||||||
|
|
||||||
/** \class Temporary
|
/** \class Flagged
|
||||||
*
|
*
|
||||||
* \brief Expression with the temporary flag set
|
* \brief Expression with modified flags
|
||||||
*
|
*
|
||||||
* \param ExpressionType the type of the object of which we are taking the temporary version
|
* \param ExpressionType the type of the object of which we are modifying the flags
|
||||||
|
* \param Added the flags added to the expression
|
||||||
|
* \param Removed the flags removed from the expression (has priority over Added).
|
||||||
*
|
*
|
||||||
* This class represents the temporary version of an expression.
|
* This class represents an expression whose flags have been modified
|
||||||
* It is the return type of MatrixBase::temporary()
|
* It is the return type of MatrixBase::flagged()
|
||||||
* and most of the time this is the only way it is used.
|
* and most of the time this is the only way it is used.
|
||||||
*
|
*
|
||||||
* \sa MatrixBase::temporary()
|
* \sa MatrixBase::flagged()
|
||||||
*/
|
*/
|
||||||
template<typename ExpressionType>
|
template<typename ExpressionType, unsigned int Added, unsigned int Removed>
|
||||||
struct ei_traits<Temporary<ExpressionType> >
|
struct ei_traits<Flagged<ExpressionType, Added, Removed> >
|
||||||
{
|
{
|
||||||
typedef typename ExpressionType::Scalar Scalar;
|
typedef typename ExpressionType::Scalar Scalar;
|
||||||
enum {
|
enum {
|
||||||
@ -47,19 +48,19 @@ struct ei_traits<Temporary<ExpressionType> >
|
|||||||
ColsAtCompileTime = ExpressionType::ColsAtCompileTime,
|
ColsAtCompileTime = ExpressionType::ColsAtCompileTime,
|
||||||
MaxRowsAtCompileTime = ExpressionType::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = ExpressionType::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = ExpressionType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = ExpressionType::MaxColsAtCompileTime,
|
||||||
Flags = ExpressionType::Flags,
|
Flags = (ExpressionType::Flags | Added) & ~Removed,
|
||||||
CoeffReadCost = ExpressionType::CoeffReadCost
|
CoeffReadCost = ExpressionType::CoeffReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ExpressionType> class Temporary
|
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged
|
||||||
: public MatrixBase<Temporary<ExpressionType> >
|
: public MatrixBase<Flagged<ExpressionType, Added, Removed> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Temporary)
|
EIGEN_GENERIC_PUBLIC_INTERFACE(Flagged)
|
||||||
|
|
||||||
inline Temporary(const ExpressionType& matrix) : m_expression(matrix) {}
|
inline Flagged(const ExpressionType& matrix) : m_expression(matrix) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -71,12 +72,23 @@ template<typename ExpressionType> class Temporary
|
|||||||
return m_expression.coeff(row, col);
|
return m_expression.coeff(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Scalar& _coeffRef(int row, int col)
|
||||||
|
{
|
||||||
|
return m_expression.const_cast_derived().coeffRef(row, col);
|
||||||
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline const PacketScalar _packetCoeff(int row, int col) const
|
inline const PacketScalar _packetCoeff(int row, int col) const
|
||||||
{
|
{
|
||||||
return m_expression.template packetCoeff<LoadMode>(row, col);
|
return m_expression.template packetCoeff<LoadMode>(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int LoadMode>
|
||||||
|
inline void _writePacketCoeff(int row, int col, const PacketScalar& x)
|
||||||
|
{
|
||||||
|
m_expression.const_cast_derived().template writePacketCoeff<LoadMode>(row, col, x);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const ExpressionType m_expression;
|
const ExpressionType m_expression;
|
||||||
};
|
};
|
||||||
@ -84,10 +96,11 @@ template<typename ExpressionType> class Temporary
|
|||||||
/** \returns an expression of the temporary version of *this.
|
/** \returns an expression of the temporary version of *this.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Temporary<Derived>
|
template<unsigned int Added, unsigned int Removed>
|
||||||
MatrixBase<Derived>::temporary() const
|
inline const Flagged<Derived, Added, Removed>
|
||||||
|
MatrixBase<Derived>::flagged() const
|
||||||
{
|
{
|
||||||
return Temporary<Derived>(derived());
|
return Flagged<Derived, Added, Removed>(derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_TEMPORARY_H
|
#endif // EIGEN_FLAGGED_H
|
@ -1,97 +0,0 @@
|
|||||||
// 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-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 Lesser General Public
|
|
||||||
// License as published by the Free Software Foundation; either
|
|
||||||
// version 3 of the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Alternatively, you can redistribute it and/or
|
|
||||||
// modify it under the terms of the GNU General Public License as
|
|
||||||
// published by the Free Software Foundation; either version 2 of
|
|
||||||
// the License, or (at your option) any later version.
|
|
||||||
//
|
|
||||||
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License and a copy of the GNU General Public License along with
|
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
#ifndef EIGEN_LAZY_H
|
|
||||||
#define EIGEN_LAZY_H
|
|
||||||
|
|
||||||
/** \class Lazy
|
|
||||||
*
|
|
||||||
* \brief Expression with the lazy flag set
|
|
||||||
*
|
|
||||||
* \param ExpressionType the type of the object of which we are taking the lazy version
|
|
||||||
*
|
|
||||||
* This class represents the lazy version of an expression.
|
|
||||||
* It is the return type of MatrixBase::lazy()
|
|
||||||
* and most of the time this is the only way it is used.
|
|
||||||
*
|
|
||||||
* \sa MatrixBase::lazy()
|
|
||||||
*/
|
|
||||||
template<typename ExpressionType>
|
|
||||||
struct ei_traits<Lazy<ExpressionType> >
|
|
||||||
{
|
|
||||||
typedef typename ExpressionType::Scalar Scalar;
|
|
||||||
enum {
|
|
||||||
RowsAtCompileTime = ExpressionType::RowsAtCompileTime,
|
|
||||||
ColsAtCompileTime = ExpressionType::ColsAtCompileTime,
|
|
||||||
MaxRowsAtCompileTime = ExpressionType::MaxRowsAtCompileTime,
|
|
||||||
MaxColsAtCompileTime = ExpressionType::MaxColsAtCompileTime,
|
|
||||||
Flags = ExpressionType::Flags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit),
|
|
||||||
CoeffReadCost = ExpressionType::CoeffReadCost
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename ExpressionType> class Lazy
|
|
||||||
: public MatrixBase<Lazy<ExpressionType> >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Lazy)
|
|
||||||
|
|
||||||
inline Lazy(const ExpressionType& matrix) : m_expression(matrix) {}
|
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Lazy)
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
inline int _rows() const { return m_expression.rows(); }
|
|
||||||
inline int _cols() const { return m_expression.cols(); }
|
|
||||||
|
|
||||||
inline const Scalar _coeff(int row, int col) const
|
|
||||||
{
|
|
||||||
return m_expression.coeff(row, col);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<int LoadMode>
|
|
||||||
inline PacketScalar _packetCoeff(int row, int col) const
|
|
||||||
{
|
|
||||||
return m_expression.template packetCoeff<LoadMode>(row, col);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const ExpressionType& m_expression;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** \returns an expression of the lazy version of *this.
|
|
||||||
*
|
|
||||||
* Example: \include MatrixBase_lazy.cpp
|
|
||||||
* Output: \verbinclude MatrixBase_lazy.out
|
|
||||||
*/
|
|
||||||
template<typename Derived>
|
|
||||||
inline const Lazy<Derived>
|
|
||||||
MatrixBase<Derived>::lazy() const
|
|
||||||
{
|
|
||||||
return Lazy<Derived>(derived());
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // EIGEN_LAZY_H
|
|
@ -47,7 +47,7 @@ struct ei_traits<Map<MatrixType> >
|
|||||||
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
ColsAtCompileTime = MatrixType::ColsAtCompileTime,
|
||||||
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||||
Flags = MatrixType::Flags & (DefaultLostFlagMask | DirectAccessBit),
|
Flags = MatrixType::Flags & (HereditaryBits | DirectAccessBit),
|
||||||
CoeffReadCost = NumTraits<Scalar>::ReadCost
|
CoeffReadCost = NumTraits<Scalar>::ReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -278,7 +278,9 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
Transpose<Derived> transpose();
|
Transpose<Derived> transpose();
|
||||||
const Transpose<Derived> transpose() const;
|
const Transpose<Derived> transpose() const;
|
||||||
const Transpose<Temporary<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> > >
|
const Transpose<
|
||||||
|
Flagged<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived>
|
||||||
|
, TemporaryBit, 0> >
|
||||||
adjoint() const;
|
adjoint() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
@ -419,8 +421,17 @@ template<typename Derived> class MatrixBase
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void swap(const MatrixBase<OtherDerived>& other);
|
void swap(const MatrixBase<OtherDerived>& other);
|
||||||
|
|
||||||
const Lazy<Derived> lazy() const;
|
template<unsigned int Added, unsigned int Removed>
|
||||||
const Temporary<Derived> temporary() const;
|
const Flagged<Derived, Added, Removed> flagged() const;
|
||||||
|
|
||||||
|
const Flagged<Derived, 0, EvalBeforeNestingBit | EvalBeforeAssigningBit> lazy() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
const Flagged<Derived, TemporaryBit, 0> temporary() const
|
||||||
|
{
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
/** \returns number of elements to skip to pass from one row (resp. column) to another
|
/** \returns number of elements to skip to pass from one row (resp. column) to another
|
||||||
* for a row-major (resp. column-major) matrix.
|
* for a row-major (resp. column-major) matrix.
|
||||||
|
@ -52,7 +52,7 @@ struct ei_traits<Minor<MatrixType> >
|
|||||||
int(MatrixType::MaxRowsAtCompileTime) - 1 : Dynamic,
|
int(MatrixType::MaxRowsAtCompileTime) - 1 : Dynamic,
|
||||||
MaxColsAtCompileTime = (MatrixType::MaxColsAtCompileTime != Dynamic) ?
|
MaxColsAtCompileTime = (MatrixType::MaxColsAtCompileTime != Dynamic) ?
|
||||||
int(MatrixType::MaxColsAtCompileTime) - 1 : Dynamic,
|
int(MatrixType::MaxColsAtCompileTime) - 1 : Dynamic,
|
||||||
Flags = _MatrixTypeNested::Flags & DefaultLostFlagMask,
|
Flags = _MatrixTypeNested::Flags & HereditaryBits,
|
||||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -179,7 +179,7 @@ struct ei_traits<Product<Lhs, Rhs, EvalMode> >
|
|||||||
_Vectorizable = (_LhsVectorizable || _RhsVectorizable) ? 1 : 0,
|
_Vectorizable = (_LhsVectorizable || _RhsVectorizable) ? 1 : 0,
|
||||||
_RowMajor = (RhsFlags & RowMajorBit)
|
_RowMajor = (RhsFlags & RowMajorBit)
|
||||||
&& (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsVectorizable)),
|
&& (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsVectorizable)),
|
||||||
_LostBits = DefaultLostFlagMask & ~(
|
_LostBits = HereditaryBits & ~(
|
||||||
(_RowMajor ? 0 : RowMajorBit)
|
(_RowMajor ? 0 : RowMajorBit)
|
||||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits)
|
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits)
|
||||||
|
@ -227,7 +227,7 @@ struct ei_traits<Product<Lhs, Rhs, EvalMode> >
|
|||||||
_Vectorizable = (_LhsVectorizable || _RhsVectorizable) ? 0 : 0,
|
_Vectorizable = (_LhsVectorizable || _RhsVectorizable) ? 0 : 0,
|
||||||
_RowMajor = (RhsFlags & RowMajorBit)
|
_RowMajor = (RhsFlags & RowMajorBit)
|
||||||
&& (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsVectorizable)),
|
&& (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsVectorizable)),
|
||||||
_LostBits = DefaultLostFlagMask & ~(
|
_LostBits = HereditaryBits & ~(
|
||||||
(_RowMajor ? 0 : RowMajorBit)
|
(_RowMajor ? 0 : RowMajorBit)
|
||||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits)
|
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits)
|
||||||
|
@ -96,7 +96,7 @@ struct ei_traits<PartialRedux<Direction, BinaryOp, MatrixType> >
|
|||||||
MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
|
||||||
Flags = ((int(RowsAtCompileTime) == Dynamic || int(ColsAtCompileTime) == Dynamic)
|
Flags = ((int(RowsAtCompileTime) == Dynamic || int(ColsAtCompileTime) == Dynamic)
|
||||||
? (unsigned int)_MatrixTypeNested::Flags
|
? (unsigned int)_MatrixTypeNested::Flags
|
||||||
: (unsigned int)_MatrixTypeNested::Flags & ~LargeBit) & DefaultLostFlagMask,
|
: (unsigned int)_MatrixTypeNested::Flags & ~LargeBit) & HereditaryBits,
|
||||||
TraversalSize = Direction==Vertical ? RowsAtCompileTime : ColsAtCompileTime,
|
TraversalSize = Direction==Vertical ? RowsAtCompileTime : ColsAtCompileTime,
|
||||||
CoeffReadCost = TraversalSize * _MatrixTypeNested::CoeffReadCost
|
CoeffReadCost = TraversalSize * _MatrixTypeNested::CoeffReadCost
|
||||||
+ (TraversalSize - 1) * ei_functor_traits<BinaryOp>::Cost
|
+ (TraversalSize - 1) * ei_functor_traits<BinaryOp>::Cost
|
||||||
|
@ -125,9 +125,9 @@ MatrixBase<Derived>::transpose() const
|
|||||||
*
|
*
|
||||||
* \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
|
* \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Transpose<Temporary<
|
inline const Transpose<
|
||||||
CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived >
|
Flagged<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived >
|
||||||
> >
|
, TemporaryBit, 0> >
|
||||||
MatrixBase<Derived>::adjoint() const
|
MatrixBase<Derived>::adjoint() const
|
||||||
{
|
{
|
||||||
return conjugate().temporary().transpose();
|
return conjugate().temporary().transpose();
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
/** \class Triangular
|
/** \class Triangular
|
||||||
*
|
*
|
||||||
* \brief Expression of a triangular matrix from a squared matrix
|
* \brief Expression of a triangular matrix from a square matrix
|
||||||
*
|
*
|
||||||
* \param Mode or-ed bit field indicating the triangular part (Upper or Lower) we are taking,
|
* \param Mode or-ed bit field indicating the triangular part (Upper or Lower) we are taking,
|
||||||
* and the property of the diagonal if any (UnitDiagBit or NullDiagBit).
|
* and the property of the diagonal if any (UnitDiagBit or NullDiagBit).
|
||||||
@ -52,7 +52,7 @@
|
|||||||
* lower part of m1 is left unchanged, and optimal loops are employed. Note that
|
* lower part of m1 is left unchanged, and optimal loops are employed. Note that
|
||||||
* m1 might also be resized.
|
* m1 might also be resized.
|
||||||
*
|
*
|
||||||
* Of course, in both examples \c <any \c expression> has to be a squared matrix.
|
* Of course, in both examples \c <any \c expression> has to be a square matrix.
|
||||||
*
|
*
|
||||||
* \sa MatrixBase::upper(), MatrixBase::lower(), class TriangularProduct
|
* \sa MatrixBase::upper(), MatrixBase::lower(), class TriangularProduct
|
||||||
*/
|
*/
|
||||||
@ -89,21 +89,21 @@ template<int Mode, typename MatrixType> class Triangular
|
|||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Triangular)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Triangular)
|
||||||
|
|
||||||
/** Overloaded to keep a Triangular expression */
|
/** Overloaded to keep a Triangular expression */
|
||||||
inline Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose()
|
inline Triangular<(Upper | Lower) ^ Mode, Flagged<Transpose<MatrixType>,TemporaryBit,0> > transpose()
|
||||||
{
|
{
|
||||||
return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary()));
|
return m_matrix.transpose().temporary();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Overloaded to keep a Triangular expression */
|
/** Overloaded to keep a Triangular expression */
|
||||||
inline const Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > > transpose() const
|
inline const Triangular<(Upper | Lower) ^ Mode, Flagged<Transpose<MatrixType>,TemporaryBit,0> > transpose() const
|
||||||
{
|
{
|
||||||
return Triangular<(Upper | Lower) ^ Mode, Temporary<Transpose<MatrixType> > >((m_matrix.transpose().temporary()));
|
return m_matrix.transpose().temporary();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns the product of the inverse of *this with \a other.
|
/** \returns the product of the inverse of *this with \a other.
|
||||||
*
|
*
|
||||||
* This function computes the inverse-matrix matrix product inv(*this) \a other
|
* This function computes the inverse-matrix matrix product inverse(*this) * \a other
|
||||||
* This process is also as forward (resp. backward) substitution if *this is an upper (resp. lower)
|
* It works as a forward (resp. backward) substitution if *this is an upper (resp. lower)
|
||||||
* triangular matrix.
|
* triangular matrix.
|
||||||
*/
|
*/
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
|
@ -44,13 +44,16 @@ const unsigned int UnitDiagBit = 0x80; ///< means all diagonal coefficients
|
|||||||
const unsigned int NullLowerBit = 0x200; ///< means the strictly triangular lower part is 0
|
const unsigned int NullLowerBit = 0x200; ///< means the strictly triangular lower part is 0
|
||||||
const unsigned int NullUpperBit = 0x400; ///< means the strictly triangular upper part is 0
|
const unsigned int NullUpperBit = 0x400; ///< means the strictly triangular upper part is 0
|
||||||
const unsigned int DirectAccessBit = 0x800; ///< means the underlying matrix data can be direclty accessed
|
const unsigned int DirectAccessBit = 0x800; ///< means the underlying matrix data can be direclty accessed
|
||||||
|
const unsigned int TemporaryBit = 0x1000; ///< means the expression should be copied by value when nested
|
||||||
|
|
||||||
enum { Upper=NullLowerBit, Lower=NullUpperBit };
|
enum { Upper=NullLowerBit, Lower=NullUpperBit };
|
||||||
enum { Aligned=0, UnAligned=1 };
|
enum { Aligned=0, UnAligned=1 };
|
||||||
|
|
||||||
// list of flags that are lost by default
|
// list of flags that are inherited by default
|
||||||
const unsigned int DefaultLostFlagMask = ~(VectorizableBit | Like1DArrayBit | DirectAccessBit
|
const unsigned int HereditaryBits = RowMajorBit
|
||||||
| NullDiagBit | UnitDiagBit | NullLowerBit | NullUpperBit);
|
| EvalBeforeNestingBit
|
||||||
|
| EvalBeforeAssigningBit
|
||||||
|
| LargeBit;
|
||||||
|
|
||||||
enum { ConditionalJumpCost = 5 };
|
enum { ConditionalJumpCost = 5 };
|
||||||
enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight };
|
enum CornerType { TopLeft, TopRight, BottomLeft, BottomRight };
|
||||||
|
@ -34,8 +34,7 @@ template<typename _Scalar, int _Rows, int _Cols,
|
|||||||
int _MaxRows = _Rows, int _MaxCols = _Cols>
|
int _MaxRows = _Rows, int _MaxCols = _Cols>
|
||||||
class Matrix;
|
class Matrix;
|
||||||
|
|
||||||
template<typename ExpressionType> class Lazy;
|
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
|
||||||
template<typename ExpressionType> class Temporary;
|
|
||||||
template<typename MatrixType> class Minor;
|
template<typename MatrixType> class Minor;
|
||||||
template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic> class Block;
|
template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic> class Block;
|
||||||
template<typename MatrixType> class Transpose;
|
template<typename MatrixType> class Transpose;
|
||||||
|
@ -135,6 +135,7 @@ typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
|
|||||||
typedef typename Base::PacketScalar PacketScalar; \
|
typedef typename Base::PacketScalar PacketScalar; \
|
||||||
typedef typename Eigen::ei_nested<Derived>::type Nested; \
|
typedef typename Eigen::ei_nested<Derived>::type Nested; \
|
||||||
typedef typename Eigen::ei_eval<Derived>::type Eval; \
|
typedef typename Eigen::ei_eval<Derived>::type Eval; \
|
||||||
|
typedef Eigen::Flagged<Derived, TemporaryBit, 0> Temporary; \
|
||||||
enum { RowsAtCompileTime = Base::RowsAtCompileTime, \
|
enum { RowsAtCompileTime = Base::RowsAtCompileTime, \
|
||||||
ColsAtCompileTime = Base::ColsAtCompileTime, \
|
ColsAtCompileTime = Base::ColsAtCompileTime, \
|
||||||
MaxRowsAtCompileTime = Base::MaxRowsAtCompileTime, \
|
MaxRowsAtCompileTime = Base::MaxRowsAtCompileTime, \
|
||||||
|
@ -194,12 +194,7 @@ template<typename T> struct ei_unconst<const T> { typedef T type; };
|
|||||||
|
|
||||||
template<typename T> struct ei_is_temporary
|
template<typename T> struct ei_is_temporary
|
||||||
{
|
{
|
||||||
enum { ret = 0 };
|
enum { ret = ei_traits<T>::Flags & TemporaryBit };
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T> struct ei_is_temporary<Temporary<T> >
|
|
||||||
{
|
|
||||||
enum { ret = 1 };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T, int n=1> struct ei_nested
|
template<typename T, int n=1> struct ei_nested
|
||||||
|
Loading…
x
Reference in New Issue
Block a user