bug #86 : use internal:: namespace instead of ei_ prefix

This commit is contained in:
Benoit Jacob
2010-10-25 10:15:22 -04:00
parent ca85a1f6c5
commit 4716040703
330 changed files with 7615 additions and 7032 deletions

View File

@@ -134,8 +134,8 @@ void SkylineInplaceLU<MatrixType>::compute() {
const size_t rows = m_lu.rows();
const size_t cols = m_lu.cols();
ei_assert(rows == cols && "We do not (yet) support rectangular LU.");
ei_assert(!m_lu.IsRowMajor && "LU decomposition does not work with rowMajor Storage");
eigen_assert(rows == cols && "We do not (yet) support rectangular LU.");
eigen_assert(!m_lu.IsRowMajor && "LU decomposition does not work with rowMajor Storage");
for (Index row = 0; row < rows; row++) {
const double pivot = m_lu.coeffDiag(row);
@@ -198,8 +198,8 @@ void SkylineInplaceLU<MatrixType>::computeRowMajor() {
const size_t rows = m_lu.rows();
const size_t cols = m_lu.cols();
ei_assert(rows == cols && "We do not (yet) support rectangular LU.");
ei_assert(m_lu.IsRowMajor && "You're trying to apply rowMajor decomposition on a ColMajor matrix !");
eigen_assert(rows == cols && "We do not (yet) support rectangular LU.");
eigen_assert(m_lu.IsRowMajor && "You're trying to apply rowMajor decomposition on a ColMajor matrix !");
for (Index row = 0; row < rows; row++) {
typename MatrixType::InnerLowerIterator llIt(m_lu, row);

View File

@@ -43,8 +43,9 @@
*
*
*/
namespace internal {
template<typename _Scalar, int _Options>
struct ei_traits<SkylineMatrix<_Scalar, _Options> > {
struct traits<SkylineMatrix<_Scalar, _Options> > {
typedef _Scalar Scalar;
typedef Sparse StorageKind;
@@ -57,6 +58,7 @@ struct ei_traits<SkylineMatrix<_Scalar, _Options> > {
CoeffReadCost = NumTraits<Scalar>::ReadCost,
};
};
}
template<typename _Scalar, int _Options>
class SkylineMatrix
@@ -158,8 +160,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
if (outer == inner)
return this->m_data.diag(outer);
@@ -207,8 +209,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
if (outer == inner)
return this->m_data.diag(outer);
@@ -217,34 +219,34 @@ public:
if (col > row) //upper matrix
{
const Index minOuterIndex = inner - m_data.upperProfile(inner);
ei_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + outer - (inner - m_data.upperProfile(inner)));
}
if (col < row) //lower matrix
{
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
ei_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + inner - (outer - m_data.lowerProfile(outer)));
}
} else {
if (outer > inner) //upper matrix
{
const Index maxOuterIndex = inner + m_data.upperProfile(inner);
ei_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + (outer - inner));
}
if (outer < inner) //lower matrix
{
const Index maxInnerIndex = outer + m_data.lowerProfile(outer);
ei_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + (inner - outer));
}
}
}
inline Scalar coeffDiag(Index idx) const {
ei_assert(idx < outerSize());
ei_assert(idx < innerSize());
eigen_assert(idx < outerSize());
eigen_assert(idx < innerSize());
return this->m_data.diag(idx);
}
@@ -252,9 +254,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
@@ -276,9 +278,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
@@ -296,8 +298,8 @@ public:
}
inline Scalar& coeffRefDiag(Index idx) {
ei_assert(idx < outerSize());
ei_assert(idx < innerSize());
eigen_assert(idx < outerSize());
eigen_assert(idx < innerSize());
return this->m_data.diag(idx);
}
@@ -305,17 +307,17 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
ei_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(inner >= minInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + inner - (outer - m_data.lowerProfile(outer)));
} else {
const Index maxInnerIndex = outer + m_data.lowerProfile(outer);
ei_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(inner <= maxInnerIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.lower(m_rowStartIndex[outer] + (inner - outer));
}
}
@@ -324,9 +326,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minInnerIndex = outer - m_data.lowerProfile(outer);
@@ -341,17 +343,17 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
ei_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(outer >= minOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + outer - (inner - m_data.upperProfile(inner)));
} else {
const Index maxOuterIndex = inner + m_data.upperProfile(inner);
ei_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
eigen_assert(outer <= maxOuterIndex && "you try to acces a coeff that do not exist in the storage");
return this->m_data.upper(m_colStartIndex[inner] + (outer - inner));
}
}
@@ -360,9 +362,9 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
ei_assert(inner != outer);
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
eigen_assert(inner != outer);
if (IsRowMajor) {
const Index minOuterIndex = inner - m_data.upperProfile(inner);
@@ -412,8 +414,8 @@ public:
const Index outer = IsRowMajor ? row : col;
const Index inner = IsRowMajor ? col : row;
ei_assert(outer < outerSize());
ei_assert(inner < innerSize());
eigen_assert(outer < outerSize());
eigen_assert(inner < innerSize());
if (outer == inner)
return m_data.diag(col);
@@ -549,7 +551,7 @@ public:
else
m_data.resize(rows(), cols(), rows(), m_colStartIndex[cols()] + 1, m_rowStartIndex[rows()] + 1);
// ei_assert(rows() == cols() && "memory reorganisatrion only works with suare matrix");
// eigen_assert(rows() == cols() && "memory reorganisatrion only works with suare matrix");
//
// Scalar* newArray = new Scalar[m_colStartIndex[cols()] + 1 + m_rowStartIndex[rows()] + 1];
// Index dataIdx = 0;
@@ -601,7 +603,7 @@ public:
const Index diagSize = rows > cols ? cols : rows;
m_innerSize = IsRowMajor ? cols : rows;
ei_assert(rows == cols && "Skyline matrix must be square matrix");
eigen_assert(rows == cols && "Skyline matrix must be square matrix");
if (diagSize % 2) { // diagSize is odd
const Index k = (diagSize - 1) / 2;

View File

@@ -39,26 +39,26 @@
template<typename Derived> class SkylineMatrixBase : public EigenBase<Derived> {
public:
typedef typename ei_traits<Derived>::Scalar Scalar;
typedef typename ei_traits<Derived>::StorageKind StorageKind;
typedef typename ei_index<StorageKind>::type Index;
typedef typename internal::traits<Derived>::Scalar Scalar;
typedef typename internal::traits<Derived>::StorageKind StorageKind;
typedef typename internal::index<StorageKind>::type Index;
enum {
RowsAtCompileTime = ei_traits<Derived>::RowsAtCompileTime,
RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
/**< The number of rows at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */
ColsAtCompileTime = ei_traits<Derived>::ColsAtCompileTime,
ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
/**< The number of columns at compile-time. This is just a copy of the value provided
* by the \a Derived type. If a value is not known at compile-time,
* it is set to the \a Dynamic constant.
* \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */
SizeAtCompileTime = (ei_size_at_compile_time<ei_traits<Derived>::RowsAtCompileTime,
ei_traits<Derived>::ColsAtCompileTime>::ret),
SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
internal::traits<Derived>::ColsAtCompileTime>::ret),
/**< This is equal to the number of coefficients, i.e. the number of
* rows times the number of columns, or to \a Dynamic if this is not
* known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */
@@ -66,7 +66,7 @@ public:
MaxRowsAtCompileTime = RowsAtCompileTime,
MaxColsAtCompileTime = ColsAtCompileTime,
MaxSizeAtCompileTime = (ei_size_at_compile_time<MaxRowsAtCompileTime,
MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
MaxColsAtCompileTime>::ret),
IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
@@ -75,12 +75,12 @@ public:
* we are dealing with a column-vector (if there is only one column) or with
* a row-vector (if there is only one row). */
Flags = ei_traits<Derived>::Flags,
Flags = internal::traits<Derived>::Flags,
/**< This stores expression \ref flags flags which may or may not be inherited by new expressions
* constructed from this one. See the \ref flags "list of flags".
*/
CoeffReadCost = ei_traits<Derived>::CoeffReadCost,
CoeffReadCost = internal::traits<Derived>::CoeffReadCost,
/**< This is a rough measure of how expensive it is to read one coefficient from
* this expression.
*/
@@ -212,8 +212,8 @@ public:
* Notice that in the case of a plain matrix or vector (not an expression) this function just returns
* a const reference, in order to avoid a useless copy.
*/
EIGEN_STRONG_INLINE const typename ei_eval<Derived, IsSkyline>::type eval() const {
return typename ei_eval<Derived>::type(derived());
EIGEN_STRONG_INLINE const typename internal::eval<Derived, IsSkyline>::type eval() const {
return typename internal::eval<Derived>::type(derived());
}
protected:

View File

@@ -27,17 +27,17 @@
template<typename Lhs, typename Rhs, int ProductMode>
struct SkylineProductReturnType {
typedef const typename ei_nested<Lhs, Rhs::RowsAtCompileTime>::type LhsNested;
typedef const typename ei_nested<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
typedef const typename internal::nested<Lhs, Rhs::RowsAtCompileTime>::type LhsNested;
typedef const typename internal::nested<Rhs, Lhs::RowsAtCompileTime>::type RhsNested;
typedef SkylineProduct<LhsNested, RhsNested, ProductMode> Type;
};
template<typename LhsNested, typename RhsNested, int ProductMode>
struct ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
struct internal::traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
// clean the nested types:
typedef typename ei_cleantype<LhsNested>::type _LhsNested;
typedef typename ei_cleantype<RhsNested>::type _RhsNested;
typedef typename internal::cleantype<LhsNested>::type _LhsNested;
typedef typename internal::cleantype<RhsNested>::type _RhsNested;
typedef typename _LhsNested::Scalar Scalar;
enum {
@@ -65,29 +65,30 @@ struct ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
CoeffReadCost = Dynamic
};
typedef typename ei_meta_if<ResultIsSkyline,
typedef typename internal::meta_if<ResultIsSkyline,
SkylineMatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> >,
MatrixBase<SkylineProduct<LhsNested, RhsNested, ProductMode> > >::ret Base;
};
namespace internal {
template<typename LhsNested, typename RhsNested, int ProductMode>
class SkylineProduct : ei_no_assignment_operator,
public ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> >::Base {
class SkylineProduct : no_assignment_operator,
public traits<SkylineProduct<LhsNested, RhsNested, ProductMode> >::Base {
public:
EIGEN_GENERIC_PUBLIC_INTERFACE(SkylineProduct)
private:
typedef typename ei_traits<SkylineProduct>::_LhsNested _LhsNested;
typedef typename ei_traits<SkylineProduct>::_RhsNested _RhsNested;
typedef typename traits<SkylineProduct>::_LhsNested _LhsNested;
typedef typename traits<SkylineProduct>::_RhsNested _RhsNested;
public:
template<typename Lhs, typename Rhs>
EIGEN_STRONG_INLINE SkylineProduct(const Lhs& lhs, const Rhs& rhs)
: m_lhs(lhs), m_rhs(rhs) {
ei_assert(lhs.cols() == rhs.rows());
eigen_assert(lhs.cols() == rhs.rows());
enum {
ProductIsValid = _LhsNested::ColsAtCompileTime == Dynamic
@@ -131,10 +132,10 @@ protected:
// Note that here we force no inlining and separate the setZero() because GCC messes up otherwise
template<typename Lhs, typename Rhs, typename Dest>
EIGEN_DONT_INLINE void ei_skyline_row_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
typedef typename ei_cleantype<Lhs>::type _Lhs;
typedef typename ei_cleantype<Rhs>::type _Rhs;
typedef typename ei_traits<Lhs>::Scalar Scalar;
EIGEN_DONT_INLINE void skyline_row_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
typedef typename cleantype<Lhs>::type _Lhs;
typedef typename cleantype<Rhs>::type _Rhs;
typedef typename traits<Lhs>::Scalar Scalar;
enum {
LhsIsRowMajor = (_Lhs::Flags & RowMajorBit) == RowMajorBit,
@@ -194,10 +195,10 @@ EIGEN_DONT_INLINE void ei_skyline_row_major_time_dense_product(const Lhs& lhs, c
}
template<typename Lhs, typename Rhs, typename Dest>
EIGEN_DONT_INLINE void ei_skyline_col_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
typedef typename ei_cleantype<Lhs>::type _Lhs;
typedef typename ei_cleantype<Rhs>::type _Rhs;
typedef typename ei_traits<Lhs>::Scalar Scalar;
EIGEN_DONT_INLINE void skyline_col_major_time_dense_product(const Lhs& lhs, const Rhs& rhs, Dest& dst) {
typedef typename cleantype<Lhs>::type _Lhs;
typedef typename cleantype<Rhs>::type _Rhs;
typedef typename traits<Lhs>::Scalar Scalar;
enum {
LhsIsRowMajor = (_Lhs::Flags & RowMajorBit) == RowMajorBit,
@@ -258,33 +259,35 @@ EIGEN_DONT_INLINE void ei_skyline_col_major_time_dense_product(const Lhs& lhs, c
}
template<typename Lhs, typename Rhs, typename ResultType,
int LhsStorageOrder = ei_traits<Lhs>::Flags&RowMajorBit>
struct ei_skyline_product_selector;
int LhsStorageOrder = traits<Lhs>::Flags&RowMajorBit>
struct skyline_product_selector;
template<typename Lhs, typename Rhs, typename ResultType>
struct ei_skyline_product_selector<Lhs, Rhs, ResultType, RowMajor> {
typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
struct skyline_product_selector<Lhs, Rhs, ResultType, RowMajor> {
typedef typename traits<typename cleantype<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType & res) {
ei_skyline_row_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
skyline_row_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
}
};
template<typename Lhs, typename Rhs, typename ResultType>
struct ei_skyline_product_selector<Lhs, Rhs, ResultType, ColMajor> {
typedef typename ei_traits<typename ei_cleantype<Lhs>::type>::Scalar Scalar;
struct skyline_product_selector<Lhs, Rhs, ResultType, ColMajor> {
typedef typename traits<typename cleantype<Lhs>::type>::Scalar Scalar;
static void run(const Lhs& lhs, const Rhs& rhs, ResultType & res) {
ei_skyline_col_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
skyline_col_major_time_dense_product<Lhs, Rhs, ResultType > (lhs, rhs, res);
}
};
} // end namespace internal
// template<typename Derived>
// template<typename Lhs, typename Rhs >
// Derived & MatrixBase<Derived>::lazyAssign(const SkylineProduct<Lhs, Rhs, SkylineTimeDenseProduct>& product) {
// typedef typename ei_cleantype<Lhs>::type _Lhs;
// ei_skyline_product_selector<typename ei_cleantype<Lhs>::type,
// typename ei_cleantype<Rhs>::type,
// typedef typename internal::cleantype<Lhs>::type _Lhs;
// internal::skyline_product_selector<typename internal::cleantype<Lhs>::type,
// typename internal::cleantype<Rhs>::type,
// Derived>::run(product.lhs(), product.rhs(), derived());
//
// return derived();

View File

@@ -64,11 +64,11 @@ EIGEN_STRONG_INLINE Derived& operator Op(const Other& scalar) \
#define _EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived, BaseClass) \
typedef BaseClass Base; \
typedef typename Eigen::ei_traits<Derived>::Scalar Scalar; \
typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
typedef typename Eigen::ei_traits<Derived>::StorageKind StorageKind; \
typedef typename Eigen::ei_index<StorageKind>::type Index; \
enum { Flags = Eigen::ei_traits<Derived>::Flags, };
typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
typedef typename Eigen::internal::index<StorageKind>::type Index; \
enum { Flags = Eigen::internal::traits<Derived>::Flags, };
#define EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived) \
_EIGEN_SKYLINE_GENERIC_PUBLIC_INTERFACE(Derived, Eigen::SkylineMatrixBase<Derived>)
@@ -79,20 +79,23 @@ template<typename _Scalar, int _Flags = 0> class DynamicSkylineMatrix;
template<typename _Scalar, int _Flags = 0> class SkylineVector;
template<typename _Scalar, int _Flags = 0> class MappedSkylineMatrix;
template<typename Lhs, typename Rhs> struct ei_skyline_product_mode;
template<typename Lhs, typename Rhs, int ProductMode = ei_skyline_product_mode<Lhs,Rhs>::value> struct SkylineProductReturnType;
namespace internal {
template<typename Lhs, typename Rhs> struct skyline_product_mode;
template<typename Lhs, typename Rhs, int ProductMode = skyline_product_mode<Lhs,Rhs>::value> struct SkylineProductReturnType;
template<typename T> class ei_eval<T,IsSkyline>
template<typename T> class eval<T,IsSkyline>
{
typedef typename ei_traits<T>::Scalar _Scalar;
typedef typename traits<T>::Scalar _Scalar;
enum {
_Flags = ei_traits<T>::Flags
_Flags = traits<T>::Flags
};
public:
typedef SkylineMatrix<_Scalar, _Flags> type;
};
} // end namespace internal
#endif // EIGEN_SKYLINEUTIL_H