Project-2/include/matrix.hpp
2023-09-20 16:41:47 +02:00

60 lines
1.6 KiB
C++

/** @file matrix.hpp
* @brief Function prototypes for creating tridiagonal matrices.
*
*
*
* @author Cory Alexander Balaton (coryab)
* @author Janita Ovidie Sandtrøen Willumsen (janitaws)
* @bug No known bugs
*/
#ifndef __MATRIX__
#define __MATRIX__
#include <armadillo>
/** @brief Create a tridiagonal matrix.
*
* @param a Vector for the lower diagonal of size N-1
* @param d Vector for the main diagonal of size N
* @param e Vector for the upper diagonal of size N-1
*
* @return arma::matrix
* */
arma::mat create_tridiagonal(
const arma::vec& a,
const arma::vec& d,
const arma::vec& e);
/** @brief Create a tridiagonal matrix.
*
* @param n The dimensions of the tridiagonal matrix
* @param a The signature for the lower diagonal
* @param d The signature for the main diagonal
* @param e The signature for the upper diagonal
*
* @return arma::matrix
* */
arma::mat create_tridiagonal(int n, double a, double d, double e);
/** @brief Create a symmetric tridiagonal matrix.
*
* @param n The dimensions of the tridiagonal matrix
* @param a The signature for the off diagonals
* @param d The signature for the main diagonal
*
* @return arma::matrix
* */
arma::mat create_symmetric_tridiagonal(int n, double a, double d);
/** @brief Find the off-diagonal element with the largest absolute value.
*
* @param A Symmetric matrix
* @param k Variable to store the row of the return value
* @param l Variable to store the column of the return value
*
* @return Double
* */
double max_offdiag_symmetric(arma::mat& A, int& k, int& l);
#endif