Create Minimizing Rayleigh Quotient

The assignment is to write an R function that uses cyclic coordinate descent to minimize the Rayleigh quotient, Lambda, where λ(x) = x′Ax / x′Bx , over x. Here A and B are positive semidefinite matrices.