fn_eps.hpp
Go to the documentation of this file.
1 // Copyright (C) 2009-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2009-2010 Conrad Sanderson
3 // Copyright (C) 2009-2010 Dimitrios Bouzas
4 //
5 // This file is part of the Armadillo C++ library.
6 // It is provided without any warranty of fitness
7 // for any purpose. You can redistribute this file
8 // and/or modify it under the terms of the GNU
9 // Lesser General Public License (LGPL) as published
10 // by the Free Software Foundation, either version 3
11 // of the License or (at your option) any later version.
12 // (see http://www.opensource.org/licenses for more info)
13 
14 
15 
18 
19 
20 
23 template<typename T1>
24 inline
25 const eOp<T1, eop_eps>
27  {
29 
31 
32  typedef typename T1::elem_type eT;
33 
34  return eOp<T1, eop_eps>(X.get_ref());
35  }
36 
37 
38 
41 template<typename T1>
42 inline
44 eps(const Base< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
45  {
47 
49 
50  typedef typename T1::pod_type T;
51  typedef typename T1::elem_type eT;
52 
53  const unwrap<T1> tmp(X.get_ref());
54  const Mat<eT>& A = tmp.M;
55 
56  Mat<T> out(A.n_rows, A.n_cols);
57 
58  T* out_mem = out.memptr();
59  const eT* A_mem = A.memptr();
60  const uword n_elem = A.n_elem;
61 
62  for(uword i=0; i<n_elem; ++i)
63  {
64  out_mem[i] = eop_aux::direct_eps( A_mem[i] );
65  }
66 
67 
68  return out;
69  }
70 
71 
72 
73 template<typename eT>
77 eps(const eT& x)
78  {
79  arma_ignore(x);
80 
81  return eT(0);
82  }
83 
84 
85 
86 template<typename eT>
90 eps(const eT& x)
91  {
92  return eop_aux::direct_eps(x);
93  }
94 
95 
96 
97 template<typename T>
101 eps(const std::complex<T>& x)
102  {
103  return eop_aux::direct_eps(x);
104  }
105 
106 
107 
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
Definition: Mat_meat.hpp:4024
arma_inline const derived & get_ref() const
Definition: Base_meat.hpp:22
const eOp< T1, eop_eps > eps(const Base< typename T1::elem_type, T1 > &X, const typename arma_not_cx< typename T1::elem_type >::result *junk=0)
eps version for non-complex matrices and vectors
Definition: fn_eps.hpp:26
u32 uword
Definition: typedef.hpp:85
#define arma_ignore(variable)
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
#define arma_warn_unused
Dense matrix class.
#define arma_inline
static arma_inline arma_integral_only< eT >::result direct_eps(const eT)
Definition: eop_aux.hpp:269


armadillo_matrix
Author(s):
autogenerated on Fri Apr 16 2021 02:31:57