|
Rcpp Version 0.9.10
|
00001 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*- 00002 // 00003 // SugarBlock.h: Rcpp R/C++ interface class library -- sugar functions 00004 // 00005 // Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois 00006 // 00007 // This file is part of Rcpp. 00008 // 00009 // Rcpp is free software: you can redistribute it and/or modify it 00010 // under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation, either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // Rcpp is distributed in the hope that it will be useful, but 00015 // WITHOUT ANY WARRANTY; without even the implied warranty of 00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 // GNU General Public License for more details. 00018 // 00019 // You should have received a copy of the GNU General Public License 00020 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 00021 00022 #ifndef RCPP_SUGAR_MATH_H 00023 #define RCPP_SUGAR_MATH_H 00024 00025 VECTORIZED_MATH_1(exp,::exp) 00026 VECTORIZED_MATH_1(acos,::acos) 00027 VECTORIZED_MATH_1(asin,::asin) 00028 VECTORIZED_MATH_1(atan,::atan) 00029 VECTORIZED_MATH_1(ceil,::ceil) 00030 VECTORIZED_MATH_1(ceiling,::ceil) 00031 VECTORIZED_MATH_1(cos,::cos) 00032 VECTORIZED_MATH_1(cosh,::cosh) 00033 VECTORIZED_MATH_1(floor,::floor) 00034 VECTORIZED_MATH_1(log,::log) 00035 VECTORIZED_MATH_1(log10,::log10) 00036 VECTORIZED_MATH_1(sqrt,::sqrt) 00037 VECTORIZED_MATH_1(sin,::sin) 00038 VECTORIZED_MATH_1(sinh,::sinh) 00039 VECTORIZED_MATH_1(tan,::tan) 00040 VECTORIZED_MATH_1(tanh,::tanh) 00041 00042 VECTORIZED_MATH_1(abs,::fabs) 00043 00044 VECTORIZED_MATH_1(gamma , ::Rf_gammafn ) 00045 VECTORIZED_MATH_1(lgamma , ::Rf_lgammafn ) 00046 VECTORIZED_MATH_1(digamma , ::Rf_digamma ) 00047 VECTORIZED_MATH_1(trigamma , ::Rf_trigamma ) 00048 VECTORIZED_MATH_1(tetragamma , ::Rf_tetragamma ) 00049 VECTORIZED_MATH_1(pentagamma , ::Rf_pentagamma ) 00050 VECTORIZED_MATH_1(expm1 , ::expm1 ) 00051 VECTORIZED_MATH_1(log1p , ::log1p ) 00052 00053 namespace Rcpp{ 00054 namespace internal{ 00055 00056 extern "C" inline double factorial( double x ){ 00057 return ::Rf_gammafn( x + 1.0 ) ; 00058 } 00059 extern "C" inline double lfactorial( double x ){ 00060 return ::Rf_lgammafn( x + 1.0 ) ; 00061 } 00062 00063 } 00064 } 00065 VECTORIZED_MATH_1(factorial , ::Rcpp::internal::factorial ) 00066 VECTORIZED_MATH_1(lfactorial , ::Rcpp::internal::lfactorial ) 00067 00068 00069 SUGAR_BLOCK_2(choose , ::Rf_choose ) 00070 SUGAR_BLOCK_2(lchoose , ::Rf_lchoose ) 00071 SUGAR_BLOCK_2(beta , ::Rf_beta ) 00072 SUGAR_BLOCK_2(lbeta , ::Rf_lbeta ) 00073 SUGAR_BLOCK_2(psigamma , ::Rf_psigamma ) 00074 00075 #endif