Skip to content

Foundation Classes - Matrix multiplied issue#522

Merged
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_matrix
Jun 24, 2025
Merged

Foundation Classes - Matrix multiplied issue#522
dpasukhi merged 4 commits intoOpen-Cascade-SAS:IRfrom
dpasukhi:math_matrix

Conversation

@dpasukhi
Copy link
Copy Markdown
Member

Refactor math_Matrix and fix incorrect multiplication

@dpasukhi dpasukhi added this to the Release 7.9.1 milestone May 12, 2025
@dpasukhi dpasukhi requested review from a team and Copilot May 12, 2025 18:52
@dpasukhi dpasukhi self-assigned this May 12, 2025
@dpasukhi dpasukhi added 2. Bug Something isn't working 1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code labels May 12, 2025

This comment was marked as outdated.

@dpasukhi dpasukhi modified the milestones: Release 7.9.1, Release 8.0 May 19, 2025
Refactor math_Matrix and fix incorrect multiplication
@dpasukhi dpasukhi requested a review from Copilot June 24, 2025 08:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 dpasukhi merged commit 9792001 into Open-Cascade-SAS:IR Jun 24, 2025
34 checks passed
@dpasukhi dpasukhi deleted the math_matrix branch June 24, 2025 11:38
@github-project-automation github-project-automation bot moved this from Todo to Done in Maintenance Jun 24, 2025
dpasukhi added a commit that referenced this pull request Sep 6, 2025
Refactor multiplication to avoid self-correlation issues by using a temporary copy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1. Foundation Classes Containers, system calls wrappers, smart pointers and other low level of OCCT code 2. Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants