Functions

Fn_det

//! More...

Functions

template<typename T1 >
arma_warn_unused T1::elem_type det (const Base< typename T1::elem_type, T1 > &X, const typename arma_blas_type_only< typename T1::elem_type >::result *junk=0)
 determinant of mat
template<typename T1 >
arma_warn_unused T1::elem_type det (const Op< T1, op_diagmat > &X)
 determinant of diagmat
template<typename T1 >
arma_warn_unused T1::elem_type det (const Op< T1, op_inv > &in, const typename arma_blas_type_only< typename T1::elem_type >::result *junk=0)
 determinant of inv(A), without doing the inverse operation
template<typename T1 >
arma_warn_unused T1::elem_type det (const Op< T1, op_trans > &in, const typename arma_blas_type_only< typename T1::elem_type >::result *junk=0)
 determinant of trans(A)

Detailed Description

//!


Function Documentation

template<typename T1 >
arma_warn_unused T1::elem_type det ( const Base< typename T1::elem_type, T1 > &  X,
const typename arma_blas_type_only< typename T1::elem_type >::result *  junk = 0 
) [inline]

determinant of mat

Definition at line 27 of file fn_det.hpp.

References auxlib::det(), and Base< elem_type, derived >::get_ref().

Referenced by det().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const unwrap<T1>   tmp(X.get_ref());
  const Mat<eT>& A = tmp.M;
  
  arma_debug_check( !A.is_square(), "det(): matrix must be square" );
  
  return auxlib::det(A);
  }

template<typename T1 >
arma_warn_unused T1::elem_type det ( const Op< T1, op_diagmat > &  X  )  [inline]

determinant of diagmat

Definition at line 48 of file fn_det.hpp.

References Op< T1, op_type >::m, and diagmat_proxy< T1 >::n_elem.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const diagmat_proxy<T1> A(X.m);
  
  arma_debug_check( (A.n_elem == 0), "det(): given object has no elements" );
  
  eT val = A[0];
  
  for(u32 i=1; i<A.n_elem; ++i)
    {
    val *= A[i];
    }
  
  return val;
  }

template<typename T1 >
arma_warn_unused T1::elem_type det ( const Op< T1, op_inv > &  in,
const typename arma_blas_type_only< typename T1::elem_type >::result *  junk = 0 
) [inline]

determinant of inv(A), without doing the inverse operation

Definition at line 75 of file fn_det.hpp.

References arma_warn(), isnt_fltpt< T1 >::check(), det(), and Op< T1, op_type >::m.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  isnt_fltpt<eT>::check();
  
  eT tmp = det(in.m);
  arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" );
  
  return eT(1) / tmp;
  }

template<typename T1 >
arma_warn_unused T1::elem_type det ( const Op< T1, op_trans > &  in,
const typename arma_blas_type_only< typename T1::elem_type >::result *  junk = 0 
) [inline]

determinant of trans(A)

Definition at line 95 of file fn_det.hpp.

References det(), unwrap< T1 >::M, and Op< T1, op_type >::m.

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const unwrap<T1>   tmp(in.m);
  const Mat<eT>& X = tmp.M;

  return det(X);
  }