[Rcpp-commits] r4014 - pkg/Rcpp/inst/include/Rcpp/sugar/functions

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 22 01:29:22 CET 2012


Author: romain
Date: 2012-11-22 01:29:21 +0100 (Thu, 22 Nov 2012)
New Revision: 4014

Modified:
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h
Log:
s/clip/clamp/

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h	2012-11-22 00:28:37 UTC (rev 4013)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/clamp.h	2012-11-22 00:29:21 UTC (rev 4014)
@@ -1,6 +1,6 @@
 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
 //
-// clip.h: Rcpp R/C++ interface class library -- clip
+// clamp.h: Rcpp R/C++ interface class library -- clamp
 //
 // Copyright (C) 2012 Dirk Eddelbuettel and Romain Francois
 //
@@ -19,17 +19,17 @@
 // You should have received a copy of the GNU General Public License
 // along with Rcpp.  If not, see <http://www.gnu.org/licenses/>.
 
-#ifndef Rcpp__sugar__clip_h
-#define Rcpp__sugar__clip_h
+#ifndef Rcpp__sugar__clamp_h
+#define Rcpp__sugar__clamp_h
 
 namespace Rcpp{
 namespace sugar{
 
 template <int RTYPE, bool NA>
-struct clip_operator{
+struct clamp_operator{
     typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
 	
-    clip_operator(STORAGE lhs_, STORAGE rhs_ ) : lhs(lhs_), rhs(rhs_){}
+    clamp_operator(STORAGE lhs_, STORAGE rhs_ ) : lhs(lhs_), rhs(rhs_){}
     
     inline STORAGE operator()(STORAGE x) const {
         return lhs < x ? lhs : (x < rhs ? x : rhs ) ;
@@ -38,8 +38,8 @@
 } ;
 // need to write this qpecial version
 template <>
-struct clip_operator<REALSXP,true> {
-    clip_operator(double lhs_, double rhs_ ) : lhs(lhs_), rhs(rhs_){}
+struct clamp_operator<REALSXP,true> {
+    clamp_operator(double lhs_, double rhs_ ) : lhs(lhs_), rhs(rhs_){}
     
     inline double operator()(double x) const {
         if( Rcpp::traits::is_na<REALSXP>(x) ) ;
@@ -54,16 +54,16 @@
 	int RTYPE, 
 	bool NA, typename T
 	>
-class Clip_Primitive_Vector_Primitive : public VectorBase< 
+class Clamp_Primitive_Vector_Primitive : public VectorBase< 
 	RTYPE , 
 	NA ,
-	Clip_Primitive_Vector_Primitive<RTYPE,NA,T>
+	Clamp_Primitive_Vector_Primitive<RTYPE,NA,T>
 > {
 public:
 	typedef typename Rcpp::traits::storage_type<RTYPE>::type STORAGE ;
-	typedef clip_operator<RTYPE,NA> OPERATOR ;
+	typedef clamp_operator<RTYPE,NA> OPERATOR ;
 	
-	Clip_Primitive_Vector_Primitive( STORAGE lhs_, const T& vec_, STORAGE rhs_) : vec(vec_), op(lhs_,rhs_) {}
+	Clamp_Primitive_Vector_Primitive( STORAGE lhs_, const T& vec_, STORAGE rhs_) : vec(vec_), op(lhs_,rhs_) {}
 	
 	inline STORAGE operator[]( int i ) const {
 		return op( vec[i] ) ;
@@ -80,13 +80,13 @@
 } // sugar
 
 template <int RTYPE, bool NA, typename T>
-inline sugar::Clip_Primitive_Vector_Primitive<RTYPE,NA,T> 
-clip( 
+inline sugar::Clamp_Primitive_Vector_Primitive<RTYPE,NA,T> 
+clamp( 
 	typename Rcpp::traits::storage_type<RTYPE>::type lhs,
 	const Rcpp::VectorBase<RTYPE,NA,T>& vec,  
 	typename Rcpp::traits::storage_type<RTYPE>::type rhs
 	){
-	return sugar::Clip_Primitive_Vector_Primitive<RTYPE,NA,T>( lhs, vec.get_ref(), rhs ) ;
+	return sugar::Clamp_Primitive_Vector_Primitive<RTYPE,NA,T>( lhs, vec.get_ref(), rhs ) ;
 }
 
 



More information about the Rcpp-commits mailing list