Skip to content

LinearTransformation

LinearTransformation(matrix: Union[array, Sequence[Sequence[float]]])

Bases: BaseTransform

Transforms the node positions pos with a square transformation matrix: pos @ matrix.T.

Parameters:

Name Type Description Default
matrix Union[array, Sequence[Sequence[float]]]

The [D, D] transformation matrix.

required
Source code in mlx_graphs/transforms/point_cloud.py
def __init__(self, matrix: Union[mx.array, Sequence[Sequence[float]]]):
    matrix = mx.array(matrix) if not isinstance(matrix, mx.array) else matrix
    if matrix.ndim != 2 or matrix.shape[0] != matrix.shape[1]:
        raise ValueError(
            f"The transformation matrix must be square (got {matrix.shape})"
        )
    self.matrix = matrix.T

from mlx_graphs.transforms import LinearTransformation · mlx_graphs/transforms/point_cloud.py