Fix Ref<SparseMatrix> for Transpose<SparseVector>

This commit is contained in:
Gael Guennebaud
2015-10-06 15:09:04 +02:00
parent 752a0e5339
commit 2d287a4898
3 changed files with 13 additions and 16 deletions

View File

@@ -66,23 +66,13 @@ public:
protected:
template<typename Expression>
void construct(Expression& expr)
{
::new (static_cast<Base*>(this)) Base(expr.rows(), expr.cols(), expr.nonZeros(), expr.outerIndexPtr(), expr.innerIndexPtr(), expr.valuePtr(), expr.innerNonZeroPtr());
}
template<int ExprOptions>
void construct(const SparseVector<Scalar,ExprOptions,StorageIndex>& expr)
{
::new (static_cast<Base*>(this)) Base(expr.size(), expr.nonZeros(), expr.innerIndexPtr(), expr.valuePtr());
}
template<int ExprOptions>
void construct(SparseVector<Scalar,ExprOptions,StorageIndex>& expr)
{
::new (static_cast<Base*>(this)) Base(expr.size(), expr.nonZeros(), expr.innerIndexPtr(), expr.valuePtr());
if(expr.outerIndexPtr()==0)
::new (static_cast<Base*>(this)) Base(expr.size(), expr.nonZeros(), expr.innerIndexPtr(), expr.valuePtr());
else
::new (static_cast<Base*>(this)) Base(expr.rows(), expr.cols(), expr.nonZeros(), expr.outerIndexPtr(), expr.innerIndexPtr(), expr.valuePtr(), expr.innerNonZeroPtr());
}
};