Diagonal Matrices and Functions
Base Module

## Functions

template<class T >
Mat< T > | itpp::diag (const Vec< T > &v, const int K=0)
| Create a diagonal matrix using vector `v` as its diagonal.
template<class T >
void | itpp::diag (const Vec< T > &v, Mat< T > &m)
| Create a diagonal matrix using vector `v` as its diagonal.
template<class T >
Vec< T > | itpp::diag (const Mat< T > &m)
| Get the diagonal elements of the input matrix `m`.
template<class T >
Mat< T > | itpp::bidiag (const Vec< T > &main, const Vec< T > &sup)
| Returns a matrix with the elements of the input vector `main` on the diagonal and the elements of the input vector `sup` on the diagonal row above.
template<class T >
void | itpp::bidiag (const Vec< T > &main, const Vec< T > &sup, Mat< T > &m)
| Returns in the output variable `m` a matrix with the elements of the input vector `main` on the diagonal and the elements of the input vector `sup` on the diagonal row above.
template<class T >
void | itpp::bidiag (const Mat< T > &m, Vec< T > &main, Vec< T > &sup)
| Returns the main diagonal and the diagonal row above in the two output vectors `main` and `sup`.
template<class T >
Mat< T > | itpp::tridiag (const Vec< T > &main, const Vec< T > &sup, const Vec< T > &sub)
| Returns a matrix with the elements of `main` on the diagonal, the elements of `sup` on the diagonal row above, and the elements of `sub` on the diagonal row below.
template<class T >
void | itpp::tridiag (const Vec< T > &main, const Vec< T > &sup, const Vec< T > &sub, Mat< T > &m)
| Returns in the output matrix `m` a matrix with the elements of `main` on the diagonal, the elements of `sup` on the diagonal row above, and the elements of `sub` on the diagonal row below.
template<class T >
void | itpp::tridiag (const Mat< T > &m, Vec< T > &main, Vec< T > &sup, Vec< T > &sub)
| Returns the main diagonal, the diagonal row above, and the diagonal row below int the output vectors `main`, `sup`, and `sub`.
template<class T >
T | itpp::trace (const Mat< T > &m)
| The trace of the matrix `m`, i.e. the sum of the diagonal elements.

## Detailed Description

## Function Documentation

## diag() [1/3]

template<class T >

Mat< T > itpp::diag | ( | const Vec< T > & | v,
|  | const int | K = `0`
| ) |  |

Create a diagonal matrix using vector `v` as its diagonal.

All other matrix elements except the ones on its diagonal are set to zero. An optional parameter `K` can be used to shift the diagonal in the resulting matrix. By default `K` is equal to zero.

The size of the diagonal matrix will be , where is the length of the input vector `v`.

Definition at line 557 of file matfunc.h.

References itpp::Array< T >::size().

Referenced by itpp::MOG_generic::convert_to_diag_internal(), itpp::MOG_generic::convert_to_full_internal(), fpica(), itpp::Multilateration::get_crlb(), mpower(), itpp::roots(), itpp::roots(), itpp::Fast_ICA::separate(), and itpp::trace().

## diag() [2/3]

template<class T >

void itpp::diag | ( | const Vec< T > & | v,
|  | Mat< T > & | m
| ) |  |

Create a diagonal matrix using vector `v` as its diagonal.

All other matrix elements except the ones on its diagonal are set to zero.

The size of the diagonal matrix will be , where is the length of the input vector `v`.

Definition at line 581 of file matfunc.h.

References itpp::Array< T >::set_size(), and itpp::Array< T >::size().

## diag() [3/3]

template<class T >

Vec< T > itpp::diag | ( | const Mat< T > & | m | ) |

Get the diagonal elements of the input matrix `m`.

The size of the output vector with diagonal elements will be , where are the dimensions of matrix `m`.

Definition at line 597 of file matfunc.h.

References itpp::Array< T >::size().

## bidiag() [1/3]

template<class T >

