aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_product.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-02-17 09:57:47 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-02-17 09:57:47 +0100
commited461ba9bcb809767546a7ff3852a1dcc5e7e477 (patch)
tree67bb5b8fb2aceb927ac9fe860ff08f585212d061 /test/sparse_product.cpp
parent3bb57e21a8e56917e490a514ab7ebfd3cd3811ab (diff)
Fix sparse_product/sparse_extra unit tests
Diffstat (limited to 'test/sparse_product.cpp')
-rw-r--r--test/sparse_product.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/sparse_product.cpp b/test/sparse_product.cpp
index 948b0026b..a2ea9d5b7 100644
--- a/test/sparse_product.cpp
+++ b/test/sparse_product.cpp
@@ -13,8 +13,9 @@ template<typename SparseMatrixType, typename DenseMatrix, bool IsRowMajor=Sparse
template<typename SparseMatrixType, typename DenseMatrix> struct test_outer<SparseMatrixType,DenseMatrix,false> {
static void run(SparseMatrixType& m2, SparseMatrixType& m4, DenseMatrix& refMat2, DenseMatrix& refMat4) {
- int c = internal::random(0,m2.cols()-1);
- int c1 = internal::random(0,m2.cols()-1);
+ typedef typename SparseMatrixType::Index Index;
+ Index c = internal::random<Index>(0,m2.cols()-1);
+ Index c1 = internal::random<Index>(0,m2.cols()-1);
VERIFY_IS_APPROX(m4=m2.col(c)*refMat2.col(c1).transpose(), refMat4=refMat2.col(c)*refMat2.col(c1).transpose());
VERIFY_IS_APPROX(m4=refMat2.col(c1)*m2.col(c).transpose(), refMat4=refMat2.col(c1)*refMat2.col(c).transpose());
}
@@ -22,8 +23,9 @@ template<typename SparseMatrixType, typename DenseMatrix> struct test_outer<Spar
template<typename SparseMatrixType, typename DenseMatrix> struct test_outer<SparseMatrixType,DenseMatrix,true> {
static void run(SparseMatrixType& m2, SparseMatrixType& m4, DenseMatrix& refMat2, DenseMatrix& refMat4) {
- int r = internal::random(0,m2.rows()-1);
- int c1 = internal::random(0,m2.cols()-1);
+ typedef typename SparseMatrixType::Index Index;
+ Index r = internal::random<Index>(0,m2.rows()-1);
+ Index c1 = internal::random<Index>(0,m2.cols()-1);
VERIFY_IS_APPROX(m4=m2.row(r).transpose()*refMat2.col(c1).transpose(), refMat4=refMat2.row(r).transpose()*refMat2.col(c1).transpose());
VERIFY_IS_APPROX(m4=refMat2.col(c1)*m2.row(r), refMat4=refMat2.col(c1)*refMat2.row(r));
}
@@ -37,9 +39,9 @@ template<typename SparseMatrixType> void sparse_product()
{
typedef typename SparseMatrixType::Index Index;
Index n = 100;
- const Index rows = internal::random<int>(1,n);
- const Index cols = internal::random<int>(1,n);
- const Index depth = internal::random<int>(1,n);
+ const Index rows = internal::random<Index>(1,n);
+ const Index cols = internal::random<Index>(1,n);
+ const Index depth = internal::random<Index>(1,n);
typedef typename SparseMatrixType::Scalar Scalar;
enum { Flags = SparseMatrixType::Flags };