FYS3150: Project 2
Loading...
Searching...
No Matches
Functions
jacobi.cpp File Reference

Implementation of the jacobi rotation method. More...

#include <cmath>
#include "utils.hpp"
#include "jacobi.hpp"
#include "matrix.hpp"

Functions

void jacobi_rotate (arma::mat &A, arma::mat &R, int k, int l)
 Computes a single rotation.
 
void jacobi_eigensolver (const arma::mat &A, double eps, arma::vec &eigenvalues, arma::mat &eigenvectors, const int maxiter, int &iterations, bool &converged)
 Solves the eigenvalue problem using the jacobi rotation method.
 

Detailed Description

Implementation of the jacobi rotation method.

Author
Cory Alexander Balaton (coryab)
Janita Ovidie Sandtrøen Willumsen (janitaws)
Bug:
The eigenvalues fail the test. When comparing them to arma::eigsym there is one value that is way off when testing with a 6x6 matrix.

Function Documentation

◆ jacobi_eigensolver()

void jacobi_eigensolver ( const arma::mat &  A,
double  eps,
arma::vec &  eigenvalues,
arma::mat &  eigenvectors,
const int  maxiter,
int &  iterations,
bool &  converged 
)

Solves the eigenvalue problem using the jacobi rotation method.

Description

Parameters
AThe initial matrix to be solved
epsTolerance
eigenvaluesA vector that will contain the computed eigenvalues
eigenvectorsA Matrix that will contain the computed eigenvectors
maxiterThe max number of iterations allowed
iterationsTo keep track of how many iterations the algorithm used
convergedTells the user if the algorithm has converged
Returns
Void

◆ jacobi_rotate()

void jacobi_rotate ( arma::mat &  A,
arma::mat &  R,
int  k,
int  l 
)

Computes a single rotation.

Description

Parameters
AMatrix A (m)
RThe rotation matrix R (m)
kIndex of the row with the element of largest absolute value
lIndex of the column with the element of largest absolute value
Returns
Void