PIXELBANKv8.2.1
Menu

Implement the power iteration method to find the dominant eigenvector of a matrix. This task involves understanding the underlying concept of eigenvalues and eigenvectors, which are crucial in linear algebra and have numerous applications in computer vision and machine learning.

The power iteration method is an iterative algorithm that finds the eigenvector corresponding to the largest eigenvalue of a matrix AA. The process involves starting with a random vector v0\mathbf{v}_0 and iteratively updating it using the matrix AA. The key idea is to repeatedly apply the matrix AA to the current vector and normalize the result.

Here are the general steps:

  1. Initialize a random vector v0\mathbf{v}_0
  2. Iterate: update the vector using the matrix AA and normalize the result
  3. Repeat until convergence
vk+1=AvkAvk\mathbf{v}_{k+1} = \frac{A\mathbf{v}_k}{||A\mathbf{v}_k||}

This technique is widely used in principal component analysis (PCA).

Example:

Input:
power_iteration([[2, 0], [0, 1]], [1, 1], 10)
Output:
[1.0, 0.0]
Reasoning:

Converges to eigenvector [1, 0] for eigenvalue 2

Constraints:

  • A is a square matrix (n×n) where 2 ≤ n ≤ 10
  • Perform exactly the specified number of iterations
  • Normalize the vector after each iteration
  • Return the final vector rounded to 4 decimal places
Editor

Test Results

0/0
Run code to see test results.