powered by
Finds a dominant eigenvalue and its corresponding eigenvector of a square matrix by applying the Power Method with scaling
power_method(X, v = NULL, eps = 1e-06, maxiter = 100, verbose = FALSE)
a square numeric matrix
optional starting vector
convergence threshold
maximum number of iterations
logical; if TRUE, show the approximation to the eigenvector at each iteration
TRUE
a list containing the eigenvector, eigenvalue, and iterations
# NOT RUN { A = cbind(c(2, 1), c(12, 5)) power_method(A) eigen(A)$vectors[,1] # check B = cbind(c(1, 2, 0), c(2, 1, 3), c(0, 3, 1)) power_method(B) # }
Run the code above in your browser using DataLab