baybe.transformations.utils.compress_transformations

baybe.transformations.utils.compress_transformations(transformations: Iterable[Transformation], /)[source]

Compress any chain of transformations by removing redundancies.

Drops identity transformations and combines subsequent affine transformations.

Parameters:

transformations (Iterable[Transformation]) – An iterable of transformations.

Raises:

TypeError – If any of the passed elements is not a baybe.transformations.base.Transformation.

Return type:

tuple[Transformation, ...]

Returns:

The minimum sequence of transformations that is equivalent to the input.