Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class BlockFullMatrix : public linearalgebra::BaseMatrix
Real r = 0;
for (Index j=0; j<BSIZE; ++j)
{
r += bloc(bi,bj)[i][j] * v[(bi + bj - 1)*BSIZE + j];
r += bloc(bi,bj)[i][j] * v[bj*BSIZE + j];
}
res[bi*BSIZE + i] = r;
}
Expand All @@ -191,7 +191,7 @@ class BlockFullMatrix : public linearalgebra::BaseMatrix
Real r = 0;
for (Index j=0; j<BSIZE; ++j)
{
r += bloc(bi,bj)[i][j] * v[(bi + bj - 1)*BSIZE + j];
r += bloc(bi,bj)[i][j] * v[bj*BSIZE + j];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was so wrong I don't understand how it worked previously. Is it used anywhere ?

}
res[bi*BSIZE + i] += r;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void BlockFullMatrix<N, T>::clearRowCol(Index i)
template<std::size_t N, typename T>
void BlockFullMatrix<N, T>::clear()
{
for (Index i=0; i<3*nBRow; ++i)
for (Index i=0; i<nBRow*nBCol; ++i)
data[i].clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,14 +454,16 @@ class CompressedRowSparseMatrixConstraint : public sofa::linearalgebra::Compress
RowConstIterator cbegin() const
{
if constexpr(Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
return RowConstIterator(this, 0);
return RowConstIterator(this,
this->rowIndex.empty() ? s_invalidIndex : 0);
}

/// Get the iterator corresponding to the end of the rows of blocks
RowConstIterator cend() const
{
if constexpr(Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
return RowConstIterator(this, Index(this->rowIndex.size()));
return RowConstIterator(this,
this->rowIndex.empty() ? s_invalidIndex : Index(this->rowIndex.size()));
}

class RowWriteAccessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public :

virtual void resizeBlock(Index nbBRow, Index nbBCol)
{
if (nBlockRow == nbBRow && nBlockRow == nbBCol)
if (nBlockRow == nbBRow && nBlockCol == nbBCol)
{
/// Just clear the matrix
for (Index i = 0; i < static_cast<Index>(colsValue.size()); ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1141,9 +1141,9 @@ class CompressedRowSparseMatrixMechanical final // final is used to allow the co
if constexpr (Policy::AutoCompress) const_cast<Matrix*>(this)->compress(); /// \warning this violates the const-ness of the method !
vresize( res, this->colBSize(), colSize() );

if constexpr (Policy::IsAlwaysSymetric) /// In symetric case this^T = this
if constexpr (Policy::IsAlwaysSymmetric) /// In symmetric case this^T = this
{
taddMul(res, vec);
taddMul<Real2>(res, vec);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ class SparseMatrix : public linearalgebra::BaseMatrix
}

template<class Real2>
MatrixExpr< MatrixAddition< SparseMatrix<T>, SparseMatrix<Real2> > > operator-(const SparseMatrix<Real2>& m) const
MatrixExpr< MatrixSubtraction< SparseMatrix<T>, SparseMatrix<Real2> > > operator-(const SparseMatrix<Real2>& m) const
{
return MatrixExpr { MatrixAddition< SparseMatrix<T>, SparseMatrix<Real2> >(*this, m) };
return MatrixExpr { MatrixSubtraction< SparseMatrix<T>, SparseMatrix<Real2> >(*this, m) };
}

void swap(SparseMatrix<T>& m)
Expand Down
Loading
Loading