Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ENH]: improve the data structure of transformer pipeline base on the math structure of coordinate transformations #29643

Open
@weipeng1999

Description

@weipeng1999

Problem

The addition and subtraction operations in the transformer pipeline always produce various redundant structures, affecting performance and not living up to expectations.

Proposed solution

It is well known that matplotlib uses a transformer pipeline to provide coordinate transformations. The transformer pipeline connects individual transformers in sequence, using the transformation result of the previous transformer as the original coordinates for the next one. Based on the characteristics of coordinate transformations, we can consider it to conform to a mathematical structure called a group, which has the following properties within the transformer pipeline:

  • A binary operation (concatenating two transformer pipelines)
  • The binary operation has an identity element (IdentityTransform does not change the coordinates and can serve as the identity element)
  • The binary operation satisfies the associative law (the order of concatenation does not change the transformation result, the transformation result of a+(b+c) is consistent with that of (a+b)+c)
  • The binary operation has an inverse (the inverse function can return the inverse transformation of the current transformer pipeline)

In light of this, I believe the data structure should be improved as follows to conform to the underlying mathematical structure:

  • The CompositeGenericTransform class doesn't need a nested structure any more; its storage can be changed to a list of independent transformers. When adding or subtracting, first concatenate the two lists, and then eliminate independent transformers one by one from the connection point. This algorithm can eliminate redundant transformers as much as possible.
  • Adding or subtracting IdentityTransform from the transformer pipeline equals the original transformer pipeline.

This is expected not to change the API and should improve the performance of CompositeGenericTransform.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp