aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-21 11:36:00 +0200
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-06-21 11:36:00 +0200
commitdc6ad5e25b786ec6874158b33a77babf14d66941 (patch)
treef3ce86b00aa70851d35e7ac04e0f1209f9cfa55c
parent5f65a89f49a6b9426b09d9b3ce7c31cf015c1879 (diff)
More Index related stuff.
-rw-r--r--Eigen/src/Core/Map.h1
-rw-r--r--Eigen/src/Core/Stride.h18
-rw-r--r--test/basicstuff.cpp4
-rw-r--r--test/cwiseop.cpp4
-rw-r--r--test/determinant.cpp9
-rw-r--r--test/diagonalmatrices.cpp4
-rw-r--r--test/geo_alignedbox.cpp4
-rw-r--r--test/geo_hyperplane.cpp4
-rw-r--r--test/geo_parametrizedline.cpp4
-rw-r--r--test/linearstructure.cpp4
-rw-r--r--test/map.cpp3
-rw-r--r--test/mapstride.cpp7
12 files changed, 36 insertions, 30 deletions
diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h
index cb65b8e00..91ab03c10 100644
--- a/Eigen/src/Core/Map.h
+++ b/Eigen/src/Core/Map.h
@@ -77,6 +77,7 @@ template<typename PlainObjectType, int MapOptions, typename StrideType>
struct ei_traits<Map<PlainObjectType, MapOptions, StrideType> >
: public ei_traits<PlainObjectType>
{
+ typedef typename PlainObjectType::Index Index;
typedef typename PlainObjectType::Scalar Scalar;
enum {
InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
diff --git a/Eigen/src/Core/Stride.h b/Eigen/src/Core/Stride.h
index afae0345e..a965b5a55 100644
--- a/Eigen/src/Core/Stride.h
+++ b/Eigen/src/Core/Stride.h
@@ -55,7 +55,7 @@ template<int _OuterStrideAtCompileTime, int _InnerStrideAtCompileTime>
class Stride
{
public:
-
+ typedef DenseIndex Index;
enum {
InnerStrideAtCompileTime = _InnerStrideAtCompileTime,
OuterStrideAtCompileTime = _OuterStrideAtCompileTime
@@ -69,7 +69,7 @@ class Stride
}
/** Constructor allowing to pass the strides at runtime */
- Stride(int outerStride, int innerStride)
+ Stride(Index outerStride, Index innerStride)
: m_outer(outerStride), m_inner(innerStride)
{
ei_assert(innerStride>=0 && outerStride>=0);
@@ -81,13 +81,13 @@ class Stride
{}
/** \returns the outer stride */
- inline int outer() const { return m_outer.value(); }
+ inline Index outer() const { return m_outer.value(); }
/** \returns the inner stride */
- inline int inner() const { return m_inner.value(); }
+ inline Index inner() const { return m_inner.value(); }
protected:
- ei_variable_if_dynamic<int, OuterStrideAtCompileTime> m_outer;
- ei_variable_if_dynamic<int, InnerStrideAtCompileTime> m_inner;
+ ei_variable_if_dynamic<Index, OuterStrideAtCompileTime> m_outer;
+ ei_variable_if_dynamic<Index, InnerStrideAtCompileTime> m_inner;
};
/** \brief Convenience specialization of Stride to specify only an inner stride */
@@ -96,8 +96,9 @@ class InnerStride : public Stride<0, Value>
{
typedef Stride<0, Value> Base;
public:
+ typedef DenseIndex Index;
InnerStride() : Base() {}
- InnerStride(int v) : Base(0, v) {}
+ InnerStride(Index v) : Base(0, v) {}
};
/** \brief Convenience specialization of Stride to specify only an outer stride */
@@ -106,8 +107,9 @@ class OuterStride : public Stride<Value, 0>
{
typedef Stride<Value, 0> Base;
public:
+ typedef DenseIndex Index;
OuterStride() : Base() {}
- OuterStride(int v) : Base(v,0) {}
+ OuterStride(Index v) : Base(v,0) {}
};
#endif // EIGEN_STRIDE_H
diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp
index e1afc0ecc..3e5626454 100644
--- a/test/basicstuff.cpp
+++ b/test/basicstuff.cpp
@@ -50,8 +50,8 @@ template<typename MatrixType> void basicStuff(const MatrixType& m)
Scalar x = ei_random<Scalar>();
- int r = ei_random<int>(0, rows-1),
- c = ei_random<int>(0, cols-1);
+ Index r = ei_random<Index>(0, rows-1),
+ c = ei_random<Index>(0, cols-1);
m1.coeffRef(r,c) = x;
VERIFY_IS_APPROX(x, m1.coeff(r,c));
diff --git a/test/cwiseop.cpp b/test/cwiseop.cpp
index ee7c8d2c4..dda05e621 100644
--- a/test/cwiseop.cpp
+++ b/test/cwiseop.cpp
@@ -60,8 +60,8 @@ template<typename MatrixType> void cwiseops(const MatrixType& m)
vones = VectorType::Ones(rows),
v3(rows);
- int r = ei_random<int>(0, rows-1),
- c = ei_random<int>(0, cols-1);
+ Index r = ei_random<Index>(0, rows-1),
+ c = ei_random<Index>(0, cols-1);
Scalar s1 = ei_random<Scalar>();
diff --git a/test/determinant.cpp b/test/determinant.cpp
index 7aa9a870d..0e8f98988 100644
--- a/test/determinant.cpp
+++ b/test/determinant.cpp
@@ -31,7 +31,8 @@ template<typename MatrixType> void determinant(const MatrixType& m)
/* this test covers the following files:
Determinant.h
*/
- int size = m.rows();
+ typedef typename MatrixType::Index Index;
+ Index size = m.rows();
MatrixType m1(size, size), m2(size, size);
m1.setRandom();
@@ -41,10 +42,10 @@ template<typename MatrixType> void determinant(const MatrixType& m)
VERIFY_IS_APPROX(MatrixType::Identity(size, size).determinant(), Scalar(1));
VERIFY_IS_APPROX((m1*m2).eval().determinant(), m1.determinant() * m2.determinant());
if(size==1) return;
- int i = ei_random<int>(0, size-1);
- int j;
+ Index i = ei_random<Index>(0, size-1);
+ Index j;
do {
- j = ei_random<int>(0, size-1);
+ j = ei_random<Index>(0, size-1);
} while(j==i);
m2 = m1;
m2.row(i).swap(m2.row(j));
diff --git a/test/diagonalmatrices.cpp b/test/diagonalmatrices.cpp
index 2bc75ba1c..8408dda44 100644
--- a/test/diagonalmatrices.cpp
+++ b/test/diagonalmatrices.cpp
@@ -66,8 +66,8 @@ template<typename MatrixType> void diagonalmatrices(const MatrixType& m)
sq_m1.transpose() = ldm1;
VERIFY_IS_APPROX(sq_m1, ldm1.toDenseMatrix());
- int i = ei_random<int>(0, rows-1);
- int j = ei_random<int>(0, cols-1);
+ Index i = ei_random<Index>(0, rows-1);
+ Index j = ei_random<Index>(0, cols-1);
VERIFY_IS_APPROX( ((ldm1 * m1)(i,j)) , ldm1.diagonal()(i) * m1(i,j) );
VERIFY_IS_APPROX( ((ldm1 * (m1+m2))(i,j)) , ldm1.diagonal()(i) * (m1+m2)(i,j) );
diff --git a/test/geo_alignedbox.cpp b/test/geo_alignedbox.cpp
index e38349b2a..9c347df00 100644
--- a/test/geo_alignedbox.cpp
+++ b/test/geo_alignedbox.cpp
@@ -35,8 +35,8 @@ template<typename BoxType> void alignedbox(const BoxType& _box)
/* this test covers the following files:
AlignedBox.h
*/
-
- const int dim = _box.dim();
+ typedef typename BoxType::Index Index;
+ const Index dim = _box.dim();
typedef typename BoxType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> VectorType;
diff --git a/test/geo_hyperplane.cpp b/test/geo_hyperplane.cpp
index cd19698bc..d40d6719c 100644
--- a/test/geo_hyperplane.cpp
+++ b/test/geo_hyperplane.cpp
@@ -33,8 +33,8 @@ template<typename HyperplaneType> void hyperplane(const HyperplaneType& _plane)
/* this test covers the following files:
Hyperplane.h
*/
-
- const int dim = _plane.dim();
+ typedef typename HyperplaneType::Index Index;
+ const Index dim = _plane.dim();
typedef typename HyperplaneType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, HyperplaneType::AmbientDimAtCompileTime, 1> VectorType;
diff --git a/test/geo_parametrizedline.cpp b/test/geo_parametrizedline.cpp
index 137324a98..43db48df1 100644
--- a/test/geo_parametrizedline.cpp
+++ b/test/geo_parametrizedline.cpp
@@ -33,8 +33,8 @@ template<typename LineType> void parametrizedline(const LineType& _line)
/* this test covers the following files:
ParametrizedLine.h
*/
-
- const int dim = _line.dim();
+ typedef typename LineType::Index Index;
+ const Index dim = _line.dim();
typedef typename LineType::Scalar Scalar;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef Matrix<Scalar, LineType::AmbientDimAtCompileTime, 1> VectorType;
diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp
index 1d86af337..a0b8982dd 100644
--- a/test/linearstructure.cpp
+++ b/test/linearstructure.cpp
@@ -45,8 +45,8 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
Scalar s1 = ei_random<Scalar>();
while (ei_abs(s1)<1e-3) s1 = ei_random<Scalar>();
- int r = ei_random<int>(0, rows-1),
- c = ei_random<int>(0, cols-1);
+ Index r = ei_random<Index>(0, rows-1),
+ c = ei_random<Index>(0, cols-1);
VERIFY_IS_APPROX(-(-m1), m1);
VERIFY_IS_APPROX(m1+m1, 2*m1);
diff --git a/test/map.cpp b/test/map.cpp
index 695d62982..98d513588 100644
--- a/test/map.cpp
+++ b/test/map.cpp
@@ -82,9 +82,10 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& m)
template<typename VectorType> void map_static_methods(const VectorType& m)
{
+ typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
- int size = m.size();
+ Index size = m.size();
// test Map.h
Scalar* array1 = ei_aligned_new<Scalar>(size);
diff --git a/test/mapstride.cpp b/test/mapstride.cpp
index ff6e71a66..072b2134c 100644
--- a/test/mapstride.cpp
+++ b/test/mapstride.cpp
@@ -26,13 +26,14 @@
template<typename VectorType> void map_class_vector(const VectorType& m)
{
+ typedef typename VectorType::Index Index;
typedef typename VectorType::Scalar Scalar;
- int size = m.size();
+ Index size = m.size();
VectorType v = VectorType::Random(size);
- int arraysize = 3*size;
+ Index arraysize = 3*size;
Scalar* array = ei_aligned_new<Scalar>(arraysize);
@@ -68,7 +69,7 @@ template<typename MatrixType> void map_class_matrix(const MatrixType& _m)
MatrixType m = MatrixType::Random(rows,cols);
- int arraysize = 2*(rows+4)*(cols+4);
+ Index arraysize = 2*(rows+4)*(cols+4);
Scalar* array = ei_aligned_new<Scalar>(arraysize);