Public Types | Public Member Functions | Public Attributes

diagmat_proxy< T1 > Class Template Reference
[Diagmat_proxy]

#include <diagmat_proxy.hpp>

List of all members.

Public Types

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

Public Member Functions

 diagmat_proxy (const Base< typename T1::elem_type, T1 > &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 Proxy< T1 > P
const bool P_is_vec
const u32 n_elem

Detailed Description

template<typename T1>
class diagmat_proxy< T1 >

Definition at line 23 of file diagmat_proxy.hpp.


Member Typedef Documentation

template<typename T1>
typedef T1::elem_type diagmat_proxy< T1 >::elem_type

Definition at line 27 of file diagmat_proxy.hpp.

template<typename T1>
typedef get_pod_type<elem_type>::result diagmat_proxy< T1 >::pod_type

Definition at line 28 of file diagmat_proxy.hpp.


Constructor & Destructor Documentation

template<typename T1>
diagmat_proxy< T1 >::diagmat_proxy ( const Base< typename T1::elem_type, T1 > &  X  )  [inline]

Definition at line 30 of file diagmat_proxy.hpp.

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

    : P       (X.get_ref())
    , 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 T1>
arma_inline elem_type diagmat_proxy< T1 >::operator[] ( const u32  i  )  const [inline]

Definition at line 41 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 T1>
arma_inline elem_type diagmat_proxy< T1 >::at ( const u32  row,
const u32  col 
) const [inline]

Definition at line 42 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 T1>
const Proxy<T1> diagmat_proxy< T1 >::P
template<typename T1>
const bool diagmat_proxy< T1 >::P_is_vec
template<typename T1>
const u32 diagmat_proxy< T1 >::n_elem

Definition at line 47 of file diagmat_proxy.hpp.

Referenced by det(), log_det(), operator*(), and trace().