Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 1 | // This file is part of Eigen, a lightweight C++ template library |
Benoit Jacob | 6347b1d | 2009-05-22 20:25:33 +0200 | [diff] [blame] | 2 | // for linear algebra. |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 3 | // |
Gael Guennebaud | 22c7609 | 2011-03-22 11:58:22 +0100 | [diff] [blame] | 4 | // Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr> |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 5 | // Copyright (C) 2008 Daniel Gomez Ferro <dgomezferro@gmail.com> |
Desire NUENTSA | 4cd8245 | 2013-06-11 14:42:29 +0200 | [diff] [blame] | 6 | // Copyright (C) 2013 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr> |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 7 | // |
Benoit Jacob | 69124cf | 2012-07-13 14:42:47 -0400 | [diff] [blame] | 8 | // This Source Code Form is subject to the terms of the Mozilla |
| 9 | // Public License v. 2.0. If a copy of the MPL was not distributed |
| 10 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 11 | |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 12 | static long g_realloc_count = 0; |
| 13 | #define EIGEN_SPARSE_COMPRESSED_STORAGE_REALLOCATE_PLUGIN g_realloc_count++; |
| 14 | |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 15 | #include "sparse.h" |
| 16 | |
Gael Guennebaud | 178858f | 2009-01-19 15:20:45 +0000 | [diff] [blame] | 17 | template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& ref) |
| 18 | { |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 19 | typedef typename SparseMatrixType::StorageIndex StorageIndex; |
| 20 | typedef Matrix<StorageIndex,2,1> Vector2; |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 21 | |
Gael Guennebaud | fc202ba | 2015-02-13 18:57:41 +0100 | [diff] [blame] | 22 | const Index rows = ref.rows(); |
| 23 | const Index cols = ref.cols(); |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 24 | const Index inner = ref.innerSize(); |
| 25 | const Index outer = ref.outerSize(); |
| 26 | |
Gael Guennebaud | 178858f | 2009-01-19 15:20:45 +0000 | [diff] [blame] | 27 | typedef typename SparseMatrixType::Scalar Scalar; |
| 28 | enum { Flags = SparseMatrixType::Flags }; |
Gael Guennebaud | 9f79558 | 2009-12-16 19:18:40 +0100 | [diff] [blame] | 29 | |
Gael Guennebaud | 42e2578 | 2011-08-19 14:18:05 +0200 | [diff] [blame] | 30 | double density = (std::max)(8./(rows*cols), 0.01); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 31 | typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix; |
| 32 | typedef Matrix<Scalar,Dynamic,1> DenseVector; |
| 33 | Scalar eps = 1e-6; |
| 34 | |
Benoit Jacob | 4716040 | 2010-10-25 10:15:22 -0400 | [diff] [blame] | 35 | Scalar s1 = internal::random<Scalar>(); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 36 | { |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 37 | SparseMatrixType m(rows, cols); |
| 38 | DenseMatrix refMat = DenseMatrix::Zero(rows, cols); |
| 39 | DenseVector vec1 = DenseVector::Random(rows); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 40 | |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 41 | std::vector<Vector2> zeroCoords; |
| 42 | std::vector<Vector2> nonzeroCoords; |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 43 | initSparse<Scalar>(density, refMat, m, 0, &zeroCoords, &nonzeroCoords); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 44 | |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 45 | // test coeff and coeffRef |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 46 | for (std::size_t i=0; i<zeroCoords.size(); ++i) |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 47 | { |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 48 | VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps ); |
| 49 | if(internal::is_same<SparseMatrixType,SparseMatrix<Scalar,Flags> >::value) |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 50 | VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[i].x(),zeroCoords[i].y()) = 5 ); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 51 | } |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 52 | VERIFY_IS_APPROX(m, refMat); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 53 | |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 54 | if(!nonzeroCoords.empty()) { |
| 55 | m.coeffRef(nonzeroCoords[0].x(), nonzeroCoords[0].y()) = Scalar(5); |
| 56 | refMat.coeffRef(nonzeroCoords[0].x(), nonzeroCoords[0].y()) = Scalar(5); |
| 57 | } |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 58 | |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 59 | VERIFY_IS_APPROX(m, refMat); |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 60 | |
Gael Guennebaud | a915f02 | 2013-06-28 16:16:02 +0200 | [diff] [blame] | 61 | // test assertion |
| 62 | VERIFY_RAISES_ASSERT( m.coeffRef(-1,1) = 0 ); |
| 63 | VERIFY_RAISES_ASSERT( m.coeffRef(0,m.cols()) = 0 ); |
Gael Guennebaud | d1d7a1a | 2013-06-23 19:11:32 +0200 | [diff] [blame] | 64 | } |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 65 | |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 66 | // test insert (inner random) |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 67 | { |
| 68 | DenseMatrix m1(rows,cols); |
| 69 | m1.setZero(); |
Gael Guennebaud | 178858f | 2009-01-19 15:20:45 +0000 | [diff] [blame] | 70 | SparseMatrixType m2(rows,cols); |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 71 | bool call_reserve = internal::random<int>()%2; |
| 72 | Index nnz = internal::random<int>(1,int(rows)/2); |
| 73 | if(call_reserve) |
| 74 | { |
| 75 | if(internal::random<int>()%2) |
| 76 | m2.reserve(VectorXi::Constant(m2.outerSize(), int(nnz))); |
| 77 | else |
| 78 | m2.reserve(m2.outerSize() * nnz); |
| 79 | } |
| 80 | g_realloc_count = 0; |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 81 | for (Index j=0; j<cols; ++j) |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 82 | { |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 83 | for (Index k=0; k<nnz; ++k) |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 84 | { |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 85 | Index i = internal::random<Index>(0,rows-1); |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 86 | if (m1.coeff(i,j)==Scalar(0)) |
Benoit Jacob | 4716040 | 2010-10-25 10:15:22 -0400 | [diff] [blame] | 87 | m2.insert(i,j) = m1(i,j) = internal::random<Scalar>(); |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 88 | } |
| 89 | } |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 90 | |
| 91 | if(call_reserve && !SparseMatrixType::IsRowMajor) |
| 92 | { |
| 93 | VERIFY(g_realloc_count==0); |
| 94 | } |
| 95 | |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 96 | m2.finalize(); |
| 97 | VERIFY_IS_APPROX(m2,m1); |
| 98 | } |
Gael Guennebaud | 9f79558 | 2009-12-16 19:18:40 +0100 | [diff] [blame] | 99 | |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 100 | // test insert (fully random) |
| 101 | { |
| 102 | DenseMatrix m1(rows,cols); |
| 103 | m1.setZero(); |
| 104 | SparseMatrixType m2(rows,cols); |
Gael Guennebaud | 4ca89f3 | 2011-12-02 19:00:16 +0100 | [diff] [blame] | 105 | if(internal::random<int>()%2) |
| 106 | m2.reserve(VectorXi::Constant(m2.outerSize(), 2)); |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 107 | for (int k=0; k<rows*cols; ++k) |
| 108 | { |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 109 | Index i = internal::random<Index>(0,rows-1); |
| 110 | Index j = internal::random<Index>(0,cols-1); |
Gael Guennebaud | 4ca89f3 | 2011-12-02 19:00:16 +0100 | [diff] [blame] | 111 | if ((m1.coeff(i,j)==Scalar(0)) && (internal::random<int>()%2)) |
Benoit Jacob | 4716040 | 2010-10-25 10:15:22 -0400 | [diff] [blame] | 112 | m2.insert(i,j) = m1(i,j) = internal::random<Scalar>(); |
Gael Guennebaud | 4ca89f3 | 2011-12-02 19:00:16 +0100 | [diff] [blame] | 113 | else |
| 114 | { |
| 115 | Scalar v = internal::random<Scalar>(); |
| 116 | m2.coeffRef(i,j) += v; |
| 117 | m1(i,j) += v; |
| 118 | } |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 119 | } |
Gael Guennebaud | c4c7066 | 2009-01-14 14:24:10 +0000 | [diff] [blame] | 120 | VERIFY_IS_APPROX(m2,m1); |
Gael Guennebaud | 5015e48 | 2008-12-11 18:26:24 +0000 | [diff] [blame] | 121 | } |
Gael Guennebaud | 7706baf | 2011-09-08 13:42:54 +0200 | [diff] [blame] | 122 | |
| 123 | // test insert (un-compressed) |
| 124 | for(int mode=0;mode<4;++mode) |
| 125 | { |
| 126 | DenseMatrix m1(rows,cols); |
| 127 | m1.setZero(); |
| 128 | SparseMatrixType m2(rows,cols); |
Gael Guennebaud | b47ef14 | 2014-07-08 16:47:11 +0200 | [diff] [blame] | 129 | VectorXi r(VectorXi::Constant(m2.outerSize(), ((mode%2)==0) ? int(m2.innerSize()) : std::max<int>(1,int(m2.innerSize())/8))); |
Gael Guennebaud | 7706baf | 2011-09-08 13:42:54 +0200 | [diff] [blame] | 130 | m2.reserve(r); |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 131 | for (Index k=0; k<rows*cols; ++k) |
Gael Guennebaud | 7706baf | 2011-09-08 13:42:54 +0200 | [diff] [blame] | 132 | { |
Gael Guennebaud | 6d1f5db | 2013-07-10 23:48:26 +0200 | [diff] [blame] | 133 | Index i = internal::random<Index>(0,rows-1); |
| 134 | Index j = internal::random<Index>(0,cols-1); |
Gael Guennebaud | 7706baf | 2011-09-08 13:42:54 +0200 | [diff] [blame] | 135 | if (m1.coeff(i,j)==Scalar(0)) |
| 136 | m2.insert(i,j) = m1(i,j) = internal::random<Scalar>(); |
| 137 | if(mode==3) |
| 138 | m2.reserve(r); |
| 139 | } |
Gael Guennebaud | 4ca89f3 | 2011-12-02 19:00:16 +0100 | [diff] [blame] | 140 | if(internal::random<int>()%2) |
| 141 | m2.makeCompressed(); |
Gael Guennebaud | 7706baf | 2011-09-08 13:42:54 +0200 | [diff] [blame] | 142 | VERIFY_IS_APPROX(m2,m1); |
| 143 | } |
Gael Guennebaud | 9f79558 | 2009-12-16 19:18:40 +0100 | [diff] [blame] | 144 | |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 145 | // test basic computations |
| 146 | { |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 147 | DenseMatrix refM1 = DenseMatrix::Zero(rows, cols); |
| 148 | DenseMatrix refM2 = DenseMatrix::Zero(rows, cols); |
| 149 | DenseMatrix refM3 = DenseMatrix::Zero(rows, cols); |
| 150 | DenseMatrix refM4 = DenseMatrix::Zero(rows, cols); |
| 151 | SparseMatrixType m1(rows, cols); |
| 152 | SparseMatrixType m2(rows, cols); |
| 153 | SparseMatrixType m3(rows, cols); |
| 154 | SparseMatrixType m4(rows, cols); |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 155 | initSparse<Scalar>(density, refM1, m1); |
| 156 | initSparse<Scalar>(density, refM2, m2); |
| 157 | initSparse<Scalar>(density, refM3, m3); |
| 158 | initSparse<Scalar>(density, refM4, m4); |
| 159 | |
Gael Guennebaud | 4aac872 | 2014-07-22 12:54:03 +0200 | [diff] [blame] | 160 | VERIFY_IS_APPROX(m1*s1, refM1*s1); |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 161 | VERIFY_IS_APPROX(m1+m2, refM1+refM2); |
| 162 | VERIFY_IS_APPROX(m1+m2+m3, refM1+refM2+refM3); |
| 163 | VERIFY_IS_APPROX(m3.cwiseProduct(m1+m2), refM3.cwiseProduct(refM1+refM2)); |
| 164 | VERIFY_IS_APPROX(m1*s1-m2, refM1*s1-refM2); |
| 165 | |
| 166 | VERIFY_IS_APPROX(m1*=s1, refM1*=s1); |
| 167 | VERIFY_IS_APPROX(m1/=s1, refM1/=s1); |
| 168 | |
| 169 | VERIFY_IS_APPROX(m1+=m2, refM1+=refM2); |
| 170 | VERIFY_IS_APPROX(m1-=m2, refM1-=refM2); |
| 171 | |
| 172 | if(SparseMatrixType::IsRowMajor) |
| 173 | VERIFY_IS_APPROX(m1.innerVector(0).dot(refM2.row(0)), refM1.row(0).dot(refM2.row(0))); |
| 174 | else |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 175 | VERIFY_IS_APPROX(m1.innerVector(0).dot(refM2.col(0)), refM1.col(0).dot(refM2.col(0))); |
Gael Guennebaud | 3573a10 | 2014-02-17 13:46:17 +0100 | [diff] [blame] | 176 | |
| 177 | DenseVector rv = DenseVector::Random(m1.cols()); |
| 178 | DenseVector cv = DenseVector::Random(m1.rows()); |
| 179 | Index r = internal::random<Index>(0,m1.rows()-2); |
| 180 | Index c = internal::random<Index>(0,m1.cols()-1); |
| 181 | VERIFY_IS_APPROX(( m1.template block<1,Dynamic>(r,0,1,m1.cols()).dot(rv)) , refM1.row(r).dot(rv)); |
| 182 | VERIFY_IS_APPROX(m1.row(r).dot(rv), refM1.row(r).dot(rv)); |
| 183 | VERIFY_IS_APPROX(m1.col(c).dot(cv), refM1.col(c).dot(cv)); |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 184 | |
| 185 | VERIFY_IS_APPROX(m1.conjugate(), refM1.conjugate()); |
| 186 | VERIFY_IS_APPROX(m1.real(), refM1.real()); |
| 187 | |
| 188 | refM4.setRandom(); |
| 189 | // sparse cwise* dense |
| 190 | VERIFY_IS_APPROX(m3.cwiseProduct(refM4), refM3.cwiseProduct(refM4)); |
| 191 | // VERIFY_IS_APPROX(m3.cwise()/refM4, refM3.cwise()/refM4); |
| 192 | |
| 193 | // test aliasing |
| 194 | VERIFY_IS_APPROX((m1 = -m1), (refM1 = -refM1)); |
| 195 | VERIFY_IS_APPROX((m1 = m1.transpose()), (refM1 = refM1.transpose().eval())); |
| 196 | VERIFY_IS_APPROX((m1 = -m1.transpose()), (refM1 = -refM1.transpose().eval())); |
| 197 | VERIFY_IS_APPROX((m1 += -m1), (refM1 += -refM1)); |
| 198 | } |
| 199 | |
| 200 | // test transpose |
| 201 | { |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 202 | DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols); |
| 203 | SparseMatrixType m2(rows, cols); |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 204 | initSparse<Scalar>(density, refMat2, m2); |
| 205 | VERIFY_IS_APPROX(m2.transpose().eval(), refMat2.transpose().eval()); |
| 206 | VERIFY_IS_APPROX(m2.transpose(), refMat2.transpose()); |
| 207 | |
| 208 | VERIFY_IS_APPROX(SparseMatrixType(m2.adjoint()), refMat2.adjoint()); |
Gael Guennebaud | ff46ec0 | 2014-09-22 23:33:28 +0200 | [diff] [blame] | 209 | |
| 210 | // check isApprox handles opposite storage order |
| 211 | typename Transpose<SparseMatrixType>::PlainObject m3(m2); |
| 212 | VERIFY(m2.isApprox(m3)); |
Gael Guennebaud | 4e60283 | 2012-11-16 09:02:50 +0100 | [diff] [blame] | 213 | } |
| 214 | |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 215 | // test prune |
| 216 | { |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 217 | SparseMatrixType m2(rows, cols); |
| 218 | DenseMatrix refM2(rows, cols); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 219 | refM2.setZero(); |
| 220 | int countFalseNonZero = 0; |
| 221 | int countTrueNonZero = 0; |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 222 | m2.reserve(VectorXi::Constant(m2.outerSize(), int(m2.innerSize()))); |
| 223 | for (Index j=0; j<m2.cols(); ++j) |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 224 | { |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 225 | for (Index i=0; i<m2.rows(); ++i) |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 226 | { |
Benoit Jacob | 4716040 | 2010-10-25 10:15:22 -0400 | [diff] [blame] | 227 | float x = internal::random<float>(0,1); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 228 | if (x<0.1) |
| 229 | { |
| 230 | // do nothing |
| 231 | } |
| 232 | else if (x<0.5) |
| 233 | { |
| 234 | countFalseNonZero++; |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 235 | m2.insert(i,j) = Scalar(0); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 236 | } |
| 237 | else |
| 238 | { |
| 239 | countTrueNonZero++; |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 240 | m2.insert(i,j) = Scalar(1); |
| 241 | refM2(i,j) = Scalar(1); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 242 | } |
| 243 | } |
Gael Guennebaud | 2829314 | 2009-05-04 14:25:12 +0000 | [diff] [blame] | 244 | } |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 245 | if(internal::random<bool>()) |
| 246 | m2.makeCompressed(); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 247 | VERIFY(countFalseNonZero+countTrueNonZero == m2.nonZeros()); |
Gael Guennebaud | a44d91a | 2015-10-13 10:53:38 +0200 | [diff] [blame] | 248 | if(countTrueNonZero>0) |
| 249 | VERIFY_IS_APPROX(m2, refM2); |
Hauke Heibel | d204ec4 | 2010-11-02 14:33:33 +0100 | [diff] [blame] | 250 | m2.prune(Scalar(1)); |
Gael Guennebaud | 52cf07d | 2009-01-21 18:46:04 +0000 | [diff] [blame] | 251 | VERIFY(countTrueNonZero==m2.nonZeros()); |
| 252 | VERIFY_IS_APPROX(m2, refM2); |
| 253 | } |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 254 | |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 255 | // test setFromTriplets |
| 256 | { |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 257 | typedef Triplet<Scalar,StorageIndex> TripletType; |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 258 | std::vector<TripletType> triplets; |
Gael Guennebaud | b47ef14 | 2014-07-08 16:47:11 +0200 | [diff] [blame] | 259 | Index ntriplets = rows*cols; |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 260 | triplets.reserve(ntriplets); |
Gael Guennebaud | b4c79ee | 2015-10-13 11:30:41 +0200 | [diff] [blame] | 261 | DenseMatrix refMat_sum = DenseMatrix::Zero(rows,cols); |
| 262 | DenseMatrix refMat_prod = DenseMatrix::Zero(rows,cols); |
| 263 | DenseMatrix refMat_last = DenseMatrix::Zero(rows,cols); |
| 264 | |
Gael Guennebaud | b47ef14 | 2014-07-08 16:47:11 +0200 | [diff] [blame] | 265 | for(Index i=0;i<ntriplets;++i) |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 266 | { |
Gael Guennebaud | aa6c516 | 2015-02-16 13:19:05 +0100 | [diff] [blame] | 267 | StorageIndex r = internal::random<StorageIndex>(0,StorageIndex(rows-1)); |
| 268 | StorageIndex c = internal::random<StorageIndex>(0,StorageIndex(cols-1)); |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 269 | Scalar v = internal::random<Scalar>(); |
Gael Guennebaud | 18e3ac0 | 2012-01-31 09:14:01 +0100 | [diff] [blame] | 270 | triplets.push_back(TripletType(r,c,v)); |
Gael Guennebaud | b4c79ee | 2015-10-13 11:30:41 +0200 | [diff] [blame] | 271 | refMat_sum(r,c) += v; |
| 272 | if(std::abs(refMat_prod(r,c))==0) |
| 273 | refMat_prod(r,c) = v; |
| 274 | else |
| 275 | refMat_prod(r,c) *= v; |
| 276 | refMat_last(r,c) = v; |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 277 | } |
| 278 | SparseMatrixType m(rows,cols); |
| 279 | m.setFromTriplets(triplets.begin(), triplets.end()); |
Gael Guennebaud | b4c79ee | 2015-10-13 11:30:41 +0200 | [diff] [blame] | 280 | VERIFY_IS_APPROX(m, refMat_sum); |
| 281 | |
| 282 | m.setFromTriplets(triplets.begin(), triplets.end(), std::multiplies<Scalar>()); |
| 283 | VERIFY_IS_APPROX(m, refMat_prod); |
| 284 | #if (defined(__cplusplus) && __cplusplus >= 201103L) |
| 285 | m.setFromTriplets(triplets.begin(), triplets.end(), [] (Scalar,Scalar b) { return b; }); |
| 286 | VERIFY_IS_APPROX(m, refMat_last); |
| 287 | #endif |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 288 | } |
Gael Guennebaud | 3af29ca | 2015-02-09 10:23:45 +0100 | [diff] [blame] | 289 | |
| 290 | // test Map |
| 291 | { |
| 292 | DenseMatrix refMat2(rows, cols), refMat3(rows, cols); |
| 293 | SparseMatrixType m2(rows, cols), m3(rows, cols); |
| 294 | initSparse<Scalar>(density, refMat2, m2); |
| 295 | initSparse<Scalar>(density, refMat3, m3); |
| 296 | { |
| 297 | Map<SparseMatrixType> mapMat2(m2.rows(), m2.cols(), m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(), m2.innerNonZeroPtr()); |
| 298 | Map<SparseMatrixType> mapMat3(m3.rows(), m3.cols(), m3.nonZeros(), m3.outerIndexPtr(), m3.innerIndexPtr(), m3.valuePtr(), m3.innerNonZeroPtr()); |
| 299 | VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); |
| 300 | VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); |
| 301 | } |
| 302 | { |
Gael Guennebaud | fe51319 | 2015-02-13 10:03:53 +0100 | [diff] [blame] | 303 | MappedSparseMatrix<Scalar,SparseMatrixType::Options,StorageIndex> mapMat2(m2.rows(), m2.cols(), m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(), m2.innerNonZeroPtr()); |
| 304 | MappedSparseMatrix<Scalar,SparseMatrixType::Options,StorageIndex> mapMat3(m3.rows(), m3.cols(), m3.nonZeros(), m3.outerIndexPtr(), m3.innerIndexPtr(), m3.valuePtr(), m3.innerNonZeroPtr()); |
Gael Guennebaud | 3af29ca | 2015-02-09 10:23:45 +0100 | [diff] [blame] | 305 | VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); |
| 306 | VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3); |
| 307 | } |
| 308 | } |
Gael Guennebaud | 8713807 | 2012-01-28 11:13:59 +0100 | [diff] [blame] | 309 | |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 310 | // test triangularView |
| 311 | { |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 312 | DenseMatrix refMat2(rows, cols), refMat3(rows, cols); |
| 313 | SparseMatrixType m2(rows, cols), m3(rows, cols); |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 314 | initSparse<Scalar>(density, refMat2, m2); |
| 315 | refMat3 = refMat2.template triangularView<Lower>(); |
| 316 | m3 = m2.template triangularView<Lower>(); |
| 317 | VERIFY_IS_APPROX(m3, refMat3); |
| 318 | |
| 319 | refMat3 = refMat2.template triangularView<Upper>(); |
| 320 | m3 = m2.template triangularView<Upper>(); |
| 321 | VERIFY_IS_APPROX(m3, refMat3); |
| 322 | |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 323 | if(inner>=outer) // FIXME this should be implemented for outer>inner as well |
| 324 | { |
| 325 | refMat3 = refMat2.template triangularView<UnitUpper>(); |
| 326 | m3 = m2.template triangularView<UnitUpper>(); |
| 327 | VERIFY_IS_APPROX(m3, refMat3); |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 328 | |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 329 | refMat3 = refMat2.template triangularView<UnitLower>(); |
| 330 | m3 = m2.template triangularView<UnitLower>(); |
| 331 | VERIFY_IS_APPROX(m3, refMat3); |
| 332 | } |
Desire NUENTSA | 4cd8245 | 2013-06-11 14:42:29 +0200 | [diff] [blame] | 333 | |
| 334 | refMat3 = refMat2.template triangularView<StrictlyUpper>(); |
| 335 | m3 = m2.template triangularView<StrictlyUpper>(); |
| 336 | VERIFY_IS_APPROX(m3, refMat3); |
| 337 | |
| 338 | refMat3 = refMat2.template triangularView<StrictlyLower>(); |
| 339 | m3 = m2.template triangularView<StrictlyLower>(); |
| 340 | VERIFY_IS_APPROX(m3, refMat3); |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 341 | } |
Gael Guennebaud | fa6d36e | 2010-07-22 15:57:01 +0200 | [diff] [blame] | 342 | |
Gael Guennebaud | 9a3ec63 | 2010-11-15 14:14:05 +0100 | [diff] [blame] | 343 | // test selfadjointView |
Gael Guennebaud | 9353bba | 2011-12-04 14:39:24 +0100 | [diff] [blame] | 344 | if(!SparseMatrixType::IsRowMajor) |
Gael Guennebaud | 9a3ec63 | 2010-11-15 14:14:05 +0100 | [diff] [blame] | 345 | { |
| 346 | DenseMatrix refMat2(rows, rows), refMat3(rows, rows); |
| 347 | SparseMatrixType m2(rows, rows), m3(rows, rows); |
| 348 | initSparse<Scalar>(density, refMat2, m2); |
| 349 | refMat3 = refMat2.template selfadjointView<Lower>(); |
| 350 | m3 = m2.template selfadjointView<Lower>(); |
| 351 | VERIFY_IS_APPROX(m3, refMat3); |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 352 | |
| 353 | // selfadjointView only works for square matrices: |
| 354 | SparseMatrixType m4(rows, rows+1); |
| 355 | VERIFY_RAISES_ASSERT(m4.template selfadjointView<Lower>()); |
| 356 | VERIFY_RAISES_ASSERT(m4.template selfadjointView<Upper>()); |
Gael Guennebaud | 9a3ec63 | 2010-11-15 14:14:05 +0100 | [diff] [blame] | 357 | } |
| 358 | |
Gael Guennebaud | fa6d36e | 2010-07-22 15:57:01 +0200 | [diff] [blame] | 359 | // test sparseView |
| 360 | { |
| 361 | DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows); |
| 362 | SparseMatrixType m2(rows, rows); |
Gael Guennebaud | 9a3ec63 | 2010-11-15 14:14:05 +0100 | [diff] [blame] | 363 | initSparse<Scalar>(density, refMat2, m2); |
Gael Guennebaud | fa6d36e | 2010-07-22 15:57:01 +0200 | [diff] [blame] | 364 | VERIFY_IS_APPROX(m2.eval(), refMat2.sparseView().eval()); |
| 365 | } |
Gael Guennebaud | 82f9aa1 | 2011-12-04 21:49:21 +0100 | [diff] [blame] | 366 | |
| 367 | // test diagonal |
| 368 | { |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 369 | DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols); |
| 370 | SparseMatrixType m2(rows, cols); |
Gael Guennebaud | 82f9aa1 | 2011-12-04 21:49:21 +0100 | [diff] [blame] | 371 | initSparse<Scalar>(density, refMat2, m2); |
| 372 | VERIFY_IS_APPROX(m2.diagonal(), refMat2.diagonal().eval()); |
Gael Guennebaud | b26e697 | 2014-12-01 14:41:39 +0100 | [diff] [blame] | 373 | VERIFY_IS_APPROX(const_cast<const SparseMatrixType&>(m2).diagonal(), refMat2.diagonal().eval()); |
| 374 | |
| 375 | initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag); |
| 376 | m2.diagonal() += refMat2.diagonal(); |
| 377 | refMat2.diagonal() += refMat2.diagonal(); |
| 378 | VERIFY_IS_APPROX(m2, refMat2); |
Gael Guennebaud | 82f9aa1 | 2011-12-04 21:49:21 +0100 | [diff] [blame] | 379 | } |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 380 | |
Gael Guennebaud | 62f21e2 | 2015-06-24 17:55:00 +0200 | [diff] [blame] | 381 | // test diagonal to sparse |
| 382 | { |
| 383 | DenseVector d = DenseVector::Random(rows); |
| 384 | DenseMatrix refMat2 = d.asDiagonal(); |
| 385 | SparseMatrixType m2(rows, rows); |
| 386 | m2 = d.asDiagonal(); |
| 387 | VERIFY_IS_APPROX(m2, refMat2); |
Gael Guennebaud | 4c8cd13 | 2015-06-24 18:11:06 +0200 | [diff] [blame] | 388 | SparseMatrixType m3(d.asDiagonal()); |
| 389 | VERIFY_IS_APPROX(m3, refMat2); |
Gael Guennebaud | 62f21e2 | 2015-06-24 17:55:00 +0200 | [diff] [blame] | 390 | refMat2 += d.asDiagonal(); |
| 391 | m2 += d.asDiagonal(); |
| 392 | VERIFY_IS_APPROX(m2, refMat2); |
| 393 | } |
| 394 | |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 395 | // test conservative resize |
| 396 | { |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 397 | std::vector< std::pair<StorageIndex,StorageIndex> > inc; |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 398 | if(rows > 3 && cols > 2) |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 399 | inc.push_back(std::pair<StorageIndex,StorageIndex>(-3,-2)); |
| 400 | inc.push_back(std::pair<StorageIndex,StorageIndex>(0,0)); |
| 401 | inc.push_back(std::pair<StorageIndex,StorageIndex>(3,2)); |
| 402 | inc.push_back(std::pair<StorageIndex,StorageIndex>(3,0)); |
| 403 | inc.push_back(std::pair<StorageIndex,StorageIndex>(0,3)); |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 404 | |
| 405 | for(size_t i = 0; i< inc.size(); i++) { |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 406 | StorageIndex incRows = inc[i].first; |
| 407 | StorageIndex incCols = inc[i].second; |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 408 | SparseMatrixType m1(rows, cols); |
| 409 | DenseMatrix refMat1 = DenseMatrix::Zero(rows, cols); |
| 410 | initSparse<Scalar>(density, refMat1, m1); |
| 411 | |
| 412 | m1.conservativeResize(rows+incRows, cols+incCols); |
| 413 | refMat1.conservativeResize(rows+incRows, cols+incCols); |
| 414 | if (incRows > 0) refMat1.bottomRows(incRows).setZero(); |
| 415 | if (incCols > 0) refMat1.rightCols(incCols).setZero(); |
| 416 | |
| 417 | VERIFY_IS_APPROX(m1, refMat1); |
| 418 | |
| 419 | // Insert new values |
| 420 | if (incRows > 0) |
Gael Guennebaud | 7ee378d | 2013-07-12 16:40:02 +0200 | [diff] [blame] | 421 | m1.insert(m1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1; |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 422 | if (incCols > 0) |
Gael Guennebaud | 7ee378d | 2013-07-12 16:40:02 +0200 | [diff] [blame] | 423 | m1.insert(0, m1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1; |
Benjamin Piwowarski | 6bf49ce | 2012-07-19 00:07:06 +0200 | [diff] [blame] | 424 | |
| 425 | VERIFY_IS_APPROX(m1, refMat1); |
| 426 | |
| 427 | |
| 428 | } |
| 429 | } |
Desire NUENTSA | 4cd8245 | 2013-06-11 14:42:29 +0200 | [diff] [blame] | 430 | |
| 431 | // test Identity matrix |
| 432 | { |
| 433 | DenseMatrix refMat1 = DenseMatrix::Identity(rows, rows); |
| 434 | SparseMatrixType m1(rows, rows); |
| 435 | m1.setIdentity(); |
| 436 | VERIFY_IS_APPROX(m1, refMat1); |
Gael Guennebaud | 8a211bb | 2015-10-25 22:01:58 +0100 | [diff] [blame^] | 437 | for(int k=0; k<rows*rows/4; ++k) |
| 438 | { |
| 439 | Index i = internal::random<Index>(0,rows-1); |
| 440 | Index j = internal::random<Index>(0,rows-1); |
| 441 | Index v = internal::random<Scalar>(); |
| 442 | m1.coeffRef(i,j) = v; |
| 443 | refMat1.coeffRef(i,j) = v; |
| 444 | VERIFY_IS_APPROX(m1, refMat1); |
| 445 | if(internal::random<Index>(0,10)<2) |
| 446 | m1.makeCompressed(); |
| 447 | } |
| 448 | m1.setIdentity(); |
| 449 | refMat1.setIdentity(); |
| 450 | VERIFY_IS_APPROX(m1, refMat1); |
Desire NUENTSA | 4cd8245 | 2013-06-11 14:42:29 +0200 | [diff] [blame] | 451 | } |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 452 | } |
| 453 | |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 454 | |
Christoph Hertzberg | c5a3777 | 2014-10-31 17:19:05 +0100 | [diff] [blame] | 455 | template<typename SparseMatrixType> |
Christoph Hertzberg | e8cdbed | 2014-12-04 22:48:53 +0100 | [diff] [blame] | 456 | void big_sparse_triplet(Index rows, Index cols, double density) { |
| 457 | typedef typename SparseMatrixType::StorageIndex StorageIndex; |
| 458 | typedef typename SparseMatrixType::Scalar Scalar; |
| 459 | typedef Triplet<Scalar,Index> TripletType; |
| 460 | std::vector<TripletType> triplets; |
| 461 | double nelements = density * rows*cols; |
| 462 | VERIFY(nelements>=0 && nelements < NumTraits<StorageIndex>::highest()); |
| 463 | Index ntriplets = Index(nelements); |
| 464 | triplets.reserve(ntriplets); |
| 465 | Scalar sum = Scalar(0); |
| 466 | for(Index i=0;i<ntriplets;++i) |
| 467 | { |
| 468 | Index r = internal::random<Index>(0,rows-1); |
| 469 | Index c = internal::random<Index>(0,cols-1); |
| 470 | Scalar v = internal::random<Scalar>(); |
| 471 | triplets.push_back(TripletType(r,c,v)); |
| 472 | sum += v; |
| 473 | } |
| 474 | SparseMatrixType m(rows,cols); |
| 475 | m.setFromTriplets(triplets.begin(), triplets.end()); |
| 476 | VERIFY(m.nonZeros() <= ntriplets); |
| 477 | VERIFY_IS_APPROX(sum, m.sum()); |
Christoph Hertzberg | c5a3777 | 2014-10-31 17:19:05 +0100 | [diff] [blame] | 478 | } |
| 479 | |
| 480 | |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 481 | void test_sparse_basic() |
| 482 | { |
| 483 | for(int i = 0; i < g_repeat; i++) { |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 484 | int r = Eigen::internal::random<int>(1,200), c = Eigen::internal::random<int>(1,200); |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 485 | if(Eigen::internal::random<int>(0,4) == 0) { |
| 486 | r = c; // check square matrices in 25% of tries |
| 487 | } |
| 488 | EIGEN_UNUSED_VARIABLE(r+c); |
| 489 | CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(1, 1)) )); |
Gael Guennebaud | 91fe150 | 2011-06-07 11:28:16 +0200 | [diff] [blame] | 490 | CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(8, 8)) )); |
Christoph Hertzberg | 0833b82 | 2014-10-31 17:12:13 +0100 | [diff] [blame] | 491 | CALL_SUBTEST_2(( sparse_basic(SparseMatrix<std::complex<double>, ColMajor>(r, c)) )); |
| 492 | CALL_SUBTEST_2(( sparse_basic(SparseMatrix<std::complex<double>, RowMajor>(r, c)) )); |
| 493 | CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(r, c)) )); |
Gael Guennebaud | d7698c1 | 2015-03-19 15:11:05 +0100 | [diff] [blame] | 494 | CALL_SUBTEST_5(( sparse_basic(SparseMatrix<double,ColMajor,long int>(r, c)) )); |
| 495 | CALL_SUBTEST_5(( sparse_basic(SparseMatrix<double,RowMajor,long int>(r, c)) )); |
Gael Guennebaud | 47e8902 | 2013-06-10 10:34:03 +0200 | [diff] [blame] | 496 | |
Gael Guennebaud | c43154b | 2015-03-04 10:16:46 +0100 | [diff] [blame] | 497 | r = Eigen::internal::random<int>(1,100); |
| 498 | c = Eigen::internal::random<int>(1,100); |
| 499 | if(Eigen::internal::random<int>(0,4) == 0) { |
| 500 | r = c; // check square matrices in 25% of tries |
| 501 | } |
| 502 | |
Gael Guennebaud | d7698c1 | 2015-03-19 15:11:05 +0100 | [diff] [blame] | 503 | CALL_SUBTEST_6(( sparse_basic(SparseMatrix<double,ColMajor,short int>(short(r), short(c))) )); |
| 504 | CALL_SUBTEST_6(( sparse_basic(SparseMatrix<double,RowMajor,short int>(short(r), short(c))) )); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 505 | } |
Christoph Hertzberg | c5a3777 | 2014-10-31 17:19:05 +0100 | [diff] [blame] | 506 | |
| 507 | // Regression test for bug 900: (manually insert higher values here, if you have enough RAM): |
| 508 | CALL_SUBTEST_3((big_sparse_triplet<SparseMatrix<float, RowMajor, int> >(10000, 10000, 0.125))); |
| 509 | CALL_SUBTEST_4((big_sparse_triplet<SparseMatrix<double, ColMajor, long int> >(10000, 10000, 0.125))); |
Gael Guennebaud | 86ccd99 | 2008-11-05 13:47:55 +0000 | [diff] [blame] | 510 | } |