Skip to content

Commit ccb70f7

Browse files
committed
return type operator()
1 parent ae81626 commit ccb70f7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/matrix.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,30 @@ class IncidenceMatrix : public SparseMatrix<int, ColMajor, int>
4141
template<typename OtherDerived>
4242
IncidenceMatrix& operator=( const SparseMatrixBase <OtherDerived>& other)
4343
{
44-
this->SparseMatrix<int, ColMajor,int>::operator=(other);
44+
this->SparseMatrix<int,ColMajor,int>::operator=(other);
4545
return *this;
4646
}
4747

4848
//! indexing with vectors
4949
template <typename Indices>
50-
SparseMatrix<int,ColMajor,int>
51-
operator() (const Indices & rowIndices, const Indices & colIndices) const
50+
IncidenceMatrix operator() (const Indices & rowIndices, const Indices & colIndices) const
5251
{
5352
const Index R = rowIndices.size();
5453
const Index C = colIndices.size();
5554

56-
SparseMatrix<int,ColMajor,int> Left(R, this->rows());
55+
SparseMatrix<int,ColMajor,int> Left(R,this->rows());
5756
Left.reserve(R);
5857
for (Index r=0; r<R; r++) {
5958
Left.insert(r,rowIndices(r)) = 1;
6059
}
6160

62-
SparseMatrix<int,ColMajor,int> Right(this->cols(), C);
63-
Right.reserve(colIndices.size());
61+
SparseMatrix<int,ColMajor,int> Right(this->cols(),C);
62+
Right.reserve(C);
6463
for (Index c=0; c<C; c++) {
6564
Right.insert(colIndices(c),c) = 1;
6665
}
6766

68-
return Left*(*this)*Right;
67+
return {Left*(*this)*Right};
6968
}
7069

7170
[[nodiscard]] bool isSet( Index r, Index c) const; //!< Check if r and c are related

0 commit comments

Comments
 (0)