2 #include <Eigen/Sparse> 29 dst.
reserve(
double(rows)*cols*density);
34 Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;
49 for(
int i = 0;
i < nnzPerCol;
i++)
51 int k = internal::random<int>(0,rows-1);
52 while (aux.find(k)!=aux.end())
53 k = internal::random<int>(0,rows-1);
56 dst.
insert(k,
j) = internal::random<Scalar>();
65 for (
int j=0;
j<src.
cols(); ++
j)
67 dst(it.index(),
j) = it.value();
77 for (
int j=0;
j<src.
cols(); ++
j)
79 tmp(it.index(),
j) = it.value();
85 #include <boost/numeric/mtl/mtl.hpp> 86 typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::col_major> >
MtlSparse;
87 typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::row_major> >
MtlSparseRowMajor;
90 mtl::matrix::inserter<MtlSparse> ins(dst);
91 for (
int j=0;
j<src.
cols(); ++
j)
93 ins[it.index()][
j] = it.value();
103 cs* aux = cs_spalloc (0, 0, 1, 1, 1);
104 for (
int j=0;
j<src.
cols(); ++
j)
106 if (!cs_entry(aux, it.index(),
j, it.value()))
108 std::cout <<
"cs_entry error\n";
111 dst = cs_compress(aux);
117 #include <boost/numeric/ublas/vector.hpp> 118 #include <boost/numeric/ublas/matrix.hpp> 119 #include <boost/numeric/ublas/io.hpp> 120 #include <boost/numeric/ublas/triangular.hpp> 121 #include <boost/numeric/ublas/vector_sparse.hpp> 122 #include <boost/numeric/ublas/matrix_sparse.hpp> 123 #include <boost/numeric/ublas/vector_of_vector.hpp> 124 #include <boost/numeric/ublas/operation.hpp> 126 typedef boost::numeric::ublas::compressed_matrix<Scalar,boost::numeric::ublas::column_major>
UBlasSparse;
130 dst.resize(src.
rows(), src.
cols(),
false);
131 for (
int j=0;
j<src.
cols(); ++
j)
133 dst(it.index(),
j) = it.value();
136 template <
typename EigenType,
typename UblasType>
139 dst.resize(src.size());
140 for (
int j=0;
j<src.size(); ++
j)
141 dst[
j] = src.coeff(
j);
147 #include <oski/oski.h> Matrix< Scalar, Dynamic, Dynamic > DenseMatrix
void eiToMtl(const EigenSparseMatrix &src, MtlSparse &dst)
SparseMatrix< Scalar > EigenSparseMatrix
Namespace containing all symbols from the Eigen library.
void eiToUblasVec(const EigenType &src, UblasType &dst)
void fillMatrix2(int nnzPerCol, int rows, int cols, EigenSparseMatrix &dst)
Matrix< Scalar, Dynamic, 1 > DenseVector
void eiToDense(const EigenSparseMatrix &src, DenseMatrix &dst)
void eiToUblas(const EigenSparseMatrix &src, UBlasSparse &dst)
mtl::compressed2D< Scalar, mtl::matrix::parameters< mtl::tag::col_major > > MtlSparse
Scalar & insert(Index row, Index col)
Base::InnerIterator InnerIterator
gmm::csc_matrix< Scalar > GmmSparse
void fillMatrix(float density, int rows, int cols, EigenSparseMatrix &dst)
const Derived & derived() const
void reserve(Index reserveSize)
boost::numeric::ublas::compressed_matrix< Scalar, boost::numeric::ublas::column_major > UBlasSparse
gmm::col_matrix< gmm::wsvector< Scalar > > GmmDynSparse
int EIGEN_BLAS_FUNC() copy(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
void eiToGmm(const EigenSparseMatrix &src, GmmSparse &dst)
mtl::compressed2D< Scalar, mtl::matrix::parameters< mtl::tag::row_major > > MtlSparseRowMajor