IT++ Logo Newcom Logo

Diagonal Matrices and Functions of Diagonals


Functions

template<class T>
Mat< T > itpp::diag (const Vec< T > &v, const int K=0)
 Returns a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.
template<class T>
void itpp::diag (const Vec< T > &v, Mat< T > &m)
 Returns in the output wariable m a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.
template<class T>
Vec< T > itpp::diag (const Mat< T > &m)
 Returns 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>
itpp::trace (const Mat< T > &m)
 The trace of the matrix m, i.e. the sum of the diagonal elements.

Detailed Description


Function Documentation

template<class T>
Mat<T> itpp::diag ( const Vec< T > &  v,
const int  K = 0 
) [inline]

Returns a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.

The size of the return matrix will be $n \times n$, where $n$ is the length of the input vector v.

Definition at line 444 of file matfunc.h.

References itpp::abs(), and itpp::Vec< Num_T >::size().

template<class T>
void itpp::diag ( const Vec< T > &  v,
Mat< T > &  m 
) [inline]

Returns in the output wariable m a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.

The size of the output matrix m will be $n \times n$, where $n$ is the length of the input vector v.

Definition at line 465 of file matfunc.h.

References itpp::Mat< Num_T >::set_size(), and itpp::Vec< Num_T >::size().

template<class T>
Vec<T> itpp::diag ( const Mat< T > &  m  )  [inline]

Returns the diagonal elements of the input matrix m.

The input matrix m must be a square $n \times n$ matrix. The size of the output vector will be $n$.

Definition at line 479 of file matfunc.h.

References itpp::Mat< Num_T >::cols(), min, itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::size().

template<class T>
Mat<T> itpp::bidiag ( const Vec< T > &  main,
const Vec< T > &  sup 
) [inline]

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 $n$, then the number of elements in the input vector sup must be $n-1$. The size of the return matrix will be $n \times n$.

Definition at line 498 of file matfunc.h.

References it_assert, and itpp::Vec< Num_T >::size().

template<class T>
void itpp::bidiag ( const Vec< T > &  main,
const Vec< T > &  sup,
Mat< T > &  m 
) [inline]

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 $n$, then the number of elements in the input vector sup must be $n-1$. The size of the output matrix m will be $n \times n$.

Definition at line 522 of file matfunc.h.

References it_assert, itpp::Mat< Num_T >::set_size(), and itpp::Vec< Num_T >::size().

template<class T>
void itpp::bidiag ( const Mat< T > &  m,
Vec< T > &  main,
Vec< T > &  sup 
) [inline]

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 $n \times n$ matrix. The length of the output vector main will be $n$ and the length of the output vector sup will be $n-1$.

Definition at line 543 of file matfunc.h.

References itpp::Mat< Num_T >::cols(), it_assert, itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

template<class T>
Mat<T> itpp::tridiag ( const Vec< T > &  main,
const Vec< T > &  sup,
const Vec< T > &  sub 
) [inline]

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 $n$ then the lengths of the vectors sup and sub must equal $n-1$. The size of the return matrix will be $n \times n$.

Definition at line 565 of file matfunc.h.

References it_assert, and itpp::Vec< Num_T >::size().

template<class T>
void itpp::tridiag ( const Vec< T > &  main,
const Vec< T > &  sup,
const Vec< T > &  sub,
Mat< T > &  m 
) [inline]

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 $n$ then the lengths of the vectors sup and sub must equal $n-1$. The size of the output matrix m will be $n \times n$.

Definition at line 590 of file matfunc.h.

References it_assert, itpp::Mat< Num_T >::set_size(), and itpp::Vec< Num_T >::size().

template<class T>
void itpp::tridiag ( const Mat< T > &  m,
Vec< T > &  main,
Vec< T > &  sup,
Vec< T > &  sub 
) [inline]

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 $n \times n$ matrix. The length of the output vector main will be $n$ and the length of the output vectors sup and sup will be $n-1$.

Definition at line 612 of file matfunc.h.

References itpp::Mat< Num_T >::cols(), it_assert, itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

template<class T>
T itpp::trace ( const Mat< T > &  m  )  [inline]

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

Definition at line 634 of file matfunc.h.

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

SourceForge Logo

Generated on Wed Apr 18 11:20:01 2007 for IT++ by Doxygen 1.5.2