MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / scaling

Function scaling

linear_algebra/src/transformations_2d.py:20–26  ·  view source on GitHub ↗

>>> scaling(5) [[5.0, 0.0], [0.0, 5.0]]

(scaling_factor: float)

Source from the content-addressed store, hash-verified

18
19
20def scaling(scaling_factor: float) -> list[list[float]]:
21 """
22 >>> scaling(5)
23 [[5.0, 0.0], [0.0, 5.0]]
24 """
25 scaling_factor = float(scaling_factor)
26 return [[scaling_factor * int(x == y) for x in range(2)] for y in range(2)]
27
28
29def rotation(angle: float) -> list[list[float]]:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected