ARTS
2.2.66
|
Linear algebra functions. More...
#include "lin_alg.h"
#include <stdexcept>
#include <cmath>
#include "arts.h"
#include "make_vector.h"
#include "array.h"
#include "logic.h"
Go to the source code of this file.
Functions | |
void | ludcmp (MatrixView LU, ArrayOfIndex &indx, ConstMatrixView A) |
LU decomposition. More... | |
void | lubacksub (VectorView x, ConstMatrixView LU, ConstVectorView b, const ArrayOfIndex &indx) |
LU backsubstitution. More... | |
void | matrix_exp (MatrixView F, ConstMatrixView A, const Index &q) |
General exponential of a Matrix. More... | |
Numeric | norm_inf (ConstMatrixView A) |
Maximum absolute row sum norm. More... | |
void | id_mat (MatrixView I) |
Identity Matrix. More... | |
Numeric | det (ConstMatrixView A) |
void | linreg (Vector &p, ConstVectorView x, ConstVectorView y) |
Linear algebra functions.
This file contains mathematical tools to solve the vector radiative transfer equation.
Definition in file lin_alg.cc.
Numeric det | ( | ConstMatrixView | A | ) |
Determinant of N by N matrix. Simple recursive method.
A | In: Matrix of size NxN. |
Definition at line 320 of file lin_alg.cc.
References det(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), and temp.
Referenced by det().
void id_mat | ( | MatrixView | I | ) |
Identity Matrix.
I | Output: identity matrix |
Definition at line 299 of file lin_alg.cc.
References ConstMatrixView::ncols(), and ConstMatrixView::nrows().
Referenced by fos(), get_ppath_trans(), get_ppath_trans2(), iyCloudRadar(), iyEmissionStandard(), iyTransmissionStandard(), matrix_exp(), MCGeneral(), MCIPA(), mcPathTraceGeneral(), mcPathTraceIPA(), and rte_step_doit().
void linreg | ( | Vector & | p, |
ConstVectorView | x, | ||
ConstVectorView | y | ||
) |
Determines coefficients for linear regression
Performs a least squares estimation of the model
y = p[0] + p[1] * x
p | Out: Fitted coefficients. |
x | In: x-value of data points |
y | In: y-value of data points |
Definition at line 371 of file lin_alg.cc.
References ConstVectorView::nelem(), and Vector::resize().
Referenced by pnd_fieldF07ML(), pnd_fieldF07TR(), and ppathFromRtePos2().
void lubacksub | ( | VectorView | x, |
ConstMatrixView | LU, | ||
ConstVectorView | b, | ||
const ArrayOfIndex & | indx | ||
) |
LU backsubstitution.
Solves a set of linear equations Ax=b. It is neccessairy to do a LU
decomposition using the function ludcp before using this function.
x | Output: Solution vector of the equation system. |
LU | Input: LU decomposition of the matrix (output of function ludcp). |
b | Input: Right-hand-side vector of equation system. |
indx | Input: Pivoting information (output of function ludcp). |
Definition at line 142 of file lin_alg.cc.
References is_size(), and ConstMatrixView::nrows().
Referenced by matrix_exp(), rte_step_doit(), test_lusolve1D(), and test_lusolve4D().
void ludcmp | ( | MatrixView | LU, |
ArrayOfIndex & | indx, | ||
ConstMatrixView | A | ||
) |
LU decomposition.
This function performes a LU Decomposition of the matrix A. (Compare Numerical Recipies in C, pages 36-48.)
LU | Output: returns L and U in one matrix |
indx | Output: Vector that records the row permutation. |
A | Input: Matrix for which the LU decomposition is performed |
Definition at line 54 of file lin_alg.cc.
References abs, is_size(), ConstMatrixView::nrows(), and temp.
Referenced by matrix_exp(), rte_step_doit(), test_lusolve1D(), and test_lusolve4D().
void matrix_exp | ( | MatrixView | F, |
ConstMatrixView | A, | ||
const Index & | q | ||
) |
General exponential of a Matrix.
The exponential of a matrix is computed using the Pade-Approximation. The method is decribed in: Golub, G. H. and C. F. Van Loan, Matrix Computation, p. 384, Johns Hopkins University Press, 1983.
The Pade-approximation is applied on all cases. If a faster option can be applied has to be checked before calling the function.
F | Output: The matrix exponential of A (Has to be initialized before calling the function. |
A | Input: arbitrary square matrix |
q | Input: Parameter for the accuracy of the computation |
Definition at line 194 of file lin_alg.cc.
References id_mat(), is_size(), joker, lubacksub(), ludcmp(), mult(), N, ConstMatrixView::ncols(), norm_inf(), and q.
Referenced by ext2trans(), test_matrix_exp1D(), test_matrix_exp3D(), and test_matrix_exp4D().
Numeric norm_inf | ( | ConstMatrixView | A | ) |
Maximum absolute row sum norm.
This function returns the maximum absolute row sum norm of a matrix A (see user guide for the definition).
A | Input: arbitrary matrix |
Definition at line 277 of file lin_alg.cc.
References abs, ConstMatrixView::ncols(), norm_inf(), and ConstMatrixView::nrows().
Referenced by matrix_exp(), and norm_inf().