2 #include <Eigen/Sparse>
29 for (
int j = 0;
j <
cols;
j++) {
30 for (
int i = 0;
i <
rows;
i++) {
31 Scalar v = (internal::random<float>(0, 1) <
density) ? internal::random<Scalar>() : 0;
41 for (
int j = 0;
j <
cols;
j++) {
43 for (
int i = 0;
i < nnzPerCol;
i++) {
44 int k = internal::random<int>(0,
rows - 1);
45 while (aux.find(
k) != aux.end())
k = internal::random<int>(0,
rows - 1);
48 dst.
insert(
k,
j) = internal::random<Scalar>();
56 for (
int j = 0;
j < src.
cols(); ++
j)
66 for (
int j = 0;
j < src.
cols(); ++
j)
73 #include <boost/numeric/mtl/mtl.hpp>
74 typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::col_major> >
MtlSparse;
75 typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::row_major> >
MtlSparseRowMajor;
77 mtl::matrix::inserter<MtlSparse> ins(dst);
78 for (
int j = 0;
j < src.
cols(); ++
j)
88 cs* aux = cs_spalloc(0, 0, 1, 1, 1);
89 for (
int j = 0;
j < src.
cols(); ++
j)
91 if (!cs_entry(aux, it.index(),
j, it.value())) {
92 std::cout <<
"cs_entry error\n";
95 dst = cs_compress(aux);
101 #include <boost/numeric/ublas/vector.hpp>
102 #include <boost/numeric/ublas/matrix.hpp>
103 #include <boost/numeric/ublas/io.hpp>
104 #include <boost/numeric/ublas/triangular.hpp>
105 #include <boost/numeric/ublas/vector_sparse.hpp>
106 #include <boost/numeric/ublas/matrix_sparse.hpp>
107 #include <boost/numeric/ublas/vector_of_vector.hpp>
108 #include <boost/numeric/ublas/operation.hpp>
110 typedef boost::numeric::ublas::compressed_matrix<Scalar, boost::numeric::ublas::column_major>
UBlasSparse;
113 dst.resize(src.
rows(), src.
cols(),
false);
114 for (
int j = 0;
j < src.
cols(); ++
j)
118 template <
typename EigenType,
typename UblasType>
120 dst.resize(src.size());
121 for (
int j = 0;
j < src.size(); ++
j) dst[
j] = src.coeff(
j);
127 #include <oski/oski.h>
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
SCALAR Scalar
Definition: BenchSparseUtil.h:22
void eiToGmm(const EigenSparseMatrix &src, GmmSparse &dst)
Definition: BenchSparseUtil.h:64
void eiToUblasVec(const EigenType &src, UblasType &dst)
Definition: BenchSparseUtil.h:119
SparseMatrix< Scalar > EigenSparseMatrix
Definition: BenchSparseUtil.h:25
mtl::compressed2D< Scalar, mtl::matrix::parameters< mtl::tag::row_major > > MtlSparseRowMajor
Definition: BenchSparseUtil.h:75
void eiToDense(const EigenSparseMatrix &src, DenseMatrix &dst)
Definition: BenchSparseUtil.h:54
void fillMatrix(float density, int rows, int cols, EigenSparseMatrix &dst)
Definition: BenchSparseUtil.h:27
gmm::col_matrix< gmm::wsvector< Scalar > > GmmDynSparse
Definition: BenchSparseUtil.h:63
mtl::compressed2D< Scalar, mtl::matrix::parameters< mtl::tag::col_major > > MtlSparse
Definition: BenchSparseUtil.h:74
Matrix< Scalar, Dynamic, Dynamic > DenseMatrix
Definition: BenchSparseUtil.h:23
#define SCALAR
Definition: BenchSparseUtil.h:19
void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix &dst)
Definition: BenchSparseUtil.h:38
gmm::csc_matrix< Scalar > GmmSparse
Definition: BenchSparseUtil.h:62
boost::numeric::ublas::compressed_matrix< Scalar, boost::numeric::ublas::column_major > UBlasSparse
Definition: BenchSparseUtil.h:110
void eiToMtl(const EigenSparseMatrix &src, MtlSparse &dst)
Definition: BenchSparseUtil.h:76
Matrix< Scalar, Dynamic, 1 > DenseVector
Definition: BenchSparseUtil.h:24
void eiToUblas(const EigenSparseMatrix &src, UBlasSparse &dst)
Definition: BenchSparseUtil.h:112
int i
Definition: BiCGSTAB_step_by_step.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
const Derived & derived() const
Definition: SparseMatrixBase.h:144
Index cols() const
Definition: SparseMatrix.h:161
void finalize()
Definition: SparseMatrix.h:461
Index rows() const
Definition: SparseMatrix.h:159
Base::InnerIterator InnerIterator
Definition: SparseMatrix.h:138
void reserve(Index reserveSize)
Definition: SparseMatrix.h:315
Scalar & insert(Index row, Index col)
Definition: SparseMatrix.h:1586
EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_impl.h:32
char char char int int * k
Definition: level2_impl.h:374
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2