Mat< T > itpp::bidiag | ( | const Vec< T > & | main,
|  | const Vec< T > & | sup
| ) |  |

Returns a matrix with the elements of the input vector `main` on the diagonal and the elements of the input vector `sup` on the diagonal row above.

If the number of elements in the vector `main` is , then the number of elements in the input vector `sup` must be . The size of the return matrix will be .

Definition at line 617 of file matfunc.h.

References it_assert, and itpp::Array< T >::size().

## bidiag() [2/3]

template<class T >

void itpp::bidiag | ( | const Vec< T > & | main,
|  | const Vec< T > & | sup,
|  | Mat< T > & | m
| ) |  |

Returns in the output variable `m` a matrix with the elements of the input vector `main` on the diagonal and the elements of the input vector `sup` on the diagonal row above.

If the number of elements in the vector `main` is , then the number of elements in the input vector `sup` must be . The size of the output matrix `m` will be .

Definition at line 643 of file matfunc.h.

References it_assert, itpp::Array< T >::set_size(), and itpp::Array< T >::size().

## bidiag() [3/3]

template<class T >

void itpp::bidiag | ( | const Mat< T > & | m,
|  | Vec< T > & | main,
|  | Vec< T > & | sup
| ) |  |

Returns the main diagonal and the diagonal row above in the two output vectors `main` and `sup`.

The input matrix `in` must be a square matrix. The length of the output vector `main` will be and the length of the output vector `sup` will be .

Definition at line 666 of file matfunc.h.

References it_assert, and itpp::Array< T >::set_size().

## tridiag() [1/3]

template<class T >

Mat< T > itpp::tridiag | ( | const Vec< T > & | main,
|  | const Vec< T > & | sup,
|  | const Vec< T > & | sub
| ) |  |

Returns a matrix with the elements of `main` on the diagonal, the elements of `sup` on the diagonal row above, and the elements of `sub` on the diagonal row below.

If the length of the input vector `main` is then the lengths of the vectors `sup` and `sub` must equal . The size of the return matrix will be .

Definition at line 690 of file matfunc.h.

References it_assert, and itpp::Array< T >::size().

## tridiag() [2/3]

template<class T >

void itpp::tridiag | ( | const Vec< T > & | main,
|  | const Vec< T > & | sup,
|  | const Vec< T > & | sub,
|  | Mat< T > & | m
| ) |  |

Returns in the output matrix `m` a matrix with the elements of `main` on the diagonal, the elements of `sup` on the diagonal row above, and the elements of `sub` on the diagonal row below.

If the length of the input vector `main` is then the lengths of the vectors `sup` and `sub` must equal . The size of the output matrix `m` will be .

Definition at line 717 of file matfunc.h.

References it_assert, itpp::Array< T >::set_size(), and itpp::Array< T >::size().

## tridiag() [3/3]

template<class T >

void itpp::tridiag | ( | const Mat< T > & | m,
|  | Vec< T > & | main,
|  | Vec< T > & | sup,
|  | Vec< T > & | sub
| ) |  |

Returns the main diagonal, the diagonal row above, and the diagonal row below int the output vectors `main`, `sup`, and `sub`.

The input matrix `m` must be a square matrix. The length of the output vector `main` will be and the length of the output vectors `sup` and `sup` will be .

Definition at line 741 of file matfunc.h.

References it_assert, and itpp::Array< T >::set_size().

## trace()

template<class T >

T itpp::trace | ( | const Mat< T > & | m | ) |

The trace of the matrix `m`, i.e. the sum of the diagonal elements.

Definition at line 762 of file matfunc.h.

References itpp::diag(), and itpp::sum().

Referenced by itpp::Newton_Search::disable_trace(), itpp::Line_Search::disable_trace(), itpp::Newton_Search::enable_trace(), and itpp::Line_Search::enable_trace().

Generated on Mon Jun 10 2024 11:49:29 for IT++ by Doxygen 1.9.8