mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-20 03:44:26 +08:00
More int versus Index fixes
(grafted from 5960befc206ac7405841a9da2436f377e4df694f )
This commit is contained in:
parent
53726663c7
commit
cef49d21f0
@ -223,7 +223,7 @@ class SparseMatrix
|
|||||||
|
|
||||||
if(isCompressed())
|
if(isCompressed())
|
||||||
{
|
{
|
||||||
reserve(VectorXi::Constant(outerSize(), 2));
|
reserve(Matrix<Index,Dynamic,1>::Constant(outerSize(), 2));
|
||||||
}
|
}
|
||||||
return insertUncompressed(row,col);
|
return insertUncompressed(row,col);
|
||||||
}
|
}
|
||||||
@ -939,12 +939,13 @@ void set_from_triplets(const InputIterator& begin, const InputIterator& end, Spa
|
|||||||
EIGEN_UNUSED_VARIABLE(Options);
|
EIGEN_UNUSED_VARIABLE(Options);
|
||||||
enum { IsRowMajor = SparseMatrixType::IsRowMajor };
|
enum { IsRowMajor = SparseMatrixType::IsRowMajor };
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
|
typedef typename SparseMatrixType::Index Index;
|
||||||
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols());
|
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols());
|
||||||
|
|
||||||
if(begin!=end)
|
if(begin!=end)
|
||||||
{
|
{
|
||||||
// pass 1: count the nnz per inner-vector
|
// pass 1: count the nnz per inner-vector
|
||||||
VectorXi wi(trMat.outerSize());
|
Matrix<Index,Dynamic,1> wi(trMat.outerSize());
|
||||||
wi.setZero();
|
wi.setZero();
|
||||||
for(InputIterator it(begin); it!=end; ++it)
|
for(InputIterator it(begin); it!=end; ++it)
|
||||||
{
|
{
|
||||||
@ -1018,7 +1019,7 @@ void SparseMatrix<Scalar,_Options,_Index>::sumupDuplicates()
|
|||||||
{
|
{
|
||||||
eigen_assert(!isCompressed());
|
eigen_assert(!isCompressed());
|
||||||
// TODO, in practice we should be able to use m_innerNonZeros for that task
|
// TODO, in practice we should be able to use m_innerNonZeros for that task
|
||||||
VectorXi wi(innerSize());
|
Matrix<Index,Dynamic,1> wi(innerSize());
|
||||||
wi.fill(-1);
|
wi.fill(-1);
|
||||||
Index count = 0;
|
Index count = 0;
|
||||||
// for each inner-vector, wi[inner_index] will hold the position of first element into the index/value buffers
|
// for each inner-vector, wi[inner_index] will hold the position of first element into the index/value buffers
|
||||||
@ -1081,7 +1082,7 @@ EIGEN_DONT_INLINE SparseMatrix<Scalar,_Options,_Index>& SparseMatrix<Scalar,_Opt
|
|||||||
|
|
||||||
// prefix sum
|
// prefix sum
|
||||||
Index count = 0;
|
Index count = 0;
|
||||||
VectorXi positions(dest.outerSize());
|
Matrix<Index,Dynamic,1> positions(dest.outerSize());
|
||||||
for (Index j=0; j<dest.outerSize(); ++j)
|
for (Index j=0; j<dest.outerSize(); ++j)
|
||||||
{
|
{
|
||||||
Index tmp = dest.m_outerIndex[j];
|
Index tmp = dest.m_outerIndex[j];
|
||||||
|
@ -57,7 +57,7 @@ struct permut_sparsematrix_product_retval
|
|||||||
if(MoveOuter)
|
if(MoveOuter)
|
||||||
{
|
{
|
||||||
SparseMatrix<Scalar,SrcStorageOrder,Index> tmp(m_matrix.rows(), m_matrix.cols());
|
SparseMatrix<Scalar,SrcStorageOrder,Index> tmp(m_matrix.rows(), m_matrix.cols());
|
||||||
VectorXi sizes(m_matrix.outerSize());
|
Matrix<Index,Dynamic,1> sizes(m_matrix.outerSize());
|
||||||
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
||||||
{
|
{
|
||||||
Index jp = m_permutation.indices().coeff(j);
|
Index jp = m_permutation.indices().coeff(j);
|
||||||
@ -77,7 +77,7 @@ struct permut_sparsematrix_product_retval
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SparseMatrix<Scalar,int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor,Index> tmp(m_matrix.rows(), m_matrix.cols());
|
SparseMatrix<Scalar,int(SrcStorageOrder)==RowMajor?ColMajor:RowMajor,Index> tmp(m_matrix.rows(), m_matrix.cols());
|
||||||
VectorXi sizes(tmp.outerSize());
|
Matrix<Index,Dynamic,1> sizes(tmp.outerSize());
|
||||||
sizes.setZero();
|
sizes.setZero();
|
||||||
PermutationMatrix<Dynamic,Dynamic,Index> perm;
|
PermutationMatrix<Dynamic,Dynamic,Index> perm;
|
||||||
if((Side==OnTheLeft) ^ Transposed)
|
if((Side==OnTheLeft) ^ Transposed)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user