NumPy allowed · plain Python earns 10 bonus points
Computed matrix × vector transformation
Estimate the dominant eigenvalue and eigenvector of a matrix via repeated matrix-vector multiplication.
Implement power_iteration(A, num_iters=20): initialize vector b = [1.0]*n. At each iteration compute b_next = A * b and normalize b = b_next / ||b_next||. After num_iters, compute the Rayleigh quotient eigenvalue lambda = (b . A*b) / (b . b). Return {"eigenvalue": float, "eigenvector": list[float]} rounded to 4 decimals.
power_iteration(A: list[list[float]], num_iters: int = 20) -> dict[str, Any]