Skip to content

Specialized version invertMatrix for 2x2 and 3x3 are not aliasing-safe #6273

Description

@fredroy

Meaning, calling invertMatrix(mat, mat) with mat = type::Mat<2,2> and type::Mat<3,3> is wrong.

Because :
(illustration with 2x2):
https://github.com/alxbilger/sofa/blob/a1395f7adce413f1ce1966e9e4055c2ad0334545/Sofa/framework/Type/src/sofa/type/Mat.h#L1198

    dest(0,0)=  from(1,1)/det;
    dest(0,1)= -from(0,1)/det;
    dest(1,0)= -from(1,0)/det;
    dest(1,1)=  from(0,0)/det;

first line of code will modify mat(0,0) and then last line will use this value for mat(1,1)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bug (major)Critical bug affecting everyone: not working, performances or accuracy degraded

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions