Project-2/include/jacobi.hpp

49 lines
1.5 KiB
C++

/** @file jacobi.hpp
* @brief Function prototypes for the jacobi rotation algorithm.
*
* @author Cory Alexander Balaton (coryab)
* @author Janita Ovidie Sandtrøen Willumsen (janitaws)
* @bug No known bugs
*/
#ifndef __JACOBI__
#define __JACOBI__
#include <armadillo>
/** @brief Computes a single rotation.
*
* Description
*
* @param A Matrix A<sup> (m) </sup>
* @param R The rotation matrix R<sup> (m) </sup>
* @param k Index of the row with the element of largest absolute value
* @param l Index of the column with the element of largest absolute value
*
* @return Void
*/
void jacobi_rotate(arma::mat& A, arma::mat& R, int k, int l);
/** @ brief Solves the eigenvalue problem using the jacobi rotation method.
*
* Description
*
* @param A The initial matrix to be solved
* @param eps Tolerance
* @param eigenvalues A vector that will contain the computed eigenvalues
* @param eigenvectors A Matrix that will contain the computed eigenvectors
* @param maxiter The max number of iterations allowed
* @param iterations To keep track of how many iterations the algorithm used
* @param converged Tells the user if the algorithm has converged
*
* @return Void
* */
void jacobi_eigensolver(const arma::mat& A,
double eps,
arma::vec& eigenvalues,
arma::mat& eigenvectors,
const int maxiter,
int& iterations,
bool& converged);
#endif