Skip to content

try_inverse and ownership #1564

@imyxh

Description

@imyxh

Hi, I noticed in the docs for try_inverse_mut:

If you need to preserve the original matrix regardless of success or failure, consider using Self::try_inverse instead.

But try_inverse takes self, not &self, and consumes the matrix. So, two points:

  1. Should the docs be reworded? To me, the implication that try_inverse preserves the original matrix seems to be false. Or is something else meant by "preserved"?
  2. Is there a possible performance optimization here, to maketry_inverse not take ownership of the matrix, and thus allow the end-user to avoid .clone()? We still have to allocate memory for the LU decomposition, but we can at least save CPU cycles copying all the values, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions