mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
reactivate the sorting in the experimental sparse-sparse product
This commit is contained in:
parent
7706bafcfd
commit
d52d8e4a53
@ -47,8 +47,8 @@ static void sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res
|
|||||||
float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
|
float avgNnzPerRhsColumn = float(rhs.nonZeros())/float(cols);
|
||||||
float ratioRes = (std::min)(ratioLhs * avgNnzPerRhsColumn, 1.f);
|
float ratioRes = (std::min)(ratioLhs * avgNnzPerRhsColumn, 1.f);
|
||||||
|
|
||||||
// int t200 = rows/(log2(200)*1.39);
|
int t200 = rows/(log2(200)*1.39);
|
||||||
// int t = (rows*100)/139;
|
int t = (rows*100)/139;
|
||||||
|
|
||||||
res.resize(rows, cols);
|
res.resize(rows, cols);
|
||||||
res.reserve(Index(ratioRes*rows*cols));
|
res.reserve(Index(ratioRes*rows*cols));
|
||||||
@ -83,28 +83,28 @@ static void sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res
|
|||||||
// otherwise => loop through the entire vector
|
// otherwise => loop through the entire vector
|
||||||
// In order to avoid to perform an expensive log2 when the
|
// In order to avoid to perform an expensive log2 when the
|
||||||
// result is clearly very sparse we use a linear bound up to 200.
|
// result is clearly very sparse we use a linear bound up to 200.
|
||||||
// if((nnz<200 && nnz<t200) || nnz * log2(nnz) < t)
|
if((nnz<200 && nnz<t200) || nnz * log2(nnz) < t)
|
||||||
// {
|
{
|
||||||
// if(nnz>1) std::sort(indices.data(),indices.data()+nnz);
|
if(nnz>1) std::sort(indices.data(),indices.data()+nnz);
|
||||||
// for(int k=0; k<nnz; ++k)
|
for(int k=0; k<nnz; ++k)
|
||||||
// {
|
{
|
||||||
// int i = indices[k];
|
int i = indices[k];
|
||||||
// res.insertBackNoCheck(j,i) = values[i];
|
res.insertBackNoCheck(j,i) = values[i];
|
||||||
// mask[i] = false;
|
mask[i] = false;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// // dense path
|
// dense path
|
||||||
// for(int i=0; i<rows; ++i)
|
for(int i=0; i<rows; ++i)
|
||||||
// {
|
{
|
||||||
// if(mask[i])
|
if(mask[i])
|
||||||
// {
|
{
|
||||||
// mask[i] = false;
|
mask[i] = false;
|
||||||
// res.insertBackNoCheck(j,i) = values[i];
|
res.insertBackNoCheck(j,i) = values[i];
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
res.finalize();
|
res.finalize();
|
||||||
@ -114,7 +114,7 @@ static void sparse_product_impl2(const Lhs& lhs, const Rhs& rhs, ResultType& res
|
|||||||
template<typename Lhs, typename Rhs, typename ResultType>
|
template<typename Lhs, typename Rhs, typename ResultType>
|
||||||
static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
|
static void sparse_product_impl(const Lhs& lhs, const Rhs& rhs, ResultType& res)
|
||||||
{
|
{
|
||||||
// return sparse_product_impl2(lhs,rhs,res);
|
// return sparse_product_impl2(lhs,rhs,res);
|
||||||
|
|
||||||
typedef typename remove_all<Lhs>::type::Scalar Scalar;
|
typedef typename remove_all<Lhs>::type::Scalar Scalar;
|
||||||
typedef typename remove_all<Lhs>::type::Index Index;
|
typedef typename remove_all<Lhs>::type::Index Index;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user