MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / get

Method get

inst/include/Rcpp/sugar/functions/which_min.h:35–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 WhichMin(const VEC_TYPE& obj_ ) : obj(obj_){}
34
35 R_xlen_t get() const {
36 STORAGE current = obj[0] ;
37 STORAGE min = current ;
38 R_xlen_t index = 0 ;
39 if( Rcpp::traits::is_na<RTYPE>(current) ) return NA_INTEGER ;
40 R_xlen_t n = obj.size() ;
41 for( R_xlen_t i=1; i<n; i++){
42 current = obj[i] ;
43 if( Rcpp::traits::is_na<RTYPE>(current) ) return NA_INTEGER ;
44 if( current < min ){
45 min = current ;
46 index = i ;
47 }
48 }
49 return index ;
50 }
51
52private:
53 const VEC_TYPE& obj ;

Callers 1

which_minFunction · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected