ARTS  2.2.66
lin_alg.cc File Reference

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)
 

Detailed Description

Linear algebra functions.

Author
Claudia Emde claud.nosp@m.ia.e.nosp@m.mde@d.nosp@m.lr.d.nosp@m.e
Date
Thu May 2 10:59:55 2002

This file contains mathematical tools to solve the vector radiative transfer equation.

Definition in file lin_alg.cc.

Function Documentation

◆ det()

Determinant of N by N matrix. Simple recursive method.

Parameters
AIn: Matrix of size NxN.
Author
Richard Larsson
Date
2012-08-03

Definition at line 320 of file lin_alg.cc.

References det(), ConstMatrixView::ncols(), ConstMatrixView::nrows(), and temp.

Referenced by det().

◆ id_mat()

◆ linreg()

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

Parameters
pOut: Fitted coefficients.
xIn: x-value of data points
yIn: y-value of data points
Author
Patrick Eriksson
Date
2013-01-25

Definition at line 371 of file lin_alg.cc.

References ConstVectorView::nelem(), and Vector::resize().

Referenced by pnd_fieldF07ML(), pnd_fieldF07TR(), and ppathFromRtePos2().

◆ lubacksub()

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.

Parameters
xOutput: Solution vector of the equation system.
LUInput: LU decomposition of the matrix (output of function ludcp).
bInput: Right-hand-side vector of equation system.
indxInput: 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().

◆ ludcmp()

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.)

Parameters
LUOutput: returns L and U in one matrix
indxOutput: Vector that records the row permutation.
AInput: 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().

◆ matrix_exp()

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.

Parameters
FOutput: The matrix exponential of A (Has to be initialized before calling the function.
AInput: arbitrary square matrix
qInput: 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().

◆ norm_inf()

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).

Parameters
AInput: arbitrary matrix
Returns
Maximum absolute row sum norm

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().