Foundation Classes - Matrix multiplied issue#522
Merged
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom Jun 24, 2025
Merged
Foundation Classes - Matrix multiplied issue#522dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
Conversation
Refactor math_Matrix and fix incorrect multiplication
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the math_Matrix multiplication implementation to fix an incorrect multiplication result, particularly when a matrix is multiplied by itself. The changes include updating the multiplication logic in math_Matrix.cxx to use a temporary copy during calculations and adding a corresponding test file to the GTests build configuration.
- Refactor multiplication to avoid self-correlation issues by using a temporary copy.
- Update the multiplication loop to use the preserved copy for accurate computation.
- Add a test file (math_Matrix_Test.cxx) to verify proper behavior.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/FoundationClasses/TKMath/math/math_Matrix.cxx | Introduces a temporary copy (aTemp) for safe multiplication and fixes self-multiplication issues. |
| src/FoundationClasses/TKMath/GTests/FILES.cmake | Adds a new test file to the GTests suite to cover math_Matrix functionality. |
Comments suppressed due to low confidence (2)
src/FoundationClasses/TKMath/math/math_Matrix.cxx:639
- [nitpick] The variable name 'aTemp' is not very descriptive. Consider renaming it to 'tempMatrix' to improve clarity.
math_Matrix aTemp = *this;
src/FoundationClasses/TKMath/math/math_Matrix.cxx:638
- The temporary copy is created unconditionally, even when the multiplier is not the same as the destination matrix. Consider creating the copy only for self-multiplication cases to reduce unnecessary overhead.
// Create a temporary copy to avoid corrupting our own data during calculation
dpasukhi
added a commit
that referenced
this pull request
Sep 6, 2025
Refactor multiplication to avoid self-correlation issues by using a temporary copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor math_Matrix and fix incorrect multiplication