extend("gpu")
// 1. Define the rotation matrix (55° => cos≈0.5736, sin≈0.8192)
R = [
[0.5736, -0.8192],
[0.8192, 0.5736]
]
// 2. Triangle vertices as columns (each point is a column vector)
triangle = [
[1, 4, 1], // x coordinates: A, B, C
[1, 1, 5] // y coordinates: A, B, C
]
// 3. Convert both matrices to GPU tensors
R_tensor = gpu:to_tensor(R)
triangle_tensor = gpu:to_tensor(triangle)
// 4. Multiply: rotated_triangle = R * triangle
rotated_tensor = gpu:multiply(R_tensor, triangle_tensor)
// 5. Convert result back to Lava 2D array
rotated = gpu:to_array(rotated_tensor)
// 6. Print result
slog(rotated)