Skip to content

[LinearAlgebra] Various bugfixes and add unit tests#5989

Open
fredroy wants to merge 11 commits intosofa-framework:masterfrom
fredroy:fix_bugs_linearalgebra
Open

[LinearAlgebra] Various bugfixes and add unit tests#5989
fredroy wants to merge 11 commits intosofa-framework:masterfrom
fredroy:fix_bugs_linearalgebra

Conversation

@fredroy
Copy link
Contributor

@fredroy fredroy commented Mar 3, 2026

BlockFullMatrix:

  • fix bug in operator* (wrong access)
  • fix bug in clear(), where the browsing size is wrong

SparseMatrix:

  • fix operator- for MatExpr (looks like a copy-paste with operator+)

CompressedRowSparseMatrixGeneric:

  • wrong equality test in resizeBlock()

CompressedRowSparseMatrixMechanical:

  • fix typo which would lead to a compilation error (+a nested compilation error inside)

CompressedRowSparseMatrixConstraint:

  • fix bug when calling cbegin/cend on empty CRSMConstraint

+ add unit tests for all those 5 classes

[with-all-tests]


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

fredroy added 11 commits March 3, 2026 12:49
 replacing 3*nBRow with nBRow*nBCol so that clear() iterates over the actual number of allocated blocks instead of a hardcoded factor of 3.
The ResizeBlockNonSquare test specifically covers the regression for commit 6558a85 (the nBlockRow == nbBRow && nBlockCol == nbBCol fix), verifying that resizing with same rows but different cols (or vice versa) triggers a full
   reset rather than just zeroing values.
@fredroy fredroy added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request pr: test PR adding test(s) in SOFA pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI labels Mar 3, 2026
@fredroy
Copy link
Contributor Author

fredroy commented Mar 3, 2026

[ci-build][with-all-tests]

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: AI-aided Label notifying the reviewers that part or all of the PR has been generated with the help of an AI pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request pr: test PR adding test(s) in SOFA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants