diff --git a/doc/html/jacobi_8cpp.html b/doc/html/jacobi_8cpp.html index b2b3817..6ae30c7 100644 --- a/doc/html/jacobi_8cpp.html +++ b/doc/html/jacobi_8cpp.html @@ -157,7 +157,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Solves the eigenvalue problem using the jacobi rotation method.

-

Description

+

jacobi_eigensolver Initializes matrices A_m and R before going into the main loop.

+

For each iteration of the loop, it finds the largest absolute off-diagonal value of A_m, and then calls jacobi_rotate. The loop stops when the largest off-diagonal is less than the tolerance (eps) or if the maximum number of iterations has been reached.

+

The last thing this function does is to sort the eigenvalues and the corresponding eigenvectors in ascending order.

Parameters
@@ -213,7 +215,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Computes a single rotation.

-

Description

+

jacobi_rotate computes a single rotation for Jacobi's rotation algorithm. It starts by calculating tau, t (tan), c (cos), s (sin) and then updates A and R at rows/columsn k and l.

Parameters
AThe initial matrix to be solved
diff --git a/doc/html/jacobi_8hpp.html b/doc/html/jacobi_8hpp.html index 475ce9a..c4e7812 100644 --- a/doc/html/jacobi_8hpp.html +++ b/doc/html/jacobi_8hpp.html @@ -158,7 +158,9 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Solves the eigenvalue problem using the jacobi rotation method.

-

Description

+

jacobi_eigensolver Initializes matrices A_m and R before going into the main loop.

+

For each iteration of the loop, it finds the largest absolute off-diagonal value of A_m, and then calls jacobi_rotate. The loop stops when the largest off-diagonal is less than the tolerance (eps) or if the maximum number of iterations has been reached.

+

The last thing this function does is to sort the eigenvalues and the corresponding eigenvectors in ascending order.

Parameters
AMatrix A (m)
@@ -214,7 +216,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Computes a single rotation.

-

Description

+

jacobi_rotate computes a single rotation for Jacobi's rotation algorithm. It starts by calculating tau, t (tan), c (cos), s (sin) and then updates A and R at rows/columsn k and l.

