ARTS
2.4.0(git:4fb77825)
|
Test for the linear algebra functions. More...
#include <stdlib.h>
#include <time.h>
#include <cmath>
#include <iostream>
#include <random>
#include "array.h"
#include "lin_alg.h"
#include "test_utils.h"
Go to the source code of this file.
Functions | |
void | test_lusolve1D (void) |
void | test_lusolve4D (void) |
void | test_solve_linear_system (Index ntests, Index dim, bool verbose) |
Test ludcmp and lubacksub by solving a linear system of equations. More... | |
void | test_inv (Index ntests, Index dim, bool verbose=false) |
Test matrix inversion. More... | |
void | test_matrix_exp4D (void) |
Test for the matrix exponential function (4D matrix) More... | |
void | test_matrix_exp1D (void) |
Test for the matrix exponential function (3D matrix) More... | |
void | test_matrix_exp3D (void) |
Test for the matrix exponential function (3D matrix) More... | |
void | test_real_diagonalize (Index ntests, Index dim) |
void | test_complex_diagonalize (Index ntests, Index dim) |
void | test_matrix_exp_propmat (Index nruns, Index ndiffs) |
int | main (void) |
Test for the linear algebra functions.
Definition in file test_linalg.cc.
int main | ( | void | ) |
Definition at line 624 of file test_linalg.cc.
References test_matrix_exp_propmat().
Definition at line 489 of file test_linalg.cc.
References diagonalize(), get_maximum_error(), inv(), mult(), random_fill_matrix_symmetric(), and ARTS::Var::time().
Test matrix inversion.
Generates a random, square (n,n)-matrix A and computes its inverse Ainv and I = Ainv*A. The maximum absolute error in I with respect to the identity matrix is written to standard out. The number of tests performed is controlled by the parameter ntests. If verbose == true, also A, Ainv and A*Ainv are written to standard out.
[in] | ntests | Number of tests to be performed. |
[in] | dim | Size of matrix A. |
[in] | verbose | Controls verbosity of output. If true, for each test the matrices A, Ainv and I = Ainv*A are written to standard out. Otherwise only the maximum absolute error in I = Ainv*A w.r.t. the identity matrix is written out. |
Definition at line 319 of file test_linalg.cc.
References get_maximum_error(), id_mat(), inv(), mult(), random_fill_matrix_pos_def(), and ARTS::Var::time().
void test_lusolve1D | ( | void | ) |
The function tests the LU-decompusition method for solving a 1D linear equation system. It uses the functions 'ludcmp' and 'lubacksub'.
Definition at line 49 of file test_linalg.cc.
References ludcmp().
void test_lusolve4D | ( | void | ) |
The function tests the LU-decompusition method for solving a linear equation system. It uses the functions 'ludcmp' and 'lubacksub'.
Definition at line 106 of file test_linalg.cc.
void test_matrix_exp1D | ( | void | ) |
Test for the matrix exponential function (3D matrix)
Definition at line 397 of file test_linalg.cc.
References matrix_exp(), and q.
void test_matrix_exp3D | ( | void | ) |
Test for the matrix exponential function (3D matrix)
Definition at line 417 of file test_linalg.cc.
References matrix_exp(), and q.
void test_matrix_exp4D | ( | void | ) |
Test for the matrix exponential function (4D matrix)
Definition at line 359 of file test_linalg.cc.
References matrix_exp(), and q.
Definition at line 528 of file test_linalg.cc.
Referenced by main().
Definition at line 444 of file test_linalg.cc.
References diagonalize(), get_maximum_error(), inv(), matrix_exp(), matrix_exp2(), mult(), random_fill_matrix_symmetric(), and ARTS::Var::time().
Test ludcmp and lubacksub by solving a linear system of equations.
Generates a random, square (n,n)-matrix A and a length-n vector x0 and solves A*x = A*x0. The maximum relative, component-wise error in abs(x0 - x) is written to standard out. The numbers of tests performed is controlled by the parameter ntests. If verbose == true, also A, x0 and x are written to standard out.
[in] | ntests | Number of tests to be performed. |
[in] | dim | Dimensionality of the equation system. |
[in] | verbose | Controls verbosity of output. If true, for each test the matrix A and the vectors x0 and x are written to standard out. Otherwise only the maximum relative error in each component of x is written out. |
Definition at line 252 of file test_linalg.cc.
References get_maximum_error(), lubacksub(), ludcmp(), mult(), random_fill_matrix_pos_def(), random_fill_vector(), solve(), ARTS::Var::time(), ARTS::Var::x(), and x0.