Classes | |
class | Accessor |
class | const_iterator |
class | ExcEmptyMatrix |
class | ExcInvalidDestination |
class | ExcNotRegular |
class | ExcSourceEqualsDestination |
Public Types | |
typedef number | value_type |
typedef numbers::NumberTraits < number >::real_type | real_type |
Public Member Functions | |
Constructors and initalization. | |
FullMatrix (const unsigned int n=0) | |
FullMatrix (const unsigned int rows, const unsigned int cols) | |
FullMatrix (const FullMatrix &) | |
FullMatrix (const unsigned int rows, const unsigned int cols, const number *entries) | |
FullMatrix (const IdentityMatrix &id) | |
FullMatrix< number > & | operator= (const FullMatrix< number > &) |
template<typename number2 > | |
FullMatrix< number > & | operator= (const FullMatrix< number2 > &) |
FullMatrix< number > & | operator= (const number d) |
FullMatrix< number > & | operator= (const IdentityMatrix &id) |
template<typename number2 > | |
FullMatrix< number > & | operator= (const LAPACKFullMatrix< number2 > &) |
template<class MATRIX > | |
void | copy_from (const MATRIX &) |
template<typename number2 > | |
void | fill (const FullMatrix< number2 > &src, const unsigned int dst_offset_i=0, const unsigned int dst_offset_j=0, const unsigned int src_offset_i=0, const unsigned int src_offset_j=0) |
template<typename number2 > | |
void | fill (const number2 *) |
template<typename number2 > | |
void | fill_permutation (const FullMatrix< number2 > &src, const std::vector< unsigned int > &p_rows, const std::vector< unsigned int > &p_cols) |
Non-modifying operators | |
bool | operator== (const FullMatrix< number > &) const |
unsigned int | m () const |
unsigned int | n () const |
bool | all_zero () const |
template<typename number2 > | |
number2 | matrix_norm_square (const Vector< number2 > &v) const |
template<typename number2 > | |
number2 | matrix_scalar_product (const Vector< number2 > &u, const Vector< number2 > &v) const |
real_type | l1_norm () const |
real_type | linfty_norm () const |
real_type | frobenius_norm () const |
real_type | relative_symmetry_norm2 () const |
number | determinant () const |
number | trace () const |
template<class STREAM > | |
void | print (STREAM &s, const unsigned int width=5, const unsigned int precision=2) const |
void | print_formatted (std::ostream &out, const unsigned int precision=3, const bool scientific=true, const unsigned int width=0, const char *zero_string=" ", const double denominator=1., const double threshold=0.) const |
unsigned int | memory_consumption () const |
Iterator functions | |
const_iterator | begin () const |
const_iterator | end () const |
const_iterator | begin (const unsigned int r) const |
const_iterator | end (const unsigned int r) const |
Modifying operators | |
FullMatrix & | operator*= (const number factor) |
FullMatrix & | operator/= (const number factor) |
template<typename number2 > | |
void | add (const number a, const FullMatrix< number2 > &A) |
template<typename number2 > | |
void | add (const number a, const FullMatrix< number2 > &A, const number b, const FullMatrix< number2 > &B) |
template<typename number2 > | |
void | add (const number a, const FullMatrix< number2 > &A, const number b, const FullMatrix< number2 > &B, const number c, const FullMatrix< number2 > &C) |
template<typename number2 > | |
void | add (const FullMatrix< number2 > &src, const number factor, const unsigned int dst_offset_i=0, const unsigned int dst_offset_j=0, const unsigned int src_offset_i=0, const unsigned int src_offset_j=0) |
template<typename number2 > | |
void | Tadd (const number s, const FullMatrix< number2 > &B) |
template<typename number2 > | |
void | Tadd (const FullMatrix< number2 > &src, const number factor, const unsigned int dst_offset_i=0, const unsigned int dst_offset_j=0, const unsigned int src_offset_i=0, const unsigned int src_offset_j=0) |
void | add_row (const unsigned int i, const number s, const unsigned int j) |
void | add_row (const unsigned int i, const number s, const unsigned int j, const number t, const unsigned int k) |
void | add_col (const unsigned int i, const number s, const unsigned int j) |
void | add_col (const unsigned int i, const number s, const unsigned int j, const number t, const unsigned int k) |
void | swap_row (const unsigned int i, const unsigned int j) |
void | swap_col (const unsigned int i, const unsigned int j) |
void | diagadd (const number s) |
template<typename number2 > | |
void | equ (const number a, const FullMatrix< number2 > &A) |
template<typename number2 > | |
void | equ (const number a, const FullMatrix< number2 > &A, const number b, const FullMatrix< number2 > &B) |
template<typename number2 > | |
void | equ (const number a, const FullMatrix< number2 > &A, const number b, const FullMatrix< number2 > &B, const number c, const FullMatrix< number2 > &C) |
void | symmetrize () |
void | gauss_jordan () |
template<typename number2 > | |
void | invert (const FullMatrix< number2 > &M) |
template<typename number2 > | |
void | left_invert (const FullMatrix< number2 > &M) |
template<typename number2 > | |
void | right_invert (const FullMatrix< number2 > &M) |
template<int dim> | |
void | copy_from (Tensor< 2, dim > &T, const unsigned int src_r_i=0, const unsigned int src_r_j=dim-1, const unsigned int src_c_i=0, const unsigned int src_c_j=dim-1, const unsigned int dst_r=0, const unsigned int dst_c=0) |
template<int dim> | |
void | copy_to (Tensor< 2, dim > &T, const unsigned int src_r_i=0, const unsigned int src_r_j=dim-1, const unsigned int src_c_i=0, const unsigned int src_c_j=dim-1, const unsigned int dst_r=0, const unsigned int dst_c=0) |
Multiplications | |
template<typename number2 > | |
void | mmult (FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const |
template<typename number2 > | |
void | Tmmult (FullMatrix< number2 > &C, const FullMatrix< number2 > &B, const bool adding=false) const |
template<typename number2 > | |
void | vmult (Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const |
template<typename number2 > | |
void | vmult_add (Vector< number2 > &w, const Vector< number2 > &v) const |
template<typename number2 > | |
void | Tvmult (Vector< number2 > &w, const Vector< number2 > &v, const bool adding=false) const |
template<typename number2 > | |
void | Tvmult_add (Vector< number2 > &w, const Vector< number2 > &v) const |
template<typename somenumber > | |
void | precondition_Jacobi (Vector< somenumber > &dst, const Vector< somenumber > &src, const number omega=1.) const |
template<typename number2 , typename number3 > | |
number | residual (Vector< number2 > &dst, const Vector< number2 > &x, const Vector< number3 > &b) const |
template<typename number2 > | |
void | forward (Vector< number2 > &dst, const Vector< number2 > &src) const |
template<typename number2 > | |
void | backward (Vector< number2 > &dst, const Vector< number2 > &src) const |
Friends | |
class | Accessor |
Implementation of a classical rectangular scheme of numbers. The data type of the entries is provided in the template argument number
. The interface is quite fat and in fact has grown every time a new feature was needed. So, a lot of functions are provided.
Internal calculations are usually done with the accuracy of the vector argument to functions. If there is no argument with a number type, the matrix number type is used.
<float>, <double>, <long double>, <std::complex<float>>, <std::complex<double>>, <std::complex<long double>>
; others can be generated in application programs (see the section on Template instantiations in the manual).typedef number FullMatrix< number >::value_type |
Type of matrix entries. In analogy to the STL container classes.
typedef numbers::NumberTraits<number>::real_type FullMatrix< number >::real_type |
Declare a type that has holds real-valued numbers with the same precision as the template argument to this class. If the template argument of this class is a real data type, then real_type equals the template argument. If the template argument is a std::complex type then real_type equals the type underlying the complex numbers.
This typedef is used to represent the return type of norms.
FullMatrix< number >::FullMatrix | ( | const unsigned int | n = 0 |
) | [explicit] |
Constructor. Initialize the matrix as a square matrix with dimension n
.
In order to avoid the implicit conversion of integers and other types to a matrix, this constructor is declared explicit
.
By default, no memory is allocated.
FullMatrix< number >::FullMatrix | ( | const unsigned int | rows, | |
const unsigned int | cols | |||
) |
Constructor. Initialize the matrix as a rectangular matrix.
FullMatrix< number >::FullMatrix | ( | const FullMatrix< number > & | ) |
Copy constructor. This constructor does a deep copy of the matrix. Therefore, it poses a possible efficiency problem, if for example, function arguments are passed by value rather than by reference. Unfortunately, we can't mark this copy constructor explicit
, since that prevents the use of this class in containers, such as std::vector
. The responsibility to check performance of programs must therefore remain with the user of this class.
FullMatrix< number >::FullMatrix | ( | const unsigned int | rows, | |
const unsigned int | cols, | |||
const number * | entries | |||
) |
Constructor initializing from an array of numbers. The array is arranged line by line. No range checking is performed.
FullMatrix< number >::FullMatrix | ( | const IdentityMatrix & | id | ) | [explicit] |
Construct a full matrix that equals the identity matrix of the size of the argument. Using this constructor, one can easily create an identity matrix of size n
by saying
* FullMatrix<double> M(IdentityMatrix(n)); *
FullMatrix<number>& FullMatrix< number >::operator= | ( | const FullMatrix< number > & | ) |
Assignment operator.
Reimplemented from TableBase< N, number >.
FullMatrix<number>& FullMatrix< number >::operator= | ( | const FullMatrix< number2 > & | ) | [inline] |
Variable assignment operator.
Reimplemented from TableBase< N, number >.
FullMatrix<number>& FullMatrix< number >::operator= | ( | const number | d | ) |
This operator assigns a scalar to a matrix. To avoid confusion with the semantics of this function, zero is the only value allowed for d
, allowing you to clear a matrix in an intuitive way.
FullMatrix<number>& FullMatrix< number >::operator= | ( | const IdentityMatrix & | id | ) |
Copy operator to create a full matrix that equals the identity matrix of the size of the argument. This way, one can easily create an identity matrix of size n
by saying
* M = IdentityMatrix(n); *
FullMatrix<number>& FullMatrix< number >::operator= | ( | const LAPACKFullMatrix< number2 > & | ) | [inline] |
Assignment operator for a LapackFullMatrix. The calling matrix must be of the same size as the LAPACK matrix.
void FullMatrix< number >::copy_from | ( | const MATRIX & | ) | [inline] |
Assignment from different matrix classes. This assignment operator uses iterators of the class MATRIX. Therefore, sparse matrices are possible sources.
void FullMatrix< number >::fill | ( | const FullMatrix< number2 > & | src, | |
const unsigned int | dst_offset_i = 0 , |
|||
const unsigned int | dst_offset_j = 0 , |
|||
const unsigned int | src_offset_i = 0 , |
|||
const unsigned int | src_offset_j = 0 | |||
) | [inline] |
Fill rectangular block.
A rectangular block of the matrix src
is copied into this
. The upper left corner of the block being copied is (src_offset_i,src_offset_j)
. The upper left corner of the copied block is (dst_offset_i,dst_offset_j)
. The size of the rectangular block being copied is the maximum size possible, determined either by the size of this
or src
.
void FullMatrix< number >::fill | ( | const number2 * | ) | [inline] |
Make function of base class available.
void FullMatrix< number >::fill_permutation | ( | const FullMatrix< number2 > & | src, | |
const std::vector< unsigned int > & | p_rows, | |||
const std::vector< unsigned int > & | p_cols | |||
) | [inline] |
Fill with permutation of another matrix.
The matrix src
is copied into the target. The two permutation p_r
and p_c
operate in a way, such that result(i,j) = src(p_r[i], p_c[j])
.
The vectors may also be a selection from a larger set of integers, if the matrix src
is bigger. It is also possible to duplicate rows or columns by this method.
bool FullMatrix< number >::operator== | ( | const FullMatrix< number > & | ) | const |
Comparison operator. Be careful with this thing, it may eat up huge amounts of computing time! It is most commonly used for internal consistency checks of programs.
unsigned int FullMatrix< number >::m | ( | ) | const |
Number of rows of this matrix. To remember: this matrix is an m x n-matrix.
unsigned int FullMatrix< number >::n | ( | ) | const |
Number of columns of this matrix. To remember: this matrix is an m x n-matrix.
bool FullMatrix< number >::all_zero | ( | ) | const |
Return whether the matrix contains only elements with value zero. This function is mainly for internal consistency checks and should seldomly be used when not in debug mode since it uses quite some time.
number2 FullMatrix< number >::matrix_norm_square | ( | const Vector< number2 > & | v | ) | const [inline] |
Return the square of the norm of the vector v
induced by this matrix, i.e. (v,Mv). This is useful, e.g. in the finite element context, where the L2 norm of a function equals the matrix norm with respect to the mass matrix of the vector representing the nodal values of the finite element function.
Obviously, the matrix needs to be quadratic for this operation, and for the result to actually be a norm it also needs to be either real symmetric or complex hermitian.
The underlying template types of both this matrix and the given vector should either both be real or complex-valued, but not mixed, for this function to make sense.
number2 FullMatrix< number >::matrix_scalar_product | ( | const Vector< number2 > & | u, | |
const Vector< number2 > & | v | |||
) | const [inline] |
Build the matrix scalar product uT M v
. This function is mostly useful when building the cellwise scalar product of two functions in the finite element context.
The underlying template types of both this matrix and the given vector should either both be real or complex-valued, but not mixed, for this function to make sense.
real_type FullMatrix< number >::l1_norm | ( | ) | const |
Return the l1-norm of the matrix, where (maximum of the sums over columns).
real_type FullMatrix< number >::linfty_norm | ( | ) | const |
Return the -norm of the matrix, where
(maximum of the sums over rows).
real_type FullMatrix< number >::frobenius_norm | ( | ) | const |
Compute the Frobenius norm of the matrix. Return value is the root of the square sum of all matrix entries.
real_type FullMatrix< number >::relative_symmetry_norm2 | ( | ) | const |
Compute the relative norm of the skew-symmetric part. The return value is the Frobenius norm of the skew-symmetric part of the matrix divided by that of the matrix.
Main purpose of this function is to check, if a matrix is symmetric within a certain accuracy, or not.
number FullMatrix< number >::determinant | ( | ) | const |
Computes the determinant of a matrix. This is only implemented for one, two, and three dimensions, since for higher dimensions the numerical work explodes. Obviously, the matrix needs to be quadratic for this function.
number FullMatrix< number >::trace | ( | ) | const |
Return the trace of the matrix, i.e. the sum of the diagonal values (which happens to also equal the sum of the eigenvalues of a matrix). Obviously, the matrix needs to be quadratic for this function.
void FullMatrix< number >::print | ( | STREAM & | s, | |
const unsigned int | width = 5 , |
|||
const unsigned int | precision = 2 | |||
) | const [inline] |
Output of the matrix in user-defined format.
void FullMatrix< number >::print_formatted | ( | std::ostream & | out, | |
const unsigned int | precision = 3 , |
|||
const bool | scientific = true , |
|||
const unsigned int | width = 0 , |
|||
const char * | zero_string = " " , |
|||
const double | denominator = 1. , |
|||
const double | threshold = 0. | |||
) | const |
Print the matrix and allow formatting of entries.
The parameters allow for a flexible setting of the output format:
precision
denotes the number of trailing digits.scientific
is used to determine the number format, where scientific
= false
means fixed point notation.width
denotes the with of each column. A zero entry for width
makes the function compute a width, but it may be changed to a positive value, if output is crude.zero_string
specifies a string printed for zero entries.denominator
Multiply the whole matrix by this common denominator to get nicer numbers.threshold
: all entries with absolute value smaller than this are considered zero. unsigned int FullMatrix< number >::memory_consumption | ( | ) | const |
Determine an estimate for the memory consumption (in bytes) of this object.
Reimplemented from TableBase< N, number >.
const_iterator FullMatrix< number >::begin | ( | ) | const |
STL-like iterator with the first entry.
const_iterator FullMatrix< number >::end | ( | ) | const |
Final iterator.
const_iterator FullMatrix< number >::begin | ( | const unsigned int | r | ) | const |
STL-like iterator with the first entry of row r
.
const_iterator FullMatrix< number >::end | ( | const unsigned int | r | ) | const |
Final iterator of row r
.
FullMatrix& FullMatrix< number >::operator*= | ( | const number | factor | ) |
Scale the entire matrix by a fixed factor.
FullMatrix& FullMatrix< number >::operator/= | ( | const number | factor | ) |
Scale the entire matrix by the inverse of the given factor.
void FullMatrix< number >::add | ( | const number | a, | |
const FullMatrix< number2 > & | A | |||
) | [inline] |
Simple addition of a scaled matrix, i.e. *this += a*A
.
The matrix A
may be a full matrix over an arbitrary underlying scalar type, as long as its data type is convertible to the data type of this matrix.
void FullMatrix< number >::add | ( | const number | a, | |
const FullMatrix< number2 > & | A, | |||
const number | b, | |||
const FullMatrix< number2 > & | B | |||
) | [inline] |
Multiple addition of scaled matrices, i.e. *this += a*A + b*B
.
The matrices A
and B
may be a full matrix over an arbitrary underlying scalar type, as long as its data type is convertible to the data type of this matrix.
void FullMatrix< number >::add | ( | const number | a, | |
const FullMatrix< number2 > & | A, | |||
const number | b, | |||
const FullMatrix< number2 > & | B, | |||
const number | c, | |||
const FullMatrix< number2 > & | C | |||
) | [inline] |
Multiple addition of scaled matrices, i.e. *this += a*A + b*B + c*C
.
The matrices A
, B
and C
may be a full matrix over an arbitrary underlying scalar type, as long as its data type is convertible to the data type of this matrix.
void FullMatrix< number >::add | ( | const FullMatrix< number2 > & | src, | |
const number | factor, | |||
const unsigned int | dst_offset_i = 0 , |
|||
const unsigned int | dst_offset_j = 0 , |
|||
const unsigned int | src_offset_i = 0 , |
|||
const unsigned int | src_offset_j = 0 | |||
) | [inline] |
Add rectangular block.
A rectangular block of the matrix src
is added to this
. The upper left corner of the block being copied is (src_offset_i,src_offset_j)
. The upper left corner of the copied block is (dst_offset_i,dst_offset_j)
. The size of the rectangular block being copied is the maximum size possible, determined either by the size of this
or src
and the given offsets.
void FullMatrix< number >::Tadd | ( | const number | s, | |
const FullMatrix< number2 > & | B | |||
) | [inline] |
Weighted addition of the transpose of B
to this
.
A += s BT
void FullMatrix< number >::Tadd | ( | const FullMatrix< number2 > & | src, | |
const number | factor, | |||
const unsigned int | dst_offset_i = 0 , |
|||
const unsigned int | dst_offset_j = 0 , |
|||
const unsigned int | src_offset_i = 0 , |
|||
const unsigned int | src_offset_j = 0 | |||
) | [inline] |
Add transose of a rectangular block.
A rectangular block of the matrix src
is transposed and addedadded to this
. The upper left corner of the block being copied is (src_offset_i,src_offset_j)
in the coordinates of the non-transposed matrix. The upper left corner of the copied block is (dst_offset_i,dst_offset_j)
. The size of the rectangular block being copied is the maximum size possible, determined either by the size of this
or src
.
void FullMatrix< number >::add_row | ( | const unsigned int | i, | |
const number | s, | |||
const unsigned int | j | |||
) |
A(i,1...n) += s*A(j,1...n). Simple addition of rows of this
void FullMatrix< number >::add_row | ( | const unsigned int | i, | |
const number | s, | |||
const unsigned int | j, | |||
const number | t, | |||
const unsigned int | k | |||
) |
A(i,1...n) += s*A(j,1...n) + t*A(k,1...n). Multiple addition of rows of this.
void FullMatrix< number >::add_col | ( | const unsigned int | i, | |
const number | s, | |||
const unsigned int | j | |||
) |
A(1...n,i) += s*A(1...n,j). Simple addition of columns of this.
void FullMatrix< number >::add_col | ( | const unsigned int | i, | |
const number | s, | |||
const unsigned int | j, | |||
const number | t, | |||
const unsigned int | k | |||
) |
A(1...n,i) += s*A(1...n,j) + t*A(1...n,k). Multiple addition of columns of this.
void FullMatrix< number >::swap_row | ( | const unsigned int | i, | |
const unsigned int | j | |||
) |
Swap A(i,1...n) <-> A(j,1...n). Swap rows i and j of this
void FullMatrix< number >::swap_col | ( | const unsigned int | i, | |
const unsigned int | j | |||
) |
Swap A(1...n,i) <-> A(1...n,j). Swap columns i and j of this
void FullMatrix< number >::diagadd | ( | const number | s | ) |
Add constant to diagonal elements of this, i.e. add a multiple of the identity matrix.
void FullMatrix< number >::equ | ( | const number | a, | |
const FullMatrix< number2 > & | A | |||
) | [inline] |
Assignment *this = a*A
.
void FullMatrix< number >::equ | ( | const number | a, | |
const FullMatrix< number2 > & | A, | |||
const number | b, | |||
const FullMatrix< number2 > & | B | |||
) | [inline] |
Assignment *this = a*A + b*B
.
void FullMatrix< number >::equ | ( | const number | a, | |
const FullMatrix< number2 > & | A, | |||
const number | b, | |||
const FullMatrix< number2 > & | B, | |||
const number | c, | |||
const FullMatrix< number2 > & | C | |||
) | [inline] |
Assignment *this = a*A + b*B + c*C
.
void FullMatrix< number >::symmetrize | ( | ) |
Symmetrize the matrix by forming the mean value between the existing matrix and its transpose, A = 1/2(A+AT).
Obviously the matrix must be quadratic for this operation.
void FullMatrix< number >::gauss_jordan | ( | ) |
A=Inverse(A). A must be a square matrix. Inversion of this matrix by Gauss-Jordan algorithm with partial pivoting. This process is well-behaved for positive definite matrices, but be aware of round-off errors in the indefinite case.
In case deal.II was configured with LAPACK, the functions Xgetrf and Xgetri build an LU factorization and invert the matrix upon that factorization, providing best performance up to matrices with a few hundreds rows and columns.
The numerical effort to invert an n x n
matrix is of the order n**3
.
void FullMatrix< number >::invert | ( | const FullMatrix< number2 > & | M | ) | [inline] |
Assign the inverse of the given matrix to *this
. This function is hardcoded for quadratic matrices of dimension one to four. However, since the amount of code needed grows quickly, the method gauss_jordan() is invoked implicitly if the dimension is larger.
void FullMatrix< number >::left_invert | ( | const FullMatrix< number2 > & | M | ) | [inline] |
Assign the left_inverse of the given matrix to *this
. The calculation being performed is (AT*A)-1 *AT.
void FullMatrix< number >::right_invert | ( | const FullMatrix< number2 > & | M | ) | [inline] |
Assign the right_inverse of the given matrix to *this
. The calculation being performed is AT*(A*AT) -1.
void FullMatrix< number >::copy_from | ( | Tensor< 2, dim > & | T, | |
const unsigned int | src_r_i = 0 , |
|||
const unsigned int | src_r_j = dim-1 , |
|||
const unsigned int | src_c_i = 0 , |
|||
const unsigned int | src_c_j = dim-1 , |
|||
const unsigned int | dst_r = 0 , |
|||
const unsigned int | dst_c = 0 | |||
) | [inline] |
Fill matrix with elements extracted from a tensor, taking rows included between r_i
and r_j
and columns between c_i
and c_j
. The resulting matrix is then inserted in the destination matrix at position (dst_r, dst_c)
Checks on the indices are made.
void FullMatrix< number >::copy_to | ( | Tensor< 2, dim > & | T, | |
const unsigned int | src_r_i = 0 , |
|||
const unsigned int | src_r_j = dim-1 , |
|||
const unsigned int | src_c_i = 0 , |
|||
const unsigned int | src_c_j = dim-1 , |
|||
const unsigned int | dst_r = 0 , |
|||
const unsigned int | dst_c = 0 | |||
) | [inline] |
Insert a submatrix (also rectangular) into a tensor, putting its upper left element at the specified position (dst_r, dst_c)
and the other elements consequently. Default values are chosen so that no parameter needs to be specified if the size of the tensor and that of the matrix coincide.
void FullMatrix< number >::mmult | ( | FullMatrix< number2 > & | C, | |
const FullMatrix< number2 > & | B, | |||
const bool | adding = false | |||
) | const [inline] |
Matrix-matrix-multiplication.
The optional parameter adding
determines, whether the result is stored in C
or added to C
.
if (adding) C += A*B
if (!adding) C = A*B
Assumes that A
and B
have compatible sizes and that C
already has the right size.
void FullMatrix< number >::Tmmult | ( | FullMatrix< number2 > & | C, | |
const FullMatrix< number2 > & | B, | |||
const bool | adding = false | |||
) | const [inline] |
Matrix-matrix-multiplication using transpose of this
.
The optional parameter adding
determines, whether the result is stored in C
or added to C
.
if (adding) C += AT*B
if (!adding) C = AT*B
Assumes that A
and B
have compatible sizes and that C
already has the right size.
void FullMatrix< number >::vmult | ( | Vector< number2 > & | w, | |
const Vector< number2 > & | v, | |||
const bool | adding = false | |||
) | const [inline] |
Matrix-vector-multiplication.
The optional parameter adding
determines, whether the result is stored in w
or added to w
.
if (adding) w += A*v
if (!adding) w = A*v
Source and destination must not be the same vector.
void FullMatrix< number >::vmult_add | ( | Vector< number2 > & | w, | |
const Vector< number2 > & | v | |||
) | const [inline] |
Adding Matrix-vector-multiplication. w += A*v
Source and destination must not be the same vector.
void FullMatrix< number >::Tvmult | ( | Vector< number2 > & | w, | |
const Vector< number2 > & | v, | |||
const bool | adding = false | |||
) | const [inline] |
Transpose matrix-vector-multiplication.
The optional parameter adding
determines, whether the result is stored in w
or added to w
.
if (adding) w += AT*v
if (!adding) w = AT*v
Source and destination must not be the same vector.
void FullMatrix< number >::Tvmult_add | ( | Vector< number2 > & | w, | |
const Vector< number2 > & | v | |||
) | const [inline] |
Adding transpose matrix-vector-multiplication. w += AT*v
Source and destination must not be the same vector.
void FullMatrix< number >::precondition_Jacobi | ( | Vector< somenumber > & | dst, | |
const Vector< somenumber > & | src, | |||
const number | omega = 1. | |||
) | const [inline] |
Apply the Jacobi preconditioner, which multiplies every element of the src
vector by the inverse of the respective diagonal element and multiplies the result with the damping factor omega
.
number FullMatrix< number >::residual | ( | Vector< number2 > & | dst, | |
const Vector< number2 > & | x, | |||
const Vector< number3 > & | b | |||
) | const [inline] |
dst=b-A*x. Residual calculation, returns the l2-norm |dst|.
Source x and destination dst must not be the same vector.
void FullMatrix< number >::forward | ( | Vector< number2 > & | dst, | |
const Vector< number2 > & | src | |||
) | const [inline] |
Forward elimination of lower triangle. Inverts the lower triangle of a rectangular matrix for a given right hand side.
If the matrix has more columns than rows, this function only operates on the left quadratic submatrix. If there are more rows, the upper quadratic part of the matrix is considered.
dst
and src
. void FullMatrix< number >::backward | ( | Vector< number2 > & | dst, | |
const Vector< number2 > & | src | |||
) | const [inline] |
Backward elimination of upper triangle.
See forward()
dst
and src
. friend class Accessor [friend] |