Parameters
AThe initial matrix to be solved
diff --git a/doc/html/jacobi_8hpp_source.html b/doc/html/jacobi_8hpp_source.html index 844b3c8..20ddc25 100644 --- a/doc/html/jacobi_8hpp_source.html +++ b/doc/html/jacobi_8hpp_source.html @@ -82,17 +82,17 @@ $(function() {
10
11#include <armadillo>
12
-
24void jacobi_rotate(arma::mat& A, arma::mat& R, int k, int l);
-
25
-
40void jacobi_eigensolver(const arma::mat& A,
-
41 double eps,
-
42 arma::vec& eigenvalues,
-
43 arma::mat& eigenvectors,
-
44 const int maxiter,
-
45 int& iterations,
-
46 bool& converged);
-
47
-
48#endif
+
26void jacobi_rotate(arma::mat& A, arma::mat& R, int k, int l);
+
27
+
51void jacobi_eigensolver(const arma::mat& A,
+
52 double eps,
+
53 arma::vec& eigenvalues,
+
54 arma::mat& eigenvectors,
+
55 const int maxiter,
+
56 int& iterations,
+
57 bool& converged);
+
58
+
59#endif
void jacobi_rotate(arma::mat &A, arma::mat &R, int k, int l)
Computes a single rotation.
Definition: jacobi.cpp:17
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.
Definition: jacobi.cpp:56
diff --git a/doc/html/matrix_8cpp.html b/doc/html/matrix_8cpp.html index 19d878d..9f417b5 100644 --- a/doc/html/matrix_8cpp.html +++ b/doc/html/matrix_8cpp.html @@ -134,6 +134,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a symmetric tridiagonal matrix.

+

create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by calling create_tridiagonal with the same signature for the off-diagonals.

Parameters
AMatrix A (m)
@@ -179,6 +180,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a tridiagonal matrix.

+

create_tridiagonal creates a tridiagonal matrix by first creating a matrix, filled with zeros, of size NxN where N is the size of the main diagonal matrix. Then it will fill all the values from the vector parameters into the matrix and return it.

Parameters
nThe dimensions of the tridiagonal matrix
@@ -230,6 +232,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a tridiagonal matrix.

+

This is an overload that takes doubles for the diagonals instead of vectors. It will create 3 vectors that are filled with the signature provided in the arguments, and then call create_tridiagonal with the vectors as the arguments.

Parameters
aVector for the lower diagonal of size N-1
@@ -276,6 +279,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Find the off-diagonal element with the largest absolute value.

+

max_offdiag_symmetric find the element with the largest absolute value that isn't in the diagonal. Since this function assumes that the matrix that is given is symmetrical, we only need to loop through the upper diagonals of the matrix.

Parameters
nThe dimensions of the tridiagonal matrix
diff --git a/doc/html/matrix_8hpp.html b/doc/html/matrix_8hpp.html index 58f65a1..2063274 100644 --- a/doc/html/matrix_8hpp.html +++ b/doc/html/matrix_8hpp.html @@ -140,6 +140,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a symmetric tridiagonal matrix.

+

create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by calling create_tridiagonal with the same signature for the off-diagonals.

Parameters
ASymmetric matrix
@@ -185,6 +186,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a tridiagonal matrix.

+

create_tridiagonal creates a tridiagonal matrix by first creating a matrix, filled with zeros, of size NxN where N is the size of the main diagonal matrix. Then it will fill all the values from the vector parameters into the matrix and return it.

Parameters
nThe dimensions of the tridiagonal matrix
@@ -236,6 +238,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Create a tridiagonal matrix.

+

This is an overload that takes doubles for the diagonals instead of vectors. It will create 3 vectors that are filled with the signature provided in the arguments, and then call create_tridiagonal with the vectors as the arguments.

Parameters
aVector for the lower diagonal of size N-1
@@ -282,6 +285,7 @@ Janita Ovidie Sandtrøen Willumsen (janitaws)

Find the off-diagonal element with the largest absolute value.

+

max_offdiag_symmetric find the element with the largest absolute value that isn't in the diagonal. Since this function assumes that the matrix that is given is symmetrical, we only need to loop through the upper diagonals of the matrix.

Parameters
nThe dimensions of the tridiagonal matrix
diff --git a/doc/html/matrix_8hpp_source.html b/doc/html/matrix_8hpp_source.html index 2bd064b..177478b 100644 --- a/doc/html/matrix_8hpp_source.html +++ b/doc/html/matrix_8hpp_source.html @@ -82,18 +82,18 @@ $(function() {
12
13#include <armadillo>
14
-
23arma::mat create_tridiagonal(
-
24 const arma::vec& a,
-
25 const arma::vec& d,
-
26 const arma::vec& e);
-
27
-
37arma::mat create_tridiagonal(int n, double a, double d, double e);
-
38
-
47arma::mat create_symmetric_tridiagonal(int n, double a, double d);
+
28arma::mat create_tridiagonal(
+
29 const arma::vec& a,
+
30 const arma::vec& d,
+
31 const arma::vec& e);
+
32
+
47arma::mat create_tridiagonal(int n, double a, double d, double e);
48
-
57double max_offdiag_symmetric(arma::mat& A, int& k, int& l);
-
58
-
59#endif
+
60arma::mat create_symmetric_tridiagonal(int n, double a, double d);
+
61
+
75double max_offdiag_symmetric(arma::mat& A, int& k, int& l);
+
76
+
77#endif
arma::mat create_symmetric_tridiagonal(int n, double a, double d)
Create a symmetric tridiagonal matrix.
Definition: matrix.cpp:44
arma::mat create_tridiagonal(const arma::vec &a, const arma::vec &d, const arma::vec &e)
Create a tridiagonal matrix.
Definition: matrix.cpp:12
double max_offdiag_symmetric(arma::mat &A, int &k, int &l)
Find the off-diagonal element with the largest absolute value.
Definition: matrix.cpp:49
diff --git a/include/jacobi.hpp b/include/jacobi.hpp index faa82ac..0fa0c62 100644 --- a/include/jacobi.hpp +++ b/include/jacobi.hpp @@ -12,7 +12,9 @@ /** @brief Computes a single rotation. * - * Description + * jacobi_rotate computes a single rotation for Jacobi's rotation algorithm. + * It starts by calculating tau, t (tan), c (cos), s (sin) and then + * updates A and R at rows/columsn k and l. * * @param A Matrix A (m) * @param R The rotation matrix R (m) @@ -25,7 +27,16 @@ void jacobi_rotate(arma::mat& A, arma::mat& R, int k, int l); /** @brief Solves the eigenvalue problem using the jacobi rotation method. * - * Description + * jacobi_eigensolver Initializes matrices A_m and R before going into the + * main loop. + * + * For each iteration of the loop, it finds the largest absolute off-diagonal + * value of A_m, and then calls jacobi_rotate. The loop stops when the largest + * off-diagonal is less than the tolerance (eps) or if the maximum number of + * iterations has been reached. + * + * The last thing this function does is to sort the eigenvalues and the + * corresponding eigenvectors in ascending order. * * @param A The initial matrix to be solved * @param eps Tolerance diff --git a/include/matrix.hpp b/include/matrix.hpp index cfda46f..992c724 100644 --- a/include/matrix.hpp +++ b/include/matrix.hpp @@ -13,6 +13,11 @@ #include /** @brief Create a tridiagonal matrix. + * + * create_tridiagonal creates a tridiagonal matrix by first creating a matrix, + * filled with zeros, of size NxN where N is the size of the main diagonal + * matrix. Then it will fill all the values from the vector parameters into + * the matrix and return it. * * @param a Vector for the lower diagonal of size N-1 * @param d Vector for the main diagonal of size N @@ -26,6 +31,11 @@ arma::mat create_tridiagonal( const arma::vec& e); /** @brief Create a tridiagonal matrix. + * + * This is an overload that takes doubles for the diagonals instead of + * vectors. It will create 3 vectors that are filled with the signature + * provided in the arguments, and then call create_tridiagonal with the + * vectors as the arguments. * * @param n The dimensions of the tridiagonal matrix * @param a The signature for the lower diagonal @@ -37,6 +47,9 @@ arma::mat create_tridiagonal( arma::mat create_tridiagonal(int n, double a, double d, double e); /** @brief Create a symmetric tridiagonal matrix. + * + * create_symmetric_tridiagonal creates a symmetric tridiagonal matrix by + * calling create_tridiagonal with the same signature for the off-diagonals. * * @param n The dimensions of the tridiagonal matrix * @param a The signature for the off diagonals @@ -47,6 +60,11 @@ arma::mat create_tridiagonal(int n, double a, double d, double e); arma::mat create_symmetric_tridiagonal(int n, double a, double d); /** @brief Find the off-diagonal element with the largest absolute value. + * + * max_offdiag_symmetric find the element with the largest absolute value + * that isn't in the diagonal. Since this function assumes that the matrix + * that is given is symmetrical, we only need to loop through the upper + * diagonals of the matrix. * * @param A Symmetric matrix * @param k Variable to store the row of the return value
ASymmetric matrix