| 59 | EIGEN_DONT_INLINE Scalar* setrand_mtl(const Coordinates& coords, const Values& vals); |
| 60 | |
| 61 | int main(int argc, char *argv[]) |
| 62 | { |
| 63 | int rows = SIZE; |
| 64 | int cols = SIZE; |
| 65 | bool fullyrand = true; |
| 66 | |
| 67 | BenchTimer timer; |
| 68 | Coordinates coords; |
| 69 | Values values; |
| 70 | if(fullyrand) |
| 71 | { |
| 72 | Coordinates pool; |
| 73 | pool.reserve(cols*NBPERROW); |
| 74 | std::cerr << "fill pool" << "\n"; |
| 75 | for (int i=0; i<cols*NBPERROW; ) |
| 76 | { |
| 77 | // DynamicSparseMatrix<int> stencil(SIZE,SIZE); |
| 78 | Vector2i ij(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)); |
| 79 | // if(stencil.coeffRef(ij.x(), ij.y())==0) |
| 80 | { |
| 81 | // stencil.coeffRef(ij.x(), ij.y()) = 1; |
| 82 | pool.push_back(ij); |
| 83 | |
| 84 | } |
| 85 | ++i; |
| 86 | } |
| 87 | std::cerr << "pool ok" << "\n"; |
| 88 | int n = cols*NBPERROW*KK; |
| 89 | coords.reserve(n); |
| 90 | values.reserve(n); |
| 91 | for (int i=0; i<n; ++i) |
| 92 | { |
| 93 | int i = internal::random<int>(0,pool.size()); |
| 94 | coords.push_back(pool[i]); |
| 95 | values.push_back(internal::random<Scalar>()); |
| 96 | } |
| 97 | } |
| 98 | else |
| 99 | { |
| 100 | for (int j=0; j<cols; ++j) |
| 101 | for (int i=0; i<NBPERROW; ++i) |
| 102 | { |
| 103 | coords.push_back(Vector2i(internal::random<int>(0,rows-1),j)); |
| 104 | values.push_back(internal::random<Scalar>()); |
| 105 | } |
| 106 | } |
| 107 | std::cout << "nnz = " << coords.size() << "\n"; |
| 108 | CHECK_MEM |
| 109 | |
| 110 | // dense matrices |
| 111 | #ifdef DENSEMATRIX |
| 112 | { |
| 113 | BENCH(setrand_eigen_dense(coords,values);) |
| 114 | std::cout << "Eigen Dense\t" << timer.value() << "\n"; |
| 115 | } |
| 116 | #endif |
| 117 | |
| 118 | // eigen sparse matrices |
nothing calls this directly
no test coverage detected