[Genabel-commits] r1955 - in pkg/MixABEL: . src/MXlib
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 1 13:55:09 CEST 2015
Author: lckarssen
Date: 2015-05-01 13:55:08 +0200 (Fri, 01 May 2015)
New Revision: 1955
Modified:
pkg/MixABEL/DESCRIPTION
pkg/MixABEL/NAMESPACE
pkg/MixABEL/src/MXlib/exception.cpp
pkg/MixABEL/src/MXlib/exception.h
pkg/MixABEL/src/MXlib/fgls.cpp
pkg/MixABEL/src/MXlib/fgls.h
pkg/MixABEL/src/MXlib/moorepenrose.cpp
pkg/MixABEL/src/MXlib/moorepenrose.h
pkg/MixABEL/src/MXlib/twovarcomp.cpp
pkg/MixABEL/src/MXlib/twovarcomp.h
Log:
This commit removes calls to std::cout and std::cerr and replaces them with calls to Rcpp::Rcout and Rcpp::Rcerr, respectively. This removes an R CMD check warning.
This adds Rcpp to the list of dependencies. Note also that the NAMESPACE file now includes a manually inserted importFrom line. This still needs to be fixed so that devtools::document().
Modified: pkg/MixABEL/DESCRIPTION
===================================================================
--- pkg/MixABEL/DESCRIPTION 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/DESCRIPTION 2015-05-01 11:55:08 UTC (rev 1955)
@@ -7,6 +7,8 @@
Maintainer: Yurii Aulchenko <yurii.aulchenko at gmail.com>
Depends: R (>= 2.4.0), MASS, mvtnorm, GenABEL (>= 1.5-8), DatABEL (>= 0.1-5)
Suggests:
+Imprts: Rcpp (>= 0.11.0)
+LinkingTo: Rcpp
Description: Provides methods for fast mixed models for association
analysis in samples of related individuals.
License: GPL (>= 2)
Modified: pkg/MixABEL/NAMESPACE
===================================================================
--- pkg/MixABEL/NAMESPACE 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/NAMESPACE 2015-05-01 11:55:08 UTC (rev 1955)
@@ -9,3 +9,4 @@
import(MASS)
import(mvtnorm)
useDynLib(MixABEL)
+importFrom(Rcpp, evalCpp)
Modified: pkg/MixABEL/src/MXlib/exception.cpp
===================================================================
--- pkg/MixABEL/src/MXlib/exception.cpp 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/exception.cpp 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,5 +1,4 @@
#include "exception.h"
-#include <iostream>
#include <sstream>
namespace exc
Modified: pkg/MixABEL/src/MXlib/exception.h
===================================================================
--- pkg/MixABEL/src/MXlib/exception.h 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/exception.h 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,5 +1,5 @@
#include <exception>
-#include <iostream>
+#include <Rcpp.h>
namespace exc
@@ -11,7 +11,6 @@
const char* file,
const char* line,
const char* reason);
- virtual void PrintWhat(std::ostream& where) const;
virtual void PrintWhat() const;
virtual const char* what() const throw();
void SetFile(const std::string& file);
Modified: pkg/MixABEL/src/MXlib/fgls.cpp
===================================================================
--- pkg/MixABEL/src/MXlib/fgls.cpp 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/fgls.cpp 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,5 +1,5 @@
+#include "gsl_types_extptr.h"
#include "fgls.h"
-#include "gsl_types_extptr.h"
using namespace std;
@@ -335,7 +335,7 @@
// here should compute score var
gsl_matrix_free(XpWXm1);
gsl_matrix_free(tXW);
- cout << "score test, but missing scorevar\n";
+ Rcpp::Rcout << "score test, but missing scorevar\n";
return(-2.0);
}
@@ -410,7 +410,7 @@
// option not recognised
gsl_matrix_free(XpWXm1);
gsl_matrix_free(tXW);
- cout << "test not recognised\n";
+ Rcpp::Rcout << "test not recognised\n";
return(-2.0);
}
@@ -501,7 +501,7 @@
} else {
gsl_matrix_free(XpWXm1);
gsl_matrix_free(tXW);
- cout << "WhichToTest > X->size2\n";
+ Rcpp::Rcout << "WhichToTest > X->size2\n";
return(-2.0);
}
Modified: pkg/MixABEL/src/MXlib/fgls.h
===================================================================
--- pkg/MixABEL/src/MXlib/fgls.h 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/fgls.h 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,5 +1,4 @@
#include <new>
-#include <iostream>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_blas.h>
@@ -7,9 +6,9 @@
#include <R.h>
#include <Rinternals.h>
+#include <Rcpp.h>
-
extern "C" {
double fgls(gsl_vector * Y, gsl_matrix * X,
Modified: pkg/MixABEL/src/MXlib/moorepenrose.cpp
===================================================================
--- pkg/MixABEL/src/MXlib/moorepenrose.cpp 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/moorepenrose.cpp 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,14 +1,16 @@
-#include "moorepenrose.h"
+#include <math.h>
+// for debug
+#include <iostream>
+
#include <gsl/gsl_vector.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_errno.h>
-#include <math.h>
+#include "moorepenrose.h"
-// for debug
-#include <iostream>
+
int moore_penrose(gsl_matrix* pA_mat, double tol)
{
// compute the SVD of the variance-covariance structure
@@ -81,14 +83,14 @@
void gslprint(gsl_matrix* pmymat)
{
unsigned int i,j;
- std::cout << std::endl;
+ Rcpp::Rcout << std::endl;
for(i=0;i<pmymat->size1;i++)
{
for(j=0;j<pmymat->size2;j++)
- std::cout << gsl_matrix_get(pmymat,i,j) << ", ";
- std::cout << std::endl;
+ Rcpp::Rcout << gsl_matrix_get(pmymat,i,j) << ", ";
+ Rcpp::Rcout << std::endl;
}
- std::cout << std::endl;
+ Rcpp::Rcout << std::endl;
}
/*
@@ -116,8 +118,8 @@
void gslprint(gsl_vector* pmyvec)
{
unsigned int i;
- std::cout << std::endl;
+ Rcpp::Rcout << std::endl;
for(i=0;i<pmyvec->size;i++)
- std::cout << gsl_vector_get(pmyvec,i) << ", ";
- std::cout << std::endl;
+ Rcpp::Rcout << gsl_vector_get(pmyvec,i) << ", ";
+ Rcpp::Rcout << std::endl;
}
Modified: pkg/MixABEL/src/MXlib/moorepenrose.h
===================================================================
--- pkg/MixABEL/src/MXlib/moorepenrose.h 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/moorepenrose.h 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,5 +1,9 @@
#include <gsl/gsl_matrix.h>
+#include <R.h>
+#include <Rdefines.h>
+#include <Rcpp.h>
+
#define CHOL_TOL (double) 1.e-12
int moore_penrose(gsl_matrix* pA, double tol);
Modified: pkg/MixABEL/src/MXlib/twovarcomp.cpp
===================================================================
--- pkg/MixABEL/src/MXlib/twovarcomp.cpp 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/twovarcomp.cpp 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,13 +1,15 @@
-#include "twovarcomp.h"
-#include "exception.h"
-#include "moorepenrose.h"
+#include <math.h>
#include <iostream>
+
#include <gsl/gsl_blas.h>
#include <gsl/gsl_eigen.h>
#include <gsl/gsl_linalg.h>
-#include <math.h>
#include <gsl/gsl_min.h>
+#include "twovarcomp.h"
+#include "exception.h"
+#include "moorepenrose.h"
+
// should this be a friend of the class?
struct dev_pars
{
@@ -620,7 +622,7 @@
}
while (status == GSL_CONTINUE && iter < max_iter);
if(status!=GSL_SUCCESS)
- std::cout<<status;
+ Rcpp::Rcout<<status;
gsl_min_fminimizer_free (s);
if(pminimand)
Modified: pkg/MixABEL/src/MXlib/twovarcomp.h
===================================================================
--- pkg/MixABEL/src/MXlib/twovarcomp.h 2015-05-01 10:01:07 UTC (rev 1954)
+++ pkg/MixABEL/src/MXlib/twovarcomp.h 2015-05-01 11:55:08 UTC (rev 1955)
@@ -1,6 +1,9 @@
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
+#include <Rdefines.h>
+#include <Rcpp.h>
+
// need to understand const and make changes
typedef gsl_matrix* pgsl_matrix;
More information about the Genabel-commits
mailing list