Re: [R] Armadillo error in R extension

2013-02-02 Thread Simon Zehnder
Dear Michael,

during the last days of programming I came across RcppArmadillo (Rcpp) and for 
my kind of work this is indeed pretty interesting. So, I will take a closer 
look today what it is about and how it works. 

As a C++ programmer though, I am still interested why compilation of my package 
fails at this point of code. I hope I get a little more insight on the 
Rcpp-devel list suggested by Dirk! 

Thanks for your comment!

Simon


On Feb 2, 2013, at 12:14 AM, Michael Weylandt michael.weyla...@gmail.com 
wrote:

 Look up the terribly wonderful RcppArmadillo package. 
 
 MW
 
 On Feb 1, 2013, at 8:38 PM, Simon Zehnder szehn...@uni-bonn.de wrote:
 
 Is there anyway with some experience in using armadillo in R C++ extensions?
 
 My problem is the following:
 
 I programmed a function in a header looking like
 
 #include armadillo
 
 inline arma::vec foo(input) {
 
   ... do something
 
   return an arma::vec object 
 }
 
 compiling this via R CMD INSTALL packagename (PKG_CXXFLAGS = 
 -I/folder/of/armadillo and armadillo_bits in my package)
 
 I get the following error 
 
 error: expected initializer before 'foo' 
 
 The exact line and word is where inline arma::vec ends.
 
 Does anyone know what this error could be? 
 
 
 Best
 
 Simon
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Armadillo error in R extension

2013-02-01 Thread Simon Zehnder
Is there anyway with some experience in using armadillo in R C++ extensions?

My problem is the following:

I programmed a function in a header looking like

#include armadillo

inline arma::vec foo(input) {

... do something

return an arma::vec object 
}

compiling this via R CMD INSTALL packagename (PKG_CXXFLAGS = 
-I/folder/of/armadillo and armadillo_bits in my package)

I get the following error 

error: expected initializer before 'foo' 

The exact line and word is where inline arma::vec ends.

Does anyone know what this error could be? 


Best

Simon
 
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Armadillo error in R extension

2013-02-01 Thread Michael Weylandt
Look up the terribly wonderful RcppArmadillo package. 

MW

On Feb 1, 2013, at 8:38 PM, Simon Zehnder szehn...@uni-bonn.de wrote:

 Is there anyway with some experience in using armadillo in R C++ extensions?
 
 My problem is the following:
 
 I programmed a function in a header looking like
 
 #include armadillo
 
 inline arma::vec foo(input) {
 
... do something

return an arma::vec object 
 }
 
 compiling this via R CMD INSTALL packagename (PKG_CXXFLAGS = 
 -I/folder/of/armadillo and armadillo_bits in my package)
 
 I get the following error 
 
 error: expected initializer before 'foo' 
 
 The exact line and word is where inline arma::vec ends.
 
 Does anyone know what this error could be? 
 
 
 Best
 
 Simon
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Armadillo error in R extension

2013-02-01 Thread Dirk Eddelbuettel

On 1 February 2013 at 21:38, Simon Zehnder wrote:
| Is there anyway with some experience in using armadillo in R C++ extensions?

Yes, sure -- we wrote (and use) a package RcppArmadillo that provides very
easy access to Armadillo via Rcpp.
 
| My problem is the following:
| 
| I programmed a function in a header looking like
| 
| #include armadillo
| 
| inline arma::vec foo(input) {
| 
|   ... do something
|   
|   return an arma::vec object 
| }
| 
| compiling this via R CMD INSTALL packagename (PKG_CXXFLAGS = 
-I/folder/of/armadillo and armadillo_bits in my package)
| 
| I get the following error 
| 
| error: expected initializer before 'foo' 
| 
| The exact line and word is where inline arma::vec ends.
| 
| Does anyone know what this error could be? 

We do. I would like to invite to subscribe to the rcpp-devel list, to peruse
its list archives, to study the RcppArmadillo examples (which cover all this)
and, if you still have questions, pose a small reproducible example on the
rcpp-devel list.

Also, we recently opened the Rcpp Gallery (http://gallery.rcpp.org) which
has a set of RcppArmadillo related posts you can read via the tags

http://gallery.rcpp.org/tags/armadillo/

Hope this helps,  Dirk


-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.