mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-12 19:20:36 +08:00
* remove LargeBit and related stuff
* replaced the Flags template parameter of Matrix by StorageOrder and move it back to the 4th position such that we don't have to worry about the two Max* template parameters * extended EIGEN_USING_MATRIX_TYPEDEFS with the ei_* math functions
This commit is contained in:
parent
2120fed849
commit
f2f48b6560
@ -58,9 +58,7 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
|
||||
ColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = Direction==Vertical ? 1 : MatrixType::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
|
||||
Flags = ((int(RowsAtCompileTime) == Dynamic || int(ColsAtCompileTime) == Dynamic)
|
||||
? (unsigned int)_MatrixTypeNested::Flags
|
||||
: (unsigned int)_MatrixTypeNested::Flags & ~LargeBit) & HereditaryBits,
|
||||
Flags = (unsigned int)_MatrixTypeNested::Flags & HereditaryBits,
|
||||
TraversalSize = Direction==Vertical ? RowsAtCompileTime : ColsAtCompileTime
|
||||
};
|
||||
typedef typename MemberOp::template Cost<InputScalar,int(TraversalSize)> CostOpType;
|
||||
|
@ -72,18 +72,13 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _PacketAccess, _DirectA
|
||||
: (BlockRows==Dynamic ? MatrixType::MaxRowsAtCompileTime : BlockRows),
|
||||
MaxColsAtCompileTime = ColsAtCompileTime == 1 ? 1
|
||||
: (BlockCols==Dynamic ? MatrixType::MaxColsAtCompileTime : BlockCols),
|
||||
MaskLargeBit = ((RowsAtCompileTime != Dynamic && MatrixType::RowsAtCompileTime == Dynamic)
|
||||
|| (ColsAtCompileTime != Dynamic && MatrixType::ColsAtCompileTime == Dynamic))
|
||||
? ~LargeBit
|
||||
: ~(unsigned int)0,
|
||||
RowMajor = int(MatrixType::Flags)&RowMajorBit,
|
||||
InnerSize = RowMajor ? ColsAtCompileTime : RowsAtCompileTime,
|
||||
InnerMaxSize = RowMajor ? MaxColsAtCompileTime : MaxRowsAtCompileTime,
|
||||
MaskPacketAccessBit = (InnerMaxSize == Dynamic || (InnerSize >= ei_packet_traits<Scalar>::size))
|
||||
? PacketAccessBit : 0,
|
||||
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
|
||||
Flags = (MatrixType::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit) & MaskLargeBit)
|
||||
| FlagsLinearAccessBit,
|
||||
Flags = (MatrixType::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit)) | FlagsLinearAccessBit,
|
||||
CoeffReadCost = MatrixType::CoeffReadCost,
|
||||
PacketAccess = _PacketAccess
|
||||
};
|
||||
|
@ -54,10 +54,7 @@ struct ei_traits<DiagonalCoeffs<MatrixType> >
|
||||
: EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime,
|
||||
MatrixType::MaxColsAtCompileTime),
|
||||
MaxColsAtCompileTime = 1,
|
||||
Flags = (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic
|
||||
? (unsigned int)_MatrixTypeNested::Flags
|
||||
: (unsigned int)_MatrixTypeNested::Flags &~ LargeBit)
|
||||
& (HereditaryBits | LinearAccessBit),
|
||||
Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit),
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -51,8 +51,7 @@ struct ei_traits<Product<LhsNested, RhsNested, DiagonalProduct> >
|
||||
CanVectorizeLhs = (!LhsIsDiagonal) && (!(LhsFlags & RowMajorBit)) && (LhsFlags & PacketAccessBit)
|
||||
&& (RowsAtCompileTime % ei_packet_traits<Scalar>::size == 0),
|
||||
|
||||
RemovedBits = ~(((RhsFlags & RowMajorBit) && (!CanVectorizeLhs) ? 0 : RowMajorBit)
|
||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||
RemovedBits = ~((RhsFlags & RowMajorBit) && (!CanVectorizeLhs) ? 0 : RowMajorBit),
|
||||
|
||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
|
||||
| (CanVectorizeLhs || CanVectorizeRhs ? PacketAccessBit : 0),
|
||||
|
@ -108,8 +108,8 @@ template<typename MatrixType, int PacketAccess> class Map
|
||||
* \sa Matrix(const Scalar *, int), Matrix(const Scalar *, int, int),
|
||||
* Matrix::map(const Scalar *)
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
inline Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
|
||||
inline Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>
|
||||
::Matrix(const Scalar *data)
|
||||
{
|
||||
*this = Map<Matrix>(data);
|
||||
|
@ -35,6 +35,7 @@
|
||||
* specify that the number of rows is dynamic, i.e. is not fixed at compile-time.
|
||||
* \param _Cols the number of columns at compile-time. Use the special value \a Dynamic to
|
||||
* specify that the number of columns is dynamic, i.e. is not fixed at compile-time.
|
||||
* \param _StorageOrder can be either RowMajor or ColMajor. The default is ColMajor.
|
||||
* \param _MaxRows the maximum number of rows at compile-time. By default this is equal to \a _Rows.
|
||||
* The most common exception is when you don't know the exact number of rows, but know that
|
||||
* it is smaller than some given value. Then you can set \a _MaxRows to that value, and set
|
||||
@ -43,7 +44,6 @@
|
||||
* The most common exception is when you don't know the exact number of cols, but know that
|
||||
* it is smaller than some given value. Then you can set \a _MaxCols to that value, and set
|
||||
* _Cols to \a Dynamic.
|
||||
* \param _Flags allows to control certain features such as storage order. See the \ref flags "list of flags".
|
||||
*
|
||||
* This single class template covers all kinds of matrix and vectors that Eigen can handle.
|
||||
* All matrix and vector types are just typedefs to specializations of this class template.
|
||||
@ -80,8 +80,8 @@
|
||||
*
|
||||
* Note that most of the API is in the base class MatrixBase.
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags> >
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
|
||||
struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols> >
|
||||
{
|
||||
typedef _Scalar Scalar;
|
||||
enum {
|
||||
@ -89,18 +89,14 @@ struct ei_traits<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags> >
|
||||
ColsAtCompileTime = _Cols,
|
||||
MaxRowsAtCompileTime = _MaxRows,
|
||||
MaxColsAtCompileTime = _MaxCols,
|
||||
Flags = ei_corrected_matrix_flags<
|
||||
_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
_Flags
|
||||
>::ret,
|
||||
Flags = ei_compute_matrix_flags<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>::ret,
|
||||
CoeffReadCost = NumTraits<Scalar>::ReadCost,
|
||||
SupportedAccessPatterns = RandomAccessPattern
|
||||
};
|
||||
};
|
||||
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags> >
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
|
||||
class Matrix : public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols> >
|
||||
{
|
||||
public:
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Matrix)
|
||||
@ -413,17 +409,6 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
|
||||
#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
|
||||
#undef EIGEN_MAKE_TYPEDEFS
|
||||
|
||||
#define EIGEN_MAKE_TYPEDEFS_LARGE(Type, TypeSuffix) \
|
||||
typedef Matrix<Type, Dynamic, Dynamic, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> MatrixXL##TypeSuffix; \
|
||||
typedef Matrix<Type, Dynamic, 1, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> VectorXL##TypeSuffix; \
|
||||
typedef Matrix<Type, 1, Dynamic, EIGEN_DEFAULT_MATRIX_FLAGS | LargeBit> RowVectorXL##TypeSuffix;
|
||||
|
||||
EIGEN_MAKE_TYPEDEFS_LARGE(int, i)
|
||||
EIGEN_MAKE_TYPEDEFS_LARGE(float, f)
|
||||
EIGEN_MAKE_TYPEDEFS_LARGE(double, d)
|
||||
EIGEN_MAKE_TYPEDEFS_LARGE(std::complex<float>, cf)
|
||||
EIGEN_MAKE_TYPEDEFS_LARGE(std::complex<double>, cd)
|
||||
|
||||
#undef EIGEN_MAKE_TYPEDEFS_LARGE
|
||||
|
||||
#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
|
||||
@ -436,7 +421,6 @@ EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, XL)
|
||||
|
||||
#define EIGEN_USING_MATRIX_TYPEDEFS \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \
|
||||
|
@ -148,8 +148,7 @@ struct ei_traits<Product<LhsNested, RhsNested, ProductMode> >
|
||||
|
||||
EvalToRowMajor = RhsRowMajor && (ProductMode==(int)CacheFriendlyProduct ? LhsRowMajor : (!CanVectorizeLhs)),
|
||||
|
||||
RemovedBits = ~((EvalToRowMajor ? 0 : RowMajorBit)
|
||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||
RemovedBits = ~(EvalToRowMajor ? 0 : RowMajorBit),
|
||||
|
||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
|
||||
| EvalBeforeAssigningBit
|
||||
@ -709,26 +708,15 @@ inline Derived& MatrixBase<Derived>::lazyAssign(const Product<Lhs,Rhs,CacheFrien
|
||||
return derived();
|
||||
}
|
||||
|
||||
template<typename T> class ei_product_eval_to_column_major
|
||||
template<typename T> struct ei_product_eval_to_column_major
|
||||
{
|
||||
typedef typename ei_traits<T>::Scalar _Scalar;
|
||||
enum {
|
||||
_Rows = ei_traits<T>::RowsAtCompileTime,
|
||||
_Cols = ei_traits<T>::ColsAtCompileTime,
|
||||
_MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
|
||||
_MaxCols = ei_traits<T>::MaxColsAtCompileTime,
|
||||
_Flags = ei_traits<T>::Flags
|
||||
};
|
||||
|
||||
public:
|
||||
typedef Matrix<_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
ei_corrected_matrix_flags<
|
||||
_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
_Flags
|
||||
>::ret & ~RowMajorBit
|
||||
> type;
|
||||
typedef Matrix<typename ei_traits<T>::Scalar,
|
||||
ei_traits<T>::RowsAtCompileTime,
|
||||
ei_traits<T>::ColsAtCompileTime,
|
||||
ColMajor,
|
||||
ei_traits<T>::MaxRowsAtCompileTime,
|
||||
ei_traits<T>::MaxColsAtCompileTime
|
||||
> type;
|
||||
};
|
||||
|
||||
template<typename T> struct ei_product_copy_rhs
|
||||
|
@ -154,18 +154,10 @@ const unsigned int LowerTriangularBit = 0x800;
|
||||
* means the expression includes sparse matrices and the sparse path has to be taken. */
|
||||
const unsigned int SparseBit = 0x1000;
|
||||
|
||||
/** \ingroup flags
|
||||
*
|
||||
* currently unused. Means the matrix probably has a very big size.
|
||||
* Could eventually be used as a hint to determine which algorithms
|
||||
* to use. */
|
||||
const unsigned int LargeBit = 0x2000;
|
||||
|
||||
// list of flags that are inherited by default
|
||||
const unsigned int HereditaryBits = RowMajorBit
|
||||
| EvalBeforeNestingBit
|
||||
| EvalBeforeAssigningBit
|
||||
| LargeBit
|
||||
| SparseBit;
|
||||
|
||||
// Possible values for the Mode parameter of part() and of extract()
|
||||
|
@ -27,17 +27,9 @@
|
||||
|
||||
template<typename T> struct ei_traits;
|
||||
template<typename T> struct NumTraits;
|
||||
template<typename Scalar, int Rows, int Cols, int MaxRows, int MaxCols, unsigned int SuggestedFlags> class ei_corrected_matrix_flags;
|
||||
|
||||
template<typename _Scalar, int _Rows, int _Cols,
|
||||
int _MaxRows = _Rows, int _MaxCols = _Cols,
|
||||
unsigned int _Flags = ei_corrected_matrix_flags<
|
||||
_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
EIGEN_DEFAULT_MATRIX_FLAGS
|
||||
>::ret
|
||||
>
|
||||
class Matrix;
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder = ColMajor,
|
||||
int _MaxRows = _Rows, int _MaxCols = _Cols> class Matrix;
|
||||
|
||||
template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
|
||||
template<typename ExpressionType> class NestByValue;
|
||||
|
@ -37,8 +37,6 @@
|
||||
#define EIGEN_UNROLLING_LIMIT 100
|
||||
#endif
|
||||
|
||||
#define EIGEN_DEFAULT_MATRIX_FLAGS 0
|
||||
|
||||
/** Define a hint size when dealing with large matrices and L2 cache friendlyness
|
||||
* More precisely, its square value represents the amount of bytes which can be assumed to stay in L2 cache.
|
||||
*/
|
||||
@ -49,7 +47,18 @@
|
||||
#define USING_PART_OF_NAMESPACE_EIGEN \
|
||||
EIGEN_USING_MATRIX_TYPEDEFS \
|
||||
using Eigen::Matrix; \
|
||||
using Eigen::MatrixBase;
|
||||
using Eigen::MatrixBase; \
|
||||
using Eigen::ei_random; \
|
||||
using Eigen::ei_real; \
|
||||
using Eigen::ei_imag; \
|
||||
using Eigen::ei_conj; \
|
||||
using Eigen::ei_abs; \
|
||||
using Eigen::ei_abs2; \
|
||||
using Eigen::ei_sqrt; \
|
||||
using Eigen::ei_exp; \
|
||||
using Eigen::ei_log; \
|
||||
using Eigen::ei_sin; \
|
||||
using Eigen::ei_cos;
|
||||
|
||||
#ifdef NDEBUG
|
||||
# ifndef EIGEN_NO_DEBUG
|
||||
|
@ -154,29 +154,25 @@ template<typename T> struct ei_unpacket_traits
|
||||
};
|
||||
|
||||
|
||||
template<typename Scalar, int Rows, int Cols, int MaxRows, int MaxCols, unsigned int SuggestedFlags>
|
||||
class ei_corrected_matrix_flags
|
||||
template<typename Scalar, int Rows, int Cols, int StorageOrder, int MaxRows, int MaxCols>
|
||||
class ei_compute_matrix_flags
|
||||
{
|
||||
enum { row_major_bit = (Rows != 1 && Cols != 1) // if this is not a vector,
|
||||
// then the storage order really matters,
|
||||
// so let us strictly honor the user's choice.
|
||||
? SuggestedFlags&RowMajorBit
|
||||
: Cols > 1 ? RowMajorBit : 0,
|
||||
inner_max_size = row_major_bit ? MaxCols : MaxRows,
|
||||
is_big = inner_max_size == Dynamic,
|
||||
linear_size = Cols * Rows,
|
||||
packet_access_bit
|
||||
= ei_packet_traits<Scalar>::size > 1
|
||||
&& (is_big || linear_size%ei_packet_traits<Scalar>::size==0)
|
||||
? PacketAccessBit : 0,
|
||||
aligned_bit = packet_access_bit
|
||||
&& (is_big || linear_size%ei_packet_traits<Scalar>::size==0) ? AlignedBit : 0
|
||||
enum {
|
||||
row_major_bit = (Rows != 1 && Cols != 1) // if this is not a vector,
|
||||
// then the storage order really matters,
|
||||
// so let us strictly honor the user's choice.
|
||||
? StorageOrder
|
||||
: Cols > 1 ? RowMajorBit : 0,
|
||||
inner_max_size = row_major_bit ? MaxCols : MaxRows,
|
||||
is_big = inner_max_size == Dynamic,
|
||||
is_packet_size_multiple = (Cols * Rows)%ei_packet_traits<Scalar>::size==0,
|
||||
packet_access_bit = ei_packet_traits<Scalar>::size > 1
|
||||
&& (is_big || is_packet_size_multiple) ? PacketAccessBit : 0,
|
||||
aligned_bit = packet_access_bit && (is_big || is_packet_size_multiple) ? AlignedBit : 0
|
||||
};
|
||||
|
||||
public:
|
||||
enum { ret = (SuggestedFlags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit | PacketAccessBit | RowMajorBit))
|
||||
| LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit | aligned_bit
|
||||
};
|
||||
enum { ret = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit | aligned_bit };
|
||||
};
|
||||
|
||||
template<int _Rows, int _Cols> struct ei_size_at_compile_time
|
||||
@ -186,25 +182,15 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time
|
||||
|
||||
template<typename T, int Sparseness = ei_traits<T>::Flags&SparseBit> class ei_eval;
|
||||
|
||||
template<typename T> class ei_eval<T,Dense>
|
||||
template<typename T> struct ei_eval<T,Dense>
|
||||
{
|
||||
typedef typename ei_traits<T>::Scalar _Scalar;
|
||||
enum {_Rows = ei_traits<T>::RowsAtCompileTime,
|
||||
_Cols = ei_traits<T>::ColsAtCompileTime,
|
||||
_MaxRows = ei_traits<T>::MaxRowsAtCompileTime,
|
||||
_MaxCols = ei_traits<T>::MaxColsAtCompileTime,
|
||||
_Flags = ei_traits<T>::Flags
|
||||
};
|
||||
|
||||
public:
|
||||
typedef Matrix<_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
ei_corrected_matrix_flags<
|
||||
_Scalar,
|
||||
_Rows, _Cols, _MaxRows, _MaxCols,
|
||||
_Flags
|
||||
>::ret
|
||||
> type;
|
||||
typedef Matrix<typename ei_traits<T>::Scalar,
|
||||
ei_traits<T>::RowsAtCompileTime,
|
||||
ei_traits<T>::ColsAtCompileTime,
|
||||
ei_traits<T>::Flags&RowMajorBit ? RowMajor : ColMajor,
|
||||
ei_traits<T>::MaxRowsAtCompileTime,
|
||||
ei_traits<T>::MaxColsAtCompileTime
|
||||
> type;
|
||||
};
|
||||
|
||||
template<typename T> struct ei_unref { typedef T type; };
|
||||
@ -226,7 +212,7 @@ template<typename T, int n=1, typename EvalType = typename ei_eval<T>::type> str
|
||||
{
|
||||
enum {
|
||||
CostEval = (n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost),
|
||||
CostNoEval = (n-1) * int(ei_traits<T>::CoeffReadCost)
|
||||
CostNoEval = (n-1) * int(ei_traits<T>::CoeffReadCost)
|
||||
};
|
||||
typedef typename ei_meta_if<
|
||||
ei_must_nest_by_value<T>::ret,
|
||||
@ -250,9 +236,9 @@ template<unsigned int Flags> struct ei_are_flags_consistent
|
||||
* TODO: could be a good idea to define a big ReturnType struct ??
|
||||
*/
|
||||
template<typename ExpressionType, int RowsOrSize=Dynamic, int Cols=Dynamic> struct BlockReturnType {
|
||||
typedef Block<ExpressionType, (ei_traits<ExpressionType>::RowsAtCompileTime == 1 ? 1 : RowsOrSize),
|
||||
(ei_traits<ExpressionType>::ColsAtCompileTime == 1 ? 1 : RowsOrSize)> SubVectorType;
|
||||
typedef Block<ExpressionType, RowsOrSize, Cols> Type;
|
||||
typedef Block<ExpressionType, (ei_traits<ExpressionType>::RowsAtCompileTime == 1 ? 1 : RowsOrSize),
|
||||
(ei_traits<ExpressionType>::ColsAtCompileTime == 1 ? 1 : RowsOrSize)> SubVectorType;
|
||||
typedef Block<ExpressionType, RowsOrSize, Cols> Type;
|
||||
};
|
||||
|
||||
#endif // EIGEN_META_H
|
||||
|
@ -190,8 +190,8 @@ AngleAxis<Scalar>::toRotationMatrix(void) const
|
||||
*
|
||||
* \sa Matrix(const Quaternion&)
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::Matrix(const AngleAxis<Scalar>& aa)
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>::Matrix(const AngleAxis<Scalar>& aa)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,3,3);
|
||||
*this = aa.toRotationMatrix();
|
||||
@ -201,9 +201,9 @@ Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::Matrix(const AngleAxi
|
||||
*
|
||||
* Set a 3x3 rotation matrix from the angle-axis \a aa
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>&
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::operator=(const AngleAxis<Scalar>& aa)
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>::operator=(const AngleAxis<Scalar>& aa)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,3,3);
|
||||
return *this = aa.toRotationMatrix();
|
||||
|
@ -430,8 +430,8 @@ struct ei_quaternion_assign_impl<Other,4,1>
|
||||
*
|
||||
* \sa Matrix(const AngleAxis&)
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::Matrix(const Quaternion<Scalar>& q)
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>::Matrix(const Quaternion<Scalar>& q)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,3,3);
|
||||
*this = q.toRotationMatrix();
|
||||
@ -441,9 +441,9 @@ Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::Matrix(const Quaterni
|
||||
*
|
||||
* Set a 3x3 rotation matrix from the quaternion \a q
|
||||
*/
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _MaxRows, int _MaxCols, unsigned int _Flags>
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>&
|
||||
Matrix<_Scalar, _Rows, _Cols, _MaxRows, _MaxCols, _Flags>::operator=(const Quaternion<Scalar>& q)
|
||||
template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
|
||||
Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>::operator=(const Quaternion<Scalar>& q)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,3,3);
|
||||
return *this = q.toRotationMatrix();
|
||||
|
@ -72,7 +72,8 @@ template<typename MatrixType> class LU
|
||||
};
|
||||
|
||||
typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, Dynamic,
|
||||
MatrixType::MaxColsAtCompileTime, MaxSmallDimAtCompileTime> KernelReturnType;
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxColsAtCompileTime, MaxSmallDimAtCompileTime> KernelReturnType;
|
||||
|
||||
/** Constructor.
|
||||
*
|
||||
@ -151,6 +152,7 @@ template<typename MatrixType> class LU
|
||||
*/
|
||||
void computeKernel(Matrix<typename MatrixType::Scalar,
|
||||
MatrixType::ColsAtCompileTime, Dynamic,
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxColsAtCompileTime,
|
||||
LU<MatrixType>::MaxSmallDimAtCompileTime
|
||||
> *result) const;
|
||||
@ -372,6 +374,7 @@ typename ei_traits<MatrixType>::Scalar LU<MatrixType>::determinant() const
|
||||
template<typename MatrixType>
|
||||
void LU<MatrixType>::computeKernel(Matrix<typename MatrixType::Scalar,
|
||||
MatrixType::ColsAtCompileTime, Dynamic,
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxColsAtCompileTime,
|
||||
LU<MatrixType>::MaxSmallDimAtCompileTime
|
||||
> *result) const
|
||||
@ -396,7 +399,8 @@ void LU<MatrixType>::computeKernel(Matrix<typename MatrixType::Scalar,
|
||||
* independent vectors in Ker U.
|
||||
*/
|
||||
|
||||
Matrix<Scalar, Dynamic, Dynamic, MatrixType::MaxColsAtCompileTime, MaxSmallDimAtCompileTime>
|
||||
Matrix<Scalar, Dynamic, Dynamic, MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxColsAtCompileTime, MaxSmallDimAtCompileTime>
|
||||
y(-m_lu.corner(TopRight, m_rank, dimker));
|
||||
|
||||
m_lu.corner(TopLeft, m_rank, m_rank)
|
||||
@ -414,8 +418,9 @@ const typename LU<MatrixType>::KernelReturnType
|
||||
LU<MatrixType>::kernel() const
|
||||
{
|
||||
Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime, Dynamic,
|
||||
MatrixType::MaxColsAtCompileTime,
|
||||
LU<MatrixType>::MaxSmallDimAtCompileTime> result(m_lu.cols(), dimensionOfKernel());
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxColsAtCompileTime,
|
||||
LU<MatrixType>::MaxSmallDimAtCompileTime> result(m_lu.cols(), dimensionOfKernel());
|
||||
computeKernel(&result);
|
||||
return result;
|
||||
}
|
||||
@ -446,6 +451,7 @@ bool LU<MatrixType>::solve(
|
||||
|
||||
// Step 2
|
||||
Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime,
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxRowsAtCompileTime,
|
||||
MatrixType::MaxRowsAtCompileTime> l(rows, rows);
|
||||
l.setZero();
|
||||
@ -464,6 +470,7 @@ bool LU<MatrixType>::solve(
|
||||
return false;
|
||||
}
|
||||
Matrix<Scalar, Dynamic, OtherDerived::ColsAtCompileTime,
|
||||
MatrixType::Flags&RowMajorBit,
|
||||
MatrixType::MaxRowsAtCompileTime, OtherDerived::MaxColsAtCompileTime>
|
||||
d(c.corner(TopLeft, m_rank, c.cols()));
|
||||
m_lu.corner(TopLeft, m_rank, m_rank)
|
||||
|
@ -77,8 +77,7 @@ struct ei_traits<Product<LhsNested, RhsNested, SparseProduct> >
|
||||
|
||||
EvalToRowMajor = (RhsFlags & LhsFlags & RowMajorBit),
|
||||
|
||||
RemovedBits = ~((EvalToRowMajor ? 0 : RowMajorBit)
|
||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||
RemovedBits = ~(EvalToRowMajor ? 0 : RowMajorBit),
|
||||
|
||||
Flags = (int(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
|
||||
| EvalBeforeAssigningBit
|
||||
|
@ -33,7 +33,7 @@ void test_commainitializer()
|
||||
VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) );
|
||||
|
||||
double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
|
||||
Matrix3d ref = Map<Matrix<double,3,3,3,3,RowMajorBit> >(data);
|
||||
Matrix3d ref = Map<Matrix<double,3,3,RowMajor> >(data);
|
||||
|
||||
m3 = Matrix3d::Random();
|
||||
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
|
||||
|
@ -46,8 +46,7 @@ template<typename MatrixType> void product(const MatrixType& m)
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RowSquareMatrixType;
|
||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> ColSquareMatrixType;
|
||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
||||
MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,
|
||||
MatrixType::Flags&RowMajorBit ? 0 : RowMajorBit> OtherMajorMatrixType;
|
||||
MatrixType::Flags&RowMajorBit> OtherMajorMatrixType;
|
||||
|
||||
int rows = m.rows();
|
||||
int cols = m.cols();
|
||||
|
@ -31,10 +31,6 @@ void test_product_large()
|
||||
CALL_SUBTEST( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
|
||||
#ifndef EIGEN_DEFAULT_TO_ROW_MAJOR
|
||||
CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,RowMajorBit>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
#else
|
||||
CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,0>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
#endif
|
||||
CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user