Public Types | Public Member Functions | Public Attributes

diagmat_proxy< Mat< eT > > Class Template Reference
[Diagmat_proxy]

#include <diagmat_proxy.hpp>

List of all members.

Public Types

typedef eT elem_type
typedef get_pod_type
< elem_type >::result 
pod_type

Public Member Functions

 diagmat_proxy (const Mat< eT > &X)
arma_inline elem_type operator[] (const u32 i) const
arma_inline elem_type at (const u32 row, const u32 col) const

Public Attributes

const Mat< eT > & P
const bool P_is_vec
const u32 n_elem

Detailed Description

template<typename eT>
class diagmat_proxy< Mat< eT > >

Definition at line 53 of file diagmat_proxy.hpp.


Member Typedef Documentation

template<typename eT >
typedef eT diagmat_proxy< Mat< eT > >::elem_type

Definition at line 57 of file diagmat_proxy.hpp.

template<typename eT >
typedef get_pod_type<elem_type>::result diagmat_proxy< Mat< eT > >::pod_type

Definition at line 58 of file diagmat_proxy.hpp.


Constructor & Destructor Documentation

template<typename eT >
diagmat_proxy< Mat< eT > >::diagmat_proxy ( const Mat< eT > &  X  )  [inline]

Definition at line 61 of file diagmat_proxy.hpp.

References diagmat_proxy< T1 >::P, and diagmat_proxy< T1 >::P_is_vec.

    : P(X)
    , P_is_vec( (P.n_rows == 1) || (P.n_cols == 1) )
    , n_elem( P_is_vec ? P.n_elem : P.n_rows )
    {
    arma_extra_debug_sigprint();
    arma_debug_check( (P_is_vec == false) && (P.n_rows != P.n_cols), "diagmat(): only vectors and square matrices are accepted" );
    }


Member Function Documentation

template<typename eT >
arma_inline elem_type diagmat_proxy< Mat< eT > >::operator[] ( const u32  i  )  const [inline]

Definition at line 71 of file diagmat_proxy.hpp.

References diagmat_proxy< T1 >::P, and diagmat_proxy< T1 >::P_is_vec.

{ return P_is_vec ? P[i] : P.at(i,i);                                         }

template<typename eT >
arma_inline elem_type diagmat_proxy< Mat< eT > >::at ( const u32  row,
const u32  col 
) const [inline]

Definition at line 72 of file diagmat_proxy.hpp.

References diagmat_proxy< T1 >::P, and diagmat_proxy< T1 >::P_is_vec.

{ return (row == col) ? ( P_is_vec ? P[row] : P.at(row,row) ) : elem_type(0); }


Member Data Documentation

template<typename eT >
const Mat<eT>& diagmat_proxy< Mat< eT > >::P

Definition at line 74 of file diagmat_proxy.hpp.

template<typename eT >
const bool diagmat_proxy< Mat< eT > >::P_is_vec

Definition at line 75 of file diagmat_proxy.hpp.

template<typename eT >
const u32 diagmat_proxy< Mat< eT > >::n_elem

Definition at line 76 of file diagmat_proxy.hpp.