Hi,
Ive been trying to make RcppArmadillo work using the example file (fastLM).
I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to use
fastLM but to figure out how to work RcppArmadillo). Then i tried using the
command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that
RcppArmadillo.h not found.
So i tried doing a symbolic link from /usr/local/include to the directory
where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also did a
symbolic link analogously for RcppArmadillo.so. When i ran R CMD SHLIB
again I got the following error:
abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp
g++ -I/usr/share/R/include
-I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g -O2 -c
RcppArmadilloEg.cpp -o RcppArmadilloEg.o
In file included from
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215,
from
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28,
from RcppArmadilloEg.cpp:1:
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:
In function ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const
T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?:
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491:
instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&,
Rcpp::traits::false_type) [with T = arma::Col<double>]?
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509:
instantiated from ?SEXPREC*
Rcpp::internal::wrap_dispatch_unknown_importable(const T&,
Rcpp::traits::false_type) [with T = arma::Col<double>]?
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526:
instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&,
Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]?
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541:
instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T =
arma::Col<double>]?
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54:
instantiated from ?Rcpp::Named::Named(const std::string&, const T&) [with T
= arma::colvec]?
RcppArmadilloEg.cpp:19: instantiated from here
/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394:
error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in
initialization
make: *** [RcppArmadilloEg.o] Error 1
could someone provide some advice?
Many thanks!
Abhisek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100326/1df2da3e/attachment.htm
[Rcpp-devel] RcppArmadillo error
13 messages · Dirk Eddelbuettel, Abhisek, Romain Francois +1 more
(resending, this time to list I omitted last time, sorry. --Dirk)
On 26 March 2010 at 11:10, Abhisek wrote:
| Hi, | | Ive been trying to make RcppArmadillo work using the example file (fastLM). | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to use | fastLM but to figure out how to work RcppArmadillo). Then i tried using the | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that | RcppArmadillo.h not found. | | So i tried doing a symbolic link from /usr/local/include to the directory | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also did a | symbolic link analogously for RcppArmadillo.so. When i ran R CMD SHLIB | again I got the following error: | | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp | g++ -I/usr/share/R/include | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g -O2 -c | RcppArmadilloEg.cpp -o RcppArmadilloEg.o So far so good: one -I for R as usual, one for Rcpp. | In file included from | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | from | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | from RcppArmadilloEg.cpp:1: | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | In function ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&, | Rcpp::traits::false_type) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | instantiated from ?SEXPREC* | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | Rcpp::traits::false_type) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) [with T | = arma::colvec]? | RcppArmadilloEg.cpp:19: instantiated from here | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | initialization | make: *** [RcppArmadilloEg.o] Error 1 | | | could someone provide some advice? Which Rcpp version do you have installed? Which Armadillo version do you have installed? I have not tried the free-floating direct compile you try here. Maybe the defines for RcppArmadillo that we use are missing here -- hard to say. Could you try to create your own little package but copying the RcppArmadillo files, changes DESCRIPTION to what you do and changes the FastLM code in C++ and R? Dirk
Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
Hi Dirk, I downloaded the stuff just last friday so it should be the latest version of Rcpp as well as Armadillo. I used install.packages() for Rcpp and RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. i also had some problem using Armadillo which I posted on the Armadillo discussion board. Conrad got back to me. Here is the discussion: https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 so it may be that armadillo is the problem but im really not sure. Many thanks Abhisek
On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
(resending, this time to list I omitted last time, sorry. --Dirk) On 26 March 2010 at 11:10, Abhisek wrote: | Hi, | | Ive been trying to make RcppArmadillo work using the example file (fastLM). | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to use | fastLM but to figure out how to work RcppArmadillo). Then i tried using the | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that | RcppArmadillo.h not found. | | So i tried doing a symbolic link from /usr/local/include to the directory | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also did a | symbolic link analogously for RcppArmadillo.so. When i ran R CMD SHLIB | again I got the following error: | | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp | g++ -I/usr/share/R/include | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g -O2 -c | RcppArmadilloEg.cpp -o RcppArmadilloEg.o So far so good: one -I for R as usual, one for Rcpp. | In file included from | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | from | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | from RcppArmadilloEg.cpp:1: | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | In function ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown_iterable(const | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const T&, | Rcpp::traits::false_type) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | instantiated from ?SEXPREC* | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | Rcpp::traits::false_type) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | arma::Col<double>]? | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) [with T | = arma::colvec]? | RcppArmadilloEg.cpp:19: instantiated from here | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | initialization | make: *** [RcppArmadilloEg.o] Error 1 | | | could someone provide some advice? Which Rcpp version do you have installed? Which Armadillo version do you have installed? I have not tried the free-floating direct compile you try here. Maybe the defines for RcppArmadillo that we use are missing here -- hard to say. Could you try to create your own little package but copying the RcppArmadillo files, changes DESCRIPTION to what you do and changes the FastLM code in C++ and R? Dirk -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100326/3cedf84e/attachment.htm
Hi Abhisek,
On 26 March 2010 at 12:28, Abhisek wrote:
| I downloaded the stuff just last friday so it should be the latest version | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. Ok, that is all good. And if RcppArmadillo installed you have proper libraries, Armadillo included. I think part of your problem is a misunderstanding of an issue we may not have made particularly clear: You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. The example (in 0.7.10) uses an idiom we no longer like and I am about to change that for an upcoming 0.7.11 release, but it should works as is and just use inline -- so no messing with makefile etc. Try that and see how it goes and keep us posted. Cheers, Dirk | i also had some problem using Armadillo which I posted on the Armadillo | discussion board. Conrad got back to me. Here is the discussion: | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 | | so it may be that armadillo is the problem but im really not sure. | | Many thanks | Abhisek |
| On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| | > | > (resending, this time to list I omitted last time, sorry. --Dirk) | >
| > On 26 March 2010 at 11:10, Abhisek wrote:
| > | Hi, | > | | > | Ive been trying to make RcppArmadillo work using the example file | > (fastLM). | > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to | > use | > | fastLM but to figure out how to work RcppArmadillo). Then i tried using | > the | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that | > | RcppArmadillo.h not found. | > | | > | So i tried doing a symbolic link from /usr/local/include to the directory | > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also did a | > | symbolic link analogously for RcppArmadillo.so. When i ran R CMD SHLIB | > | again I got the following error: | > | | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp | > | g++ -I/usr/share/R/include | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g -O2 | > -c | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o | > | > So far so good: one -I for R as usual, one for Rcpp. | > | > | In file included from | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | > | from | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | > | from RcppArmadilloEg.cpp:1: | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | > | In function ?SEXPREC* | > Rcpp::internal::wrap_dispatch_unknown_iterable(const | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const | > T&, | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | > | instantiated from ?SEXPREC* | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | > | arma::Col<double>]? | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | > | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) [with | > T | > | = arma::colvec]? | > | RcppArmadilloEg.cpp:19: instantiated from here | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | > | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | > | initialization | > | make: *** [RcppArmadilloEg.o] Error 1 | > | | > | | > | could someone provide some advice? | > | > Which Rcpp version do you have installed? | > | > Which Armadillo version do you have installed? | > | > I have not tried the free-floating direct compile you try here. Maybe the | > defines for RcppArmadillo that we use are missing here -- hard to say. | > | > Could you try to create your own little package but copying the | > RcppArmadillo | > files, changes DESCRIPTION to what you do and changes the FastLM code in | > C++ | > and R? | > | > Dirk | > | > -- | > Registration is open for the 2nd International conference R / Finance 2010 | > See http://www.RinFinance.com for details, and see you in Chicago in | > April! | >
Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
Hi Dirk, Just so that I understand. I copied the code in the RcppArmadillo section on your website and pasted and saved it. Are you saying I should change #include <RcppArmadillo> to #include <Rcpp> and #include <armadillo> ? best, abhisek
On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
Hi Abhisek, On 26 March 2010 at 12:28, Abhisek wrote: | I downloaded the stuff just last friday so it should be the latest version | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. Ok, that is all good. And if RcppArmadillo installed you have proper libraries, Armadillo included. I think part of your problem is a misunderstanding of an issue we may not have made particularly clear: You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. The example (in 0.7.10) uses an idiom we no longer like and I am about to change that for an upcoming 0.7.11 release, but it should works as is and just use inline -- so no messing with makefile etc. Try that and see how it goes and keep us posted. Cheers, Dirk | i also had some problem using Armadillo which I posted on the Armadillo | discussion board. Conrad got back to me. Here is the discussion: | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 | | so it may be that armadillo is the problem but im really not sure. | | Many thanks | Abhisek | | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote: | | > | > (resending, this time to list I omitted last time, sorry. --Dirk) | > | > On 26 March 2010 at 11:10, Abhisek wrote: | > | Hi, | > | | > | Ive been trying to make RcppArmadillo work using the example file | > (fastLM). | > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not to | > use | > | fastLM but to figure out how to work RcppArmadillo). Then i tried using | > the | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying that | > | RcppArmadillo.h not found. | > | | > | So i tried doing a symbolic link from /usr/local/include to the directory | > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also did a | > | symbolic link analogously for RcppArmadillo.so. When i ran R CMD SHLIB | > | again I got the following error: | > | | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB RcppArmadilloEg.cpp | > | g++ -I/usr/share/R/include | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g -O2 | > -c | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o | > | > So far so good: one -I for R as usual, one for Rcpp. | > | > | In file included from | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | > | from | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | > | from RcppArmadilloEg.cpp:1: | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | > | In function ?SEXPREC* | > Rcpp::internal::wrap_dispatch_unknown_iterable(const | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch_unknown(const | > T&, | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | > | instantiated from ?SEXPREC* | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | > | arma::Col<double>]? | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | > | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) [with | > T | > | = arma::colvec]? | > | RcppArmadilloEg.cpp:19: instantiated from here | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | > | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | > | initialization | > | make: *** [RcppArmadilloEg.o] Error 1 | > | | > | | > | could someone provide some advice? | > | > Which Rcpp version do you have installed? | > | > Which Armadillo version do you have installed? | > | > I have not tried the free-floating direct compile you try here. Maybe the | > defines for RcppArmadillo that we use are missing here -- hard to say. | > | > Could you try to create your own little package but copying the | > RcppArmadillo | > files, changes DESCRIPTION to what you do and changes the FastLM code in | > C++ | > and R? | > | > Dirk | > | > -- | > Registration is open for the 2nd International conference R / Finance 2010 | > See http://www.RinFinance.com for details, and see you in Chicago in | > April! | > -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100326/ee8f9109/attachment.htm
On 26 March 2010 at 15:32, Abhisek wrote:
| Hi Dirk,
|
| Just so that I understand. I copied the code in the RcppArmadillo section
| on your website and pasted and saved it.
What code? What page?
| Are you saying I should change
| #include <RcppArmadillo> to #include <Rcpp> and #include <armadillo> ?
No that is not what I said. I said
You can't just look at FastLM() and think your code will run like it.
RcppArmadillo __does not export its classes__. It is an implementation
reference -- it gives you guidance as to how to implement C++ packages of
your own against other libraries.
If you "just" want to use Armadillo and have Rcpp help you, look at the
installed example 'FastLM' in the Rcpp package. In other words ignore
RcppArmadillo for now.
So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run
fastLMviaArmadillo.r
and look at it. That should work.
You can also look at the _entire RcppArmadillo package_ and see how the
pieces fit together, including src/Makevars.
But don't just take semi-random shortcuts and expect that to work. If we
could make it any simpler, we would. There is a reason RcppArmadilli is
package and not just a file.
Dirk
| best,
| abhisek
|
| On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
| | > | > Hi Abhisek, | >
| > On 26 March 2010 at 12:28, Abhisek wrote:
| > | I downloaded the stuff just last friday so it should be the latest | > version | > | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and | > | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. | > | > Ok, that is all good. And if RcppArmadillo installed you have proper | > libraries, Armadillo included. | > | > I think part of your problem is a misunderstanding of an issue we may not | > have made particularly clear: You can't just look at FastLM() and think | > your code will run like it. RcppArmadillo __does not export its classes__. | > It is an implementation reference -- it gives you guidance as to how to | > implement C++ packages of your own against other libraries. | > | > If you "just" want to use Armadillo and have Rcpp help you, look at the | > installed example 'FastLM' in the Rcpp package. In other words ignore | > RcppArmadillo for now. | > | > The example (in 0.7.10) uses an idiom we no longer like and I am about to | > change that for an upcoming 0.7.11 release, but it should works as is and | > just use inline -- so no messing with makefile etc. | > | > Try that and see how it goes and keep us posted. | > | > Cheers, Dirk | > | > | > | i also had some problem using Armadillo which I posted on the Armadillo | > | discussion board. Conrad got back to me. Here is the discussion: | > | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 | > | | > | so it may be that armadillo is the problem but im really not sure. | > | | > | Many thanks | > | Abhisek | > | | > | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org>
| > wrote:
| > | | > | > | > | > (resending, this time to list I omitted last time, sorry. --Dirk) | > | >
| > | > On 26 March 2010 at 11:10, Abhisek wrote:
| > | > | Hi, | > | > | | > | > | Ive been trying to make RcppArmadillo work using the example file | > | > (fastLM). | > | > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not | > to | > | > use | > | > | fastLM but to figure out how to work RcppArmadillo). Then i tried | > using | > | > the | > | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying | > that | > | > | RcppArmadillo.h not found. | > | > | | > | > | So i tried doing a symbolic link from /usr/local/include to the | > directory | > | > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also | > did a | > | > | symbolic link analogously for RcppArmadillo.so. When i ran R CMD | > SHLIB | > | > | again I got the following error: | > | > | | > | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB | > RcppArmadilloEg.cpp | > | > | g++ -I/usr/share/R/include | > | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g | > -O2 | > | > -c | > | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o | > | > | > | > So far so good: one -I for R as usual, one for Rcpp. | > | > | > | > | In file included from | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | > | > | from | > | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | > | > | from RcppArmadilloEg.cpp:1: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | > | > | In function ?SEXPREC* | > | > Rcpp::internal::wrap_dispatch_unknown_iterable(const | > | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | > | > | instantiated from ?SEXPREC* | > Rcpp::internal::wrap_dispatch_unknown(const | > | > T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | > | > | instantiated from ?SEXPREC* | > | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | > | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | > | > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | > | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | > | > | arma::Col<double>]? | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | > | > | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) | > [with | > | > T | > | > | = arma::colvec]? | > | > | RcppArmadilloEg.cpp:19: instantiated from here | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | > | > | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | > | > | initialization | > | > | make: *** [RcppArmadilloEg.o] Error 1 | > | > | | > | > | | > | > | could someone provide some advice? | > | > | > | > Which Rcpp version do you have installed? | > | > | > | > Which Armadillo version do you have installed? | > | > | > | > I have not tried the free-floating direct compile you try here. Maybe | > the | > | > defines for RcppArmadillo that we use are missing here -- hard to say. | > | > | > | > Could you try to create your own little package but copying the | > | > RcppArmadillo | > | > files, changes DESCRIPTION to what you do and changes the FastLM code | > in | > | > C++ | > | > and R? | > | > | > | > Dirk | > | > | > | > -- | > | > Registration is open for the 2nd International conference R / Finance | > 2010 | > | > See http://www.RinFinance.com for details, and see you in Chicago in | > | > April! | > | > | > | > -- | > Registration is open for the 2nd International conference R / Finance | > 2010 | > See http://www.RinFinance.com for details, and see you in Chicago in | > April! | >
Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. which means that somehow, armadillo is giving problems. but that is as far as i can understand. either that or my understanding is way off. appreciate your patience and help! abhisek
On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
On 26 March 2010 at 15:32, Abhisek wrote: | Hi Dirk, | | Just so that I understand. I copied the code in the RcppArmadillo section | on your website and pasted and saved it. What code? What page? | Are you saying I should change | #include <RcppArmadillo> to #include <Rcpp> and #include <armadillo> ? No that is not what I said. I said You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run fastLMviaArmadillo.r and look at it. That should work. You can also look at the _entire RcppArmadillo package_ and see how the pieces fit together, including src/Makevars. But don't just take semi-random shortcuts and expect that to work. If we could make it any simpler, we would. There is a reason RcppArmadilli is package and not just a file. Dirk | best, | abhisek | | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel <edd at debian.org> wrote: | | > | > Hi Abhisek, | > | > On 26 March 2010 at 12:28, Abhisek wrote: | > | I downloaded the stuff just last friday so it should be the latest | > version | > | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and | > | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. | > | > Ok, that is all good. And if RcppArmadillo installed you have proper | > libraries, Armadillo included. | > | > I think part of your problem is a misunderstanding of an issue we may not | > have made particularly clear: You can't just look at FastLM() and think | > your code will run like it. RcppArmadillo __does not export its classes__. | > It is an implementation reference -- it gives you guidance as to how to | > implement C++ packages of your own against other libraries. | > | > If you "just" want to use Armadillo and have Rcpp help you, look at the | > installed example 'FastLM' in the Rcpp package. In other words ignore | > RcppArmadillo for now. | > | > The example (in 0.7.10) uses an idiom we no longer like and I am about to | > change that for an upcoming 0.7.11 release, but it should works as is and | > just use inline -- so no messing with makefile etc. | > | > Try that and see how it goes and keep us posted. | > | > Cheers, Dirk | > | > | > | i also had some problem using Armadillo which I posted on the Armadillo | > | discussion board. Conrad got back to me. Here is the discussion: | > | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 | > | | > | so it may be that armadillo is the problem but im really not sure. | > | | > | Many thanks | > | Abhisek | > | | > | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org> | > wrote: | > | | > | > | > | > (resending, this time to list I omitted last time, sorry. --Dirk) | > | > | > | > On 26 March 2010 at 11:10, Abhisek wrote: | > | > | Hi, | > | > | | > | > | Ive been trying to make RcppArmadillo work using the example file | > | > (fastLM). | > | > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not | > to | > | > use | > | > | fastLM but to figure out how to work RcppArmadillo). Then i tried | > using | > | > the | > | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying | > that | > | > | RcppArmadillo.h not found. | > | > | | > | > | So i tried doing a symbolic link from /usr/local/include to the | > directory | > | > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also | > did a | > | > | symbolic link analogously for RcppArmadillo.so. When i ran R CMD | > SHLIB | > | > | again I got the following error: | > | > | | > | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB | > RcppArmadilloEg.cpp | > | > | g++ -I/usr/share/R/include | > | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g | > -O2 | > | > -c | > | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o | > | > | > | > So far so good: one -I for R as usual, one for Rcpp. | > | > | > | > | In file included from | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | > | > | from | > | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | > | > | from RcppArmadilloEg.cpp:1: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | > | > | In function ?SEXPREC* | > | > Rcpp::internal::wrap_dispatch_unknown_iterable(const | > | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | > | > | instantiated from ?SEXPREC* | > Rcpp::internal::wrap_dispatch_unknown(const | > | > T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | > | > | instantiated from ?SEXPREC* | > | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | > | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | > | > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | > | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | > | > | arma::Col<double>]? | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | > | > | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) | > [with | > | > T | > | > | = arma::colvec]? | > | > | RcppArmadilloEg.cpp:19: instantiated from here | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | > | > | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | > | > | initialization | > | > | make: *** [RcppArmadilloEg.o] Error 1 | > | > | | > | > | | > | > | could someone provide some advice? | > | > | > | > Which Rcpp version do you have installed? | > | > | > | > Which Armadillo version do you have installed? | > | > | > | > I have not tried the free-floating direct compile you try here. Maybe | > the | > | > defines for RcppArmadillo that we use are missing here -- hard to say. | > | > | > | > Could you try to create your own little package but copying the | > | > RcppArmadillo | > | > files, changes DESCRIPTION to what you do and changes the FastLM code | > in | > | > C++ | > | > and R? | > | > | > | > Dirk | > | > | > | > -- | > | > Registration is open for the 2nd International conference R / Finance | > 2010 | > | > See http://www.RinFinance.com for details, and see you in Chicago in | > | > April! | > | > | > | > -- | > Registration is open for the 2nd International conference R / Finance | > 2010 | > See http://www.RinFinance.com for details, and see you in Chicago in | > April! | > -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100326/f8563139/attachment-0001.htm
3 days later
Hi, If you want to compile the code that is here http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this: romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e "RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp I would however strongly recommend you to have this in a package. Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. which means that somehow, armadillo is giving problems. but that is as far as i can understand. either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel <edd at debian.org <mailto:edd at debian.org>> wrote: On 26 March 2010 at 15:32, Abhisek wrote: | Hi Dirk, | | Just so that I understand. I copied the code in the RcppArmadillo section | on your website and pasted and saved it. What code? What page? | Are you saying I should change | #include <RcppArmadillo> to #include <Rcpp> and #include <armadillo> ? No that is not what I said. I said You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run fastLMviaArmadillo.r and look at it. That should work. You can also look at the _entire RcppArmadillo package_ and see how the pieces fit together, including src/Makevars. But don't just take semi-random shortcuts and expect that to work. If we could make it any simpler, we would. There is a reason RcppArmadilli is package and not just a file. Dirk | best, | abhisek | | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel <edd at debian.org <mailto:edd at debian.org>> wrote: | | > | > Hi Abhisek, | > | > On 26 March 2010 at 12:28, Abhisek wrote: | > | I downloaded the stuff just last friday so it should be the latest | > version | > | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and | > | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. | > | > Ok, that is all good. And if RcppArmadillo installed you have proper | > libraries, Armadillo included. | > | > I think part of your problem is a misunderstanding of an issue we may not | > have made particularly clear: You can't just look at FastLM() and think | > your code will run like it. RcppArmadillo __does not export its classes__. | > It is an implementation reference -- it gives you guidance as to how to | > implement C++ packages of your own against other libraries. | > | > If you "just" want to use Armadillo and have Rcpp help you, look at the | > installed example 'FastLM' in the Rcpp package. In other words ignore | > RcppArmadillo for now. | > | > The example (in 0.7.10) uses an idiom we no longer like and I am about to | > change that for an upcoming 0.7.11 release, but it should works as is and | > just use inline -- so no messing with makefile etc. | > | > Try that and see how it goes and keep us posted. | > | > Cheers, Dirk | > | > | > | i also had some problem using Armadillo which I posted on the Armadillo | > | discussion board. Conrad got back to me. Here is the discussion: | > | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 <https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> | > | | > | so it may be that armadillo is the problem but im really not sure. | > | | > | Many thanks | > | Abhisek | > | | > | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org <mailto:edd at debian.org>> | > wrote: | > | | > | > | > | > (resending, this time to list I omitted last time, sorry. --Dirk) | > | > | > | > On 26 March 2010 at 11:10, Abhisek wrote: | > | > | Hi, | > | > | | > | > | Ive been trying to make RcppArmadillo work using the example file | > | > (fastLM). | > | > | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not | > to | > | > use | > | > | fastLM but to figure out how to work RcppArmadillo). Then i tried | > using | > | > the | > | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying | > that | > | > | RcppArmadillo.h not found. | > | > | | > | > | So i tried doing a symbolic link from /usr/local/include to the | > directory | > | > | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also | > did a | > | > | symbolic link analogously for RcppArmadillo.so. When i ran R CMD | > SHLIB | > | > | again I got the following error: | > | > | | > | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB | > RcppArmadilloEg.cpp | > | > | g++ -I/usr/share/R/include | > | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g | > -O2 | > | > -c | > | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o | > | > | > | > So far so good: one -I for R as usual, one for Rcpp. | > | > | > | > | In file included from | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, | > | > | from | > | > | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, | > | > | from RcppArmadilloEg.cpp:1: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: | > | > | In function ?SEXPREC* | > | > Rcpp::internal::wrap_dispatch_unknown_iterable(const | > | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: | > | > | instantiated from ?SEXPREC* | > Rcpp::internal::wrap_dispatch_unknown(const | > | > T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: | > | > | instantiated from ?SEXPREC* | > | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: | > | > | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, | > | > | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: | > | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = | > | > | arma::Col<double>]? | > | > | | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: | > | > | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) | > [with | > | > T | > | > | = arma::colvec]? | > | > | RcppArmadilloEg.cpp:19: instantiated from here | > | > | | > | > | > /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: | > | > | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in | > | > | initialization | > | > | make: *** [RcppArmadilloEg.o] Error 1 | > | > | | > | > | | > | > | could someone provide some advice? | > | > | > | > Which Rcpp version do you have installed? | > | > | > | > Which Armadillo version do you have installed? | > | > | > | > I have not tried the free-floating direct compile you try here. Maybe | > the | > | > defines for RcppArmadillo that we use are missing here -- hard to say. | > | > | > | > Could you try to create your own little package but copying the | > | > RcppArmadillo | > | > files, changes DESCRIPTION to what you do and changes the FastLM code | > in | > | > C++ | > | > and R? | > | > | > | > Dirk | > | > | > | > -- | > | > Registration is open for the 2nd International conference R / Finance | > 2010 | > | > See http://www.RinFinance.com for details, and see you in Chicago in | > | > April! | > | > | > | > -- | > Registration is open for the 2nd International conference R / Finance | > 2010 | > See http://www.RinFinance.com for details, and see you in Chicago in | > April! | > -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
On Tue, Mar 30, 2010 at 1:15 AM, Romain Francois
<romain at r-enthusiasts.com> wrote:
Hi,
If you want to compile the code that is here http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this:
romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e "RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp
The way that RcppArmadillo:::LdFlags() is currently defined there is a
possibility of getting different Lapack and BLAS libraries when using
R or calls to RcppArmadillo. R uses the libraries defined by the
macros LAPACK_LIBS, BLAS_LIBS and FLIBS in the file
file.path(R.home("etc"), "Makeconf") # evaluate this in R
It is not certain that those will be the same as the libraries used by
Armadillo. If they are not shared objects you run the risk of getting
two copies of Lapack, etc. and possibly different BLAS, leading to
different performance characteristics and perhaps different results.
I would however strongly recommend you to have this in a package. Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. ?The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. ?but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. ?And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. ?but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. ?which means that somehow, armadillo is giving problems. ?but that is as far as i can understand. ?either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel <edd at debian.org <mailto:edd at debian.org>> wrote: ? ? On 26 March 2010 at 15:32, Abhisek wrote: ? ? | Hi Dirk, ? ? | ? ? | Just so that I understand. ?I copied the code in the RcppArmadillo ? ? section ? ? | on your website and pasted and saved it. ? ? What code? What page? ? ? | Are you saying I should change ? ? | #include <RcppArmadillo> to #include <Rcpp> and #include <armadillo> ? ? ? No that is not what I said. ?I said ? ? ? ? You can't just look at FastLM() and think your code will run ? ? like it. ? ? ? ? RcppArmadillo __does not export its classes__. ?It is an ? ? implementation ? ? ? ? reference -- it gives you guidance as to how to implement C++ ? ? packages of ? ? ? ? your own against other libraries. ? ? ? ? If you "just" want to use Armadillo and have Rcpp help you, look ? ? at the ? ? ? ? installed example 'FastLM' in the Rcpp package. ?In other words ? ? ignore ? ? ? ? RcppArmadillo for now. ? ? So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. ? ? ? Run ? ? ? ? fastLMviaArmadillo.r ? ? and look at it. That should work. ? ? You can also look at the _entire RcppArmadillo package_ and see how the ? ? pieces fit together, including src/Makevars. ? ? But don't just take semi-random shortcuts and expect that to work. If we ? ? could make it any simpler, we would. ?There is a reason RcppArmadilli is ? ? package and not just a file. ? ? Dirk ? ? | best, ? ? | abhisek ? ? | ? ? | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel <edd at debian.org ? ? <mailto:edd at debian.org>> wrote: ? ? | ? ? | > ? ? | > Hi Abhisek, ? ? | > ? ? | > On 26 March 2010 at 12:28, Abhisek wrote: ? ? | > | I downloaded the stuff just last friday so it should be the latest ? ? | > version ? ? | > | of Rcpp as well as Armadillo. ?I used install.packages() for ? ? Rcpp and ? ? | > | RcppArmadillo. ?Armadillo is 0.9.4. ?Im using xubuntu karmic ? ? koala. ? ? | > ? ? | > Ok, that is all good. ?And if RcppArmadillo installed you have ? ? proper ? ? | > libraries, Armadillo included. ? ? | > ? ? | > I think part of your problem is a misunderstanding of an issue ? ? we may not ? ? | > have made particularly clear: ?You can't just look at FastLM() ? ? and think ? ? | > your code will run like it. ?RcppArmadillo __does not export its ? ? classes__. ? ? | > It is an implementation reference -- it gives you guidance as to ? ? how to ? ? | > implement C++ packages of your own against other libraries. ? ? | > ? ? | > If you "just" want to use Armadillo and have Rcpp help you, look ? ? at the ? ? | > installed example 'FastLM' in the Rcpp package. ?In other words ? ? ignore ? ? | > RcppArmadillo for now. ? ? | > ? ? | > The example (in 0.7.10) uses an idiom we no longer like and I am ? ? about to ? ? | > change that for an upcoming 0.7.11 release, but it should works ? ? as is and ? ? | > just use inline -- so no messing with makefile etc. ? ? | > ? ? | > Try that and see how it goes and keep us posted. ? ? | > ? ? | > Cheers, Dirk ? ? | > ? ? | > ? ? | > | i also had some problem using Armadillo which I posted on the ? ? Armadillo ? ? | > | discussion board. ?Conrad got back to me. ?Here is the discussion: ? ? | > | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 ? ? <https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> ? ? | > | ? ? | > | so it may be that armadillo is the problem but im really not sure. ? ? | > | ? ? | > | Many thanks ? ? | > | Abhisek ? ? | > | ? ? | > | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel ? ? <edd at debian.org <mailto:edd at debian.org>> ? ? | > wrote: ? ? | > | ? ? | > | > ? ? | > | > (resending, this time to list I omitted last time, sorry. ? ? --Dirk) ? ? | > | > ? ? | > | > On 26 March 2010 at 11:10, Abhisek wrote: ? ? | > | > | Hi, ? ? | > | > | ? ? | > | > | Ive been trying to make RcppArmadillo work using the ? ? example file ? ? | > | > (fastLM). ? ? | > | > | I copied and pasted the code and saved it as ? ? RcppArmadilloEg.cpp (not ? ? | > to ? ? | > | > use ? ? | > | > | fastLM but to figure out how to work RcppArmadillo). ?Then ? ? i tried ? ? | > using ? ? | > | > the ? ? | > | > | command R CMD SHLIB RcppArmadilloEg.cpp but an error came ? ? up saying ? ? | > that ? ? | > | > | RcppArmadillo.h not found. ? ? | > | > | ? ? | > | > | So i tried doing a symbolic link from /usr/local/include ? ? to the ? ? | > directory ? ? | > | > | where RcppArmadillo.h and RcppArmadilloDefines.h is ? ? stored. ?I also ? ? | > did a ? ? | > | > | symbolic link analogously for RcppArmadillo.so. ?When i ? ? ran R CMD ? ? | > SHLIB ? ? | > | > | again I got the following error: ? ? | > | > | ? ? | > | > | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB ? ? | > RcppArmadilloEg.cpp ? ? | > | > | g++ -I/usr/share/R/include ? ? | > | > | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib ? ? -fpic ?-g ? ? | > -O2 ? ? | > | > -c ? ? | > | > | RcppArmadilloEg.cpp -o RcppArmadilloEg.o ? ? | > | > ? ? | > | > So far so good: ?one -I for R as usual, one for Rcpp. ? ? | > | > ? ? | > | > | In file included from ? ? | > | > | ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, ? ? | > | > | ? ? ? ? ? ? ? ? ?from ? ? | > | > | ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, ? ? | > | > | ? ? ? ? ? ? ? ? ?from RcppArmadilloEg.cpp:1: ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: ? ? | > | > | In function ?SEXPREC* ? ? | > | > Rcpp::internal::wrap_dispatch_unknown_iterable(const ? ? | > | > | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: ? ? | > | > | instantiated from ?SEXPREC* ? ? | > Rcpp::internal::wrap_dispatch_unknown(const ? ? | > | > T&, ? ? | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: ? ? | > | > | instantiated from ?SEXPREC* ? ? | > | > | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, ? ? | > | > | Rcpp::traits::false_type) [with T = arma::Col<double>]? ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: ? ? | > | > | instantiated from ?SEXPREC* ? ? Rcpp::internal::wrap_dispatch(const T&, ? ? | > | > | Rcpp::traits::wrap_type_unknown_tag) [with T = ? ? arma::Col<double>]? ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: ? ? | > | > | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = ? ? | > | > | arma::Col<double>]? ? ? | > | > | ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: ? ? | > | > | instantiated from ?Rcpp::Named::Named(const std::string&, ? ? const T&) ? ? | > [with ? ? | > | > T ? ? | > | > | = arma::colvec]? ? ? | > | > | RcppArmadilloEg.cpp:19: ? instantiated from here ? ? | > | > | ? ? | > | > ? ? | > ? ? /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: ? ? | > | > | error: cannot convert ?const arma::Col<double>? to ? ? ?SEXPREC*? in ? ? | > | > | initialization ? ? | > | > | make: *** [RcppArmadilloEg.o] Error 1 ? ? | > | > | ? ? | > | > | ? ? | > | > | could someone provide some advice? ? ? | > | > ? ? | > | > Which Rcpp version do you have installed? ? ? | > | > ? ? | > | > Which Armadillo version do you have installed? ? ? | > | > ? ? | > | > I have not tried the free-floating direct compile you try ? ? here. ?Maybe ? ? | > the ? ? | > | > defines for RcppArmadillo that we use are missing here -- ? ? hard to say. ? ? | > | > ? ? | > | > Could you try to create your own little package but copying the ? ? | > | > RcppArmadillo ? ? | > | > files, changes DESCRIPTION to what you do and changes the ? ? FastLM code ? ? | > in ? ? | > | > C++ ? ? | > | > and R? ? ? | > | > ? ? | > | > Dirk ? ? | > | > ? ? | > | > -- ? ? | > | > ?Registration is open for the 2nd International conference R ? ? / Finance ? ? | > 2010 ? ? | > | > ?See http://www.RinFinance.com for details, and see you in ? ? Chicago in ? ? | > | > April! ? ? | > | > ? ? | > ? ? | > -- ? ? | > ? Registration is open for the 2nd International conference R / ? ? Finance ? ? | > 2010 ? ? | > ?See http://www.RinFinance.com for details, and see you in ? ? Chicago in ? ? | > April! ? ? | > ? ? -- ? ? ? Registration is open for the 2nd International conference R / ? ? Finance 2010 ? ? ? See http://www.RinFinance.com for details, and see you in Chicago ? ? in April!
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Le 30/03/10 15:36, Douglas Bates a ?crit :
On Tue, Mar 30, 2010 at 1:15 AM, Romain Francois <romain at r-enthusiasts.com> wrote:
Hi,
If you want to compile the code that is here http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this:
romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e "RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp
The way that RcppArmadillo:::LdFlags() is currently defined there is a
possibility of getting different Lapack and BLAS libraries when using
R or calls to RcppArmadillo. R uses the libraries defined by the
macros LAPACK_LIBS, BLAS_LIBS and FLIBS in the file
file.path(R.home("etc"), "Makeconf") # evaluate this in R
It is not certain that those will be the same as the libraries used by
Armadillo. If they are not shared objects you run the risk of getting
two copies of Lapack, etc. and possibly different BLAS, leading to
different performance characteristics and perhaps different results.
Hmmm. Interesting. I did not think of that problem. On my machine, I have : Rscript -e "RcppArmadillo:::LdFlags()" /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/usr/lib -larmadillo so linking against Rcpp "user" library and armadillo... but when I manually set PKG_LIBS to just Rcpp user library, it still works, so we actually do not need to link against armadillo library. armadillo itself does not __need__ to get compiled into a library because it is all templates.
I would however strongly recommend you to have this in a package. Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. which means that somehow, armadillo is giving problems. but that is as far as i can understand. either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: On 26 March 2010 at 15:32, Abhisek wrote: | Hi Dirk, | | Just so that I understand. I copied the code in the RcppArmadillo section | on your website and pasted and saved it. What code? What page? | Are you saying I should change | #include<RcppArmadillo> to #include<Rcpp> and #include<armadillo> ? No that is not what I said. I said You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run fastLMviaArmadillo.r and look at it. That should work. You can also look at the _entire RcppArmadillo package_ and see how the pieces fit together, including src/Makevars. But don't just take semi-random shortcuts and expect that to work. If we could make it any simpler, we would. There is a reason RcppArmadilli is package and not just a file. Dirk | best, | abhisek | | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: | |> |> Hi Abhisek, |> |> On 26 March 2010 at 12:28, Abhisek wrote: |> | I downloaded the stuff just last friday so it should be the latest |> version |> | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and |> | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. |> |> Ok, that is all good. And if RcppArmadillo installed you have proper |> libraries, Armadillo included. |> |> I think part of your problem is a misunderstanding of an issue we may not |> have made particularly clear: You can't just look at FastLM() and think |> your code will run like it. RcppArmadillo __does not export its classes__. |> It is an implementation reference -- it gives you guidance as to how to |> implement C++ packages of your own against other libraries. |> |> If you "just" want to use Armadillo and have Rcpp help you, look at the |> installed example 'FastLM' in the Rcpp package. In other words ignore |> RcppArmadillo for now. |> |> The example (in 0.7.10) uses an idiom we no longer like and I am about to |> change that for an upcoming 0.7.11 release, but it should works as is and |> just use inline -- so no messing with makefile etc. |> |> Try that and see how it goes and keep us posted. |> |> Cheers, Dirk |> |> |> | i also had some problem using Armadillo which I posted on the Armadillo |> | discussion board. Conrad got back to me. Here is the discussion: |> | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 <https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> |> | |> | so it may be that armadillo is the problem but im really not sure. |> | |> | Many thanks |> | Abhisek |> | |> | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org<mailto:edd at debian.org>> |> wrote: |> | |> |> |> |> (resending, this time to list I omitted last time, sorry. --Dirk) |> |> |> |> On 26 March 2010 at 11:10, Abhisek wrote: |> |> | Hi, |> |> | |> |> | Ive been trying to make RcppArmadillo work using the example file |> |> (fastLM). |> |> | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not |> to |> |> use |> |> | fastLM but to figure out how to work RcppArmadillo). Then i tried |> using |> |> the |> |> | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying |> that |> |> | RcppArmadillo.h not found. |> |> | |> |> | So i tried doing a symbolic link from /usr/local/include to the |> directory |> |> | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also |> did a |> |> | symbolic link analogously for RcppArmadillo.so. When i ran R CMD |> SHLIB |> |> | again I got the following error: |> |> | |> |> | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB |> RcppArmadilloEg.cpp |> |> | g++ -I/usr/share/R/include |> |> | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g |> -O2 |> |> -c |> |> | RcppArmadilloEg.cpp -o RcppArmadilloEg.o |> |> |> |> So far so good: one -I for R as usual, one for Rcpp. |> |> |> |> | In file included from |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, |> |> | from |> |> | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, |> |> | from RcppArmadilloEg.cpp:1: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: |> |> | In function ?SEXPREC* |> |> Rcpp::internal::wrap_dispatch_unknown_iterable(const |> |> | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: |> |> | instantiated from ?SEXPREC* |> Rcpp::internal::wrap_dispatch_unknown(const |> |> T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: |> |> | instantiated from ?SEXPREC* |> |> | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: |> |> | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, |> |> | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: |> |> | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = |> |> | arma::Col<double>]? |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: |> |> | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) |> [with |> |> T |> |> | = arma::colvec]? |> |> | RcppArmadilloEg.cpp:19: instantiated from here |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: |> |> | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in |> |> | initialization |> |> | make: *** [RcppArmadilloEg.o] Error 1 |> |> | |> |> | |> |> | could someone provide some advice? |> |> |> |> Which Rcpp version do you have installed? |> |> |> |> Which Armadillo version do you have installed? |> |> |> |> I have not tried the free-floating direct compile you try here. Maybe |> the |> |> defines for RcppArmadillo that we use are missing here -- hard to say. |> |> |> |> Could you try to create your own little package but copying the |> |> RcppArmadillo |> |> files, changes DESCRIPTION to what you do and changes the FastLM code |> in |> |> C++ |> |> and R? |> |> |> |> Dirk |> |> |> |> -- |> |> Registration is open for the 2nd International conference R / Finance |> 2010 |> |> See http://www.RinFinance.com for details, and see you in Chicago in |> |> April! |> |> |> |> -- |> Registration is open for the 2nd International conference R / Finance |> 2010 |> See http://www.RinFinance.com for details, and see you in Chicago in |> April! |> -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
Hi all, thanks very much for all this advice! ill be trying this out soon and hopefully it works. again, thanks for writing these amazing packages! abhisek On Tue, Mar 30, 2010 at 3:12 PM, Romain Francois
<romain at r-enthusiasts.com>wrote:
Le 30/03/10 15:36, Douglas Bates a ?crit : On Tue, Mar 30, 2010 at 1:15 AM, Romain Francois
<romain at r-enthusiasts.com> wrote:
Hi,
If you want to compile the code that is here
http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this:
romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e
"RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp
The way that RcppArmadillo:::LdFlags() is currently defined there is a
possibility of getting different Lapack and BLAS libraries when using
R or calls to RcppArmadillo. R uses the libraries defined by the
macros LAPACK_LIBS, BLAS_LIBS and FLIBS in the file
file.path(R.home("etc"), "Makeconf") # evaluate this in R
It is not certain that those will be the same as the libraries used by
Armadillo. If they are not shared objects you run the risk of getting
two copies of Lapack, etc. and possibly different BLAS, leading to
different performance characteristics and perhaps different results.
Hmmm. Interesting. I did not think of that problem. On my machine, I have : Rscript -e "RcppArmadillo:::LdFlags()" /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/usr/lib -larmadillo so linking against Rcpp "user" library and armadillo... but when I manually set PKG_LIBS to just Rcpp user library, it still works, so we actually do not need to link against armadillo library. armadillo itself does not __need__ to get compiled into a library because it is all templates. I would however strongly recommend you to have this in a package.
Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. which means that somehow, armadillo is giving problems. but that is as far as i can understand. either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: On 26 March 2010 at 15:32, Abhisek wrote: | Hi Dirk, | | Just so that I understand. I copied the code in the RcppArmadillo section | on your website and pasted and saved it. What code? What page? | Are you saying I should change | #include<RcppArmadillo> to #include<Rcpp> and #include<armadillo> ? No that is not what I said. I said You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run fastLMviaArmadillo.r and look at it. That should work. You can also look at the _entire RcppArmadillo package_ and see how the pieces fit together, including src/Makevars. But don't just take semi-random shortcuts and expect that to work. If we could make it any simpler, we would. There is a reason RcppArmadilli is package and not just a file. Dirk | best, | abhisek | | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: | |> |> Hi Abhisek, |> |> On 26 March 2010 at 12:28, Abhisek wrote: |> | I downloaded the stuff just last friday so it should be the latest |> version |> | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and |> | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. |> |> Ok, that is all good. And if RcppArmadillo installed you have proper |> libraries, Armadillo included. |> |> I think part of your problem is a misunderstanding of an issue we may not |> have made particularly clear: You can't just look at FastLM() and think |> your code will run like it. RcppArmadillo __does not export its classes__. |> It is an implementation reference -- it gives you guidance as to how to |> implement C++ packages of your own against other libraries. |> |> If you "just" want to use Armadillo and have Rcpp help you, look at the |> installed example 'FastLM' in the Rcpp package. In other words ignore |> RcppArmadillo for now. |> |> The example (in 0.7.10) uses an idiom we no longer like and I am about to |> change that for an upcoming 0.7.11 release, but it should works as is and |> just use inline -- so no messing with makefile etc. |> |> Try that and see how it goes and keep us posted. |> |> Cheers, Dirk |> |> |> | i also had some problem using Armadillo which I posted on the Armadillo |> | discussion board. Conrad got back to me. Here is the discussion: |> | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 <https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> |> | |> | so it may be that armadillo is the problem but im really not sure. |> | |> | Many thanks |> | Abhisek |> | |> | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org<mailto:edd at debian.org>> |> wrote: |> | |> |> |> |> (resending, this time to list I omitted last time, sorry. --Dirk) |> |> |> |> On 26 March 2010 at 11:10, Abhisek wrote: |> |> | Hi, |> |> | |> |> | Ive been trying to make RcppArmadillo work using the example file |> |> (fastLM). |> |> | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not |> to |> |> use |> |> | fastLM but to figure out how to work RcppArmadillo). Then i tried |> using |> |> the |> |> | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying |> that |> |> | RcppArmadillo.h not found. |> |> | |> |> | So i tried doing a symbolic link from /usr/local/include to the |> directory |> |> | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also |> did a |> |> | symbolic link analogously for RcppArmadillo.so. When i ran R CMD |> SHLIB |> |> | again I got the following error: |> |> | |> |> | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB |> RcppArmadilloEg.cpp |> |> | g++ -I/usr/share/R/include |> |> | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g |> -O2 |> |> -c |> |> | RcppArmadilloEg.cpp -o RcppArmadilloEg.o |> |> |> |> So far so good: one -I for R as usual, one for Rcpp. |> |> |> |> | In file included from |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, |> |> | from |> |> | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, |> |> | from RcppArmadilloEg.cpp:1: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: |> |> | In function ?SEXPREC* |> |> Rcpp::internal::wrap_dispatch_unknown_iterable(const |> |> | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: |> |> | instantiated from ?SEXPREC* |> Rcpp::internal::wrap_dispatch_unknown(const |> |> T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: |> |> | instantiated from ?SEXPREC* |> |> | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: |> |> | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, |> |> | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: |> |> | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = |> |> | arma::Col<double>]? |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: |> |> | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) |> [with |> |> T |> |> | = arma::colvec]? |> |> | RcppArmadilloEg.cpp:19: instantiated from here |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: |> |> | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in |> |> | initialization |> |> | make: *** [RcppArmadilloEg.o] Error 1 |> |> | |> |> | |> |> | could someone provide some advice? |> |> |> |> Which Rcpp version do you have installed? |> |> |> |> Which Armadillo version do you have installed? |> |> |> |> I have not tried the free-floating direct compile you try here. Maybe |> the |> |> defines for RcppArmadillo that we use are missing here -- hard to say. |> |> |> |> Could you try to create your own little package but copying the |> |> RcppArmadillo |> |> files, changes DESCRIPTION to what you do and changes the FastLM code |> in |> |> C++ |> |> and R? |> |> |> |> Dirk |> |> |> |> -- |> |> Registration is open for the 2nd International conference R / Finance |> 2010 |> |> See http://www.RinFinance.com for details, and see you in Chicago in |> |> April! |> |> |> |> -- |> Registration is open for the 2nd International conference R / Finance |> 2010 |> See http://www.RinFinance.com for details, and see you in Chicago in |> April! |> -- Registration is open for the 2nd International conference R / Finance 2010 See http://www.RinFinance.com for details, and see you in Chicago in April!
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100331/a0f58274/attachment-0001.htm
On Tue, Mar 30, 2010 at 9:12 AM, Romain Francois
<romain at r-enthusiasts.com> wrote:
Le 30/03/10 15:36, Douglas Bates a ?crit :
On Tue, Mar 30, 2010 at 1:15 AM, Romain Francois <romain at r-enthusiasts.com> ?wrote:
Hi,
If you want to compile the code that is here http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this:
romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e "RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp
The way that RcppArmadillo:::LdFlags() is currently defined there is a
possibility of getting different Lapack and BLAS libraries when using
R or calls to RcppArmadillo. ?R uses the libraries defined by the
macros LAPACK_LIBS, BLAS_LIBS and FLIBS in the file
file.path(R.home("etc"), "Makeconf") ?# evaluate this in R
It is not certain that those will be the same as the libraries used by
Armadillo. ?If they are not shared objects you run the risk of getting
two copies of Lapack, etc. ?and possibly different BLAS, leading to
different performance characteristics and perhaps different results.
Hmmm. Interesting. I did not think of that problem. On my machine, I have : Rscript -e "RcppArmadillo:::LdFlags()" /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/usr/lib -larmadillo so linking against Rcpp "user" library and armadillo... but when I manually set PKG_LIBS to just Rcpp user library, it still works, so we actually do not need to link against armadillo library. armadillo itself does not __need__ to get compiled into a library because it is all templates.
I'm pretty sure that Dirk's FastLM test would fail if you did not link to -larmadillo library (and thence to -llapack and -lblas). Dirk uses things like an inv method for a matrix and that will eventually call Lapack routines. I haven't looked at the code for Armadillo but I did check that the armadillo library links to the lapack and blas libraries. $ ldd /usr/lib/libarmadillo.so linux-vdso.so.1 => (0x00007fffaf7ff000) libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007f01e5593000) liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007f01e49a0000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f01e468f000) libm.so.6 => /lib/libm.so.6 (0x00007f01e440b000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f01e41f4000) libc.so.6 => /lib/libc.so.6 (0x00007f01e3e84000) libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f01e3b98000) /lib64/ld-linux-x86-64.so.2 (0x00007f01e5a41000)
I would however strongly recommend you to have this in a package. Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. ?The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. ?but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. ?And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. ?but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. ?which means that somehow, armadillo is giving problems. ?but that is as far as i can understand. ?either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> ?wrote: ? ? ?On 26 March 2010 at 15:32, Abhisek wrote: ? ? ?| Hi Dirk, ? ? ?| ? ? ?| Just so that I understand. ?I copied the code in the RcppArmadillo ? ? ?section ? ? ?| on your website and pasted and saved it. ? ? ?What code? What page? ? ? ?| Are you saying I should change ? ? ?| #include<RcppArmadillo> ?to #include<Rcpp> ?and #include<armadillo> ?? ? ? ?No that is not what I said. ?I said ? ? ? ? ?You can't just look at FastLM() and think your code will run ? ? ?like it. ? ? ? ? ?RcppArmadillo __does not export its classes__. ?It is an ? ? ?implementation ? ? ? ? ?reference -- it gives you guidance as to how to implement C++ ? ? ?packages of ? ? ? ? ?your own against other libraries. ? ? ? ? ?If you "just" want to use Armadillo and have Rcpp help you, look ? ? ?at the ? ? ? ? ?installed example 'FastLM' in the Rcpp package. ?In other words ? ? ?ignore ? ? ? ? ?RcppArmadillo for now. ? ? ?So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. ? ? ? ?Run ? ? ? ? ?fastLMviaArmadillo.r ? ? ?and look at it. That should work. ? ? ?You can also look at the _entire RcppArmadillo package_ and see how the ? ? ?pieces fit together, including src/Makevars. ? ? ?But don't just take semi-random shortcuts and expect that to work. If we ? ? ?could make it any simpler, we would. ?There is a reason RcppArmadilli is ? ? ?package and not just a file. ? ? ?Dirk ? ? ?| best, ? ? ?| abhisek ? ? ?| ? ? ?| On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel<edd at debian.org ? ? ?<mailto:edd at debian.org>> ?wrote: ? ? ?| ? ? ?|> ? ? ?|> ?Hi Abhisek, ? ? ?|> ? ? ?|> ?On 26 March 2010 at 12:28, Abhisek wrote: ? ? ?|> ?| I downloaded the stuff just last friday so it should be the latest ? ? ?|> ?version ? ? ?|> ?| of Rcpp as well as Armadillo. ?I used install.packages() for ? ? ?Rcpp and ? ? ?|> ?| RcppArmadillo. ?Armadillo is 0.9.4. ?Im using xubuntu karmic ? ? ?koala. ? ? ?|> ? ? ?|> ?Ok, that is all good. ?And if RcppArmadillo installed you have ? ? ?proper ? ? ?|> ?libraries, Armadillo included. ? ? ?|> ? ? ?|> ?I think part of your problem is a misunderstanding of an issue ? ? ?we may not ? ? ?|> ?have made particularly clear: ?You can't just look at FastLM() ? ? ?and think ? ? ?|> ?your code will run like it. ?RcppArmadillo __does not export its ? ? ?classes__. ? ? ?|> ?It is an implementation reference -- it gives you guidance as to ? ? ?how to ? ? ?|> ?implement C++ packages of your own against other libraries. ? ? ?|> ? ? ?|> ?If you "just" want to use Armadillo and have Rcpp help you, look ? ? ?at the ? ? ?|> ?installed example 'FastLM' in the Rcpp package. ?In other words ? ? ?ignore ? ? ?|> ?RcppArmadillo for now. ? ? ?|> ? ? ?|> ?The example (in 0.7.10) uses an idiom we no longer like and I am ? ? ?about to ? ? ?|> ?change that for an upcoming 0.7.11 release, but it should works ? ? ?as is and ? ? ?|> ?just use inline -- so no messing with makefile etc. ? ? ?|> ? ? ?|> ?Try that and see how it goes and keep us posted. ? ? ?|> ? ? ?|> ?Cheers, Dirk ? ? ?|> ? ? ?|> ? ? ?|> ?| i also had some problem using Armadillo which I posted on the ? ? ?Armadillo ? ? ?|> ?| discussion board. ?Conrad got back to me. ?Here is the discussion: ? ? ?|> ?| https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 ? ? ?<https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> ? ? ?|> ?| ? ? ?|> ?| so it may be that armadillo is the problem but im really not sure. ? ? ?|> ?| ? ? ?|> ?| Many thanks ? ? ?|> ?| Abhisek ? ? ?|> ?| ? ? ?|> ?| On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel ? ? ?<edd at debian.org<mailto:edd at debian.org>> ? ? ?|> ?wrote: ? ? ?|> ?| ? ? ?|> ?|> ? ? ?|> ?|> ?(resending, this time to list I omitted last time, sorry. ? ? ?--Dirk) ? ? ?|> ?|> ? ? ?|> ?|> ?On 26 March 2010 at 11:10, Abhisek wrote: ? ? ?|> ?|> ?| Hi, ? ? ?|> ?|> ?| ? ? ?|> ?|> ?| Ive been trying to make RcppArmadillo work using the ? ? ?example file ? ? ?|> ?|> ?(fastLM). ? ? ?|> ?|> ?| I copied and pasted the code and saved it as ? ? ?RcppArmadilloEg.cpp (not ? ? ?|> ?to ? ? ?|> ?|> ?use ? ? ?|> ?|> ?| fastLM but to figure out how to work RcppArmadillo). ?Then ? ? ?i tried ? ? ?|> ?using ? ? ?|> ?|> ?the ? ? ?|> ?|> ?| command R CMD SHLIB RcppArmadilloEg.cpp but an error came ? ? ?up saying ? ? ?|> ?that ? ? ?|> ?|> ?| RcppArmadillo.h not found. ? ? ?|> ?|> ?| ? ? ?|> ?|> ?| So i tried doing a symbolic link from /usr/local/include ? ? ?to the ? ? ?|> ?directory ? ? ?|> ?|> ?| where RcppArmadillo.h and RcppArmadilloDefines.h is ? ? ?stored. ?I also ? ? ?|> ?did a ? ? ?|> ?|> ?| symbolic link analogously for RcppArmadillo.so. ?When i ? ? ?ran R CMD ? ? ?|> ?SHLIB ? ? ?|> ?|> ?| again I got the following error: ? ? ?|> ?|> ?| ? ? ?|> ?|> ?| abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB ? ? ?|> ?RcppArmadilloEg.cpp ? ? ?|> ?|> ?| g++ -I/usr/share/R/include ? ? ?|> ?|> ?| -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib ? ? ?-fpic ?-g ? ? ?|> ?-O2 ? ? ?|> ?|> ?-c ? ? ?|> ?|> ?| RcppArmadilloEg.cpp -o RcppArmadilloEg.o ? ? ?|> ?|> ? ? ?|> ?|> ?So far so good: ?one -I for R as usual, one for Rcpp. ? ? ?|> ?|> ? ? ?|> ?|> ?| In file included from ? ? ?|> ?|> ?| ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, ? ? ?|> ?|> ?| ? ? ? ? ? ? ? ? ?from ? ? ?|> ?|> ?| ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, ? ? ?|> ?|> ?| ? ? ? ? ? ? ? ? ?from RcppArmadilloEg.cpp:1: ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: ? ? ?|> ?|> ?| In function ?SEXPREC* ? ? ?|> ?|> ?Rcpp::internal::wrap_dispatch_unknown_iterable(const ? ? ?|> ?|> ?| T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: ? ? ?|> ?|> ?| instantiated from ?SEXPREC* ? ? ?|> ?Rcpp::internal::wrap_dispatch_unknown(const ? ? ?|> ?|> ?T&, ? ? ?|> ?|> ?| Rcpp::traits::false_type) [with T = arma::Col<double>]? ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: ? ? ?|> ?|> ?| instantiated from ?SEXPREC* ? ? ?|> ?|> ?| Rcpp::internal::wrap_dispatch_unknown_importable(const T&, ? ? ?|> ?|> ?| Rcpp::traits::false_type) [with T = arma::Col<double>]? ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: ? ? ?|> ?|> ?| instantiated from ?SEXPREC* ? ? ?Rcpp::internal::wrap_dispatch(const T&, ? ? ?|> ?|> ?| Rcpp::traits::wrap_type_unknown_tag) [with T = ? ? ?arma::Col<double>]? ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: ? ? ?|> ?|> ?| instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = ? ? ?|> ?|> ?| arma::Col<double>]? ? ? ?|> ?|> ?| ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: ? ? ?|> ?|> ?| instantiated from ?Rcpp::Named::Named(const std::string&, ? ? ?const T&) ? ? ?|> ?[with ? ? ?|> ?|> ?T ? ? ?|> ?|> ?| = arma::colvec]? ? ? ?|> ?|> ?| RcppArmadilloEg.cpp:19: ? instantiated from here ? ? ?|> ?|> ?| ? ? ?|> ?|> ? ? ?|> ? ? ?/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: ? ? ?|> ?|> ?| error: cannot convert ?const arma::Col<double>? to ? ? ??SEXPREC*? in ? ? ?|> ?|> ?| initialization ? ? ?|> ?|> ?| make: *** [RcppArmadilloEg.o] Error 1 ? ? ?|> ?|> ?| ? ? ?|> ?|> ?| ? ? ?|> ?|> ?| could someone provide some advice? ? ? ?|> ?|> ? ? ?|> ?|> ?Which Rcpp version do you have installed? ? ? ?|> ?|> ? ? ?|> ?|> ?Which Armadillo version do you have installed? ? ? ?|> ?|> ? ? ?|> ?|> ?I have not tried the free-floating direct compile you try ? ? ?here. ?Maybe ? ? ?|> ?the ? ? ?|> ?|> ?defines for RcppArmadillo that we use are missing here -- ? ? ?hard to say. ? ? ?|> ?|> ? ? ?|> ?|> ?Could you try to create your own little package but copying the ? ? ?|> ?|> ?RcppArmadillo ? ? ?|> ?|> ?files, changes DESCRIPTION to what you do and changes the ? ? ?FastLM code ? ? ?|> ?in ? ? ?|> ?|> ?C++ ? ? ?|> ?|> ?and R? ? ? ?|> ?|> ? ? ?|> ?|> ?Dirk ? ? ?|> ?|> ? ? ?|> ?|> ?-- ? ? ?|> ?|> ? ?Registration is open for the 2nd International conference R ? ? ?/ Finance ? ? ?|> ?2010 ? ? ?|> ?|> ? ?See http://www.RinFinance.com for details, and see you in ? ? ?Chicago in ? ? ?|> ?|> ?April! ? ? ?|> ?|> ? ? ?|> ? ? ?|> ?-- ? ? ?|> ? ? Registration is open for the 2nd International conference R / ? ? ?Finance ? ? ?|> ?2010 ? ? ?|> ? ?See http://www.RinFinance.com for details, and see you in ? ? ?Chicago in ? ? ?|> ?April! ? ? ?|> ? ? ?-- ? ? ? ?Registration is open for the 2nd International conference R / ? ? ?Finance 2010 ? ? ? ?See http://www.RinFinance.com for details, and see you in Chicago ? ? ?in April!
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5
_______________________________________________ Rcpp-devel mailing list Rcpp-devel at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Le 31/03/10 15:25, Douglas Bates a ?crit :
On Tue, Mar 30, 2010 at 9:12 AM, Romain Francois <romain at r-enthusiasts.com> wrote:
Le 30/03/10 15:36, Douglas Bates a ?crit :
On Tue, Mar 30, 2010 at 1:15 AM, Romain Francois <romain at r-enthusiasts.com> wrote:
Hi,
If you want to compile the code that is here http://dirk.eddelbuettel.com/code/rcpp.armadillo.html directly from R CMD SHLIB, you can do this:
romain at naxos /tmp $ export PKG_CXXFLAGS=`Rscript -e "RcppArmadillo:::CxxFlags()"` romain at naxos /tmp $ export PKG_LIBS=`Rscript -e "RcppArmadillo:::LdFlags()"` romain at naxos /tmp $ R CMD SHLIB armaex.cpp
The way that RcppArmadillo:::LdFlags() is currently defined there is a
possibility of getting different Lapack and BLAS libraries when using
R or calls to RcppArmadillo. R uses the libraries defined by the
macros LAPACK_LIBS, BLAS_LIBS and FLIBS in the file
file.path(R.home("etc"), "Makeconf") # evaluate this in R
It is not certain that those will be the same as the libraries used by
Armadillo. If they are not shared objects you run the risk of getting
two copies of Lapack, etc. and possibly different BLAS, leading to
different performance characteristics and perhaps different results.
Hmmm. Interesting. I did not think of that problem. On my machine, I have : Rscript -e "RcppArmadillo:::LdFlags()" /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a -L/usr/lib -larmadillo so linking against Rcpp "user" library and armadillo... but when I manually set PKG_LIBS to just Rcpp user library, it still works, so we actually do not need to link against armadillo library. armadillo itself does not __need__ to get compiled into a library because it is all templates.
I'm pretty sure that Dirk's FastLM test would fail if you did not link to -larmadillo library (and thence to -llapack and -lblas). Dirk uses things like an inv method for a matrix and that will eventually call Lapack routines. I haven't looked at the code for Armadillo but I did check that the armadillo library links to the lapack and blas libraries. $ ldd /usr/lib/libarmadillo.so linux-vdso.so.1 => (0x00007fffaf7ff000) libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007f01e5593000) liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007f01e49a0000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f01e468f000) libm.so.6 => /lib/libm.so.6 (0x00007f01e440b000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f01e41f4000) libc.so.6 => /lib/libc.so.6 (0x00007f01e3e84000) libgfortran.so.3 => /usr/lib/libgfortran.so.3 (0x00007f01e3b98000) /lib64/ld-linux-x86-64.so.2 (0x00007f01e5a41000)
I've attached an R file that contains the code that is on Dirk's
RcppArmadillo page. The file compiles, links and load the code and run
the function. (similar to what inline does but inline does not work here
because it includes Rcpp.h too early, that's another story)
The key thing is that this is not linking against armadillo library or
blas or lapack. I suppose the blas functions are retrieved from R's blas
and lapack.
$ Rscript armaex.R
Le chargement a n?cessit? le package : inline
Le chargement a n?cessit? le package : methods
Le chargement a n?cessit? le package : Rcpp
g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/x86_64
-I/usr/local/include
-I/Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64
-I/Library/Frameworks/R.framework/Resources/library/RcppArmadillo/include -I/usr/include
-fPIC -g -O3 -Wall -pipe -Wno-variadic-macros -c armaex.cpp -o armaex.o
g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names
-undefined dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o armaex.so armaex.o
/Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
$coefficients
[,1]
[1,] -2.353325
[2,] 2.199970
$stderr
[,1]
[1,] 0.23066284
[2,] 0.08983455
(on OSX I need to use otool instead of ldd for some reason: )
$ otool -L armaex.so
armaex.so:
armaex.so (compatibility version 0.0.0, current version 0.0.0)
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libR.dylib
(compatibility version 2.11.0, current version 2.11.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.13.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.9.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.0.0)
and :
$ otool -L
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libR.dylib
/lib/libR.dylib
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libR.dylib:
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libR.dylib
(compatibility version 2.11.0, current version 2.11.0)
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libRblas.dylib (compatibility version 0.0.0, current version 0.0.0)
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libgfortran.2.dylib (compatibility version 3.0.0, current version 3.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 476.19.0)
/Library/Frameworks/R.framework/Versions/2.11/Resources/lib/libreadline.5.2.dylib (compatibility version 5.0.0, current version 5.2.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current
version 36.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.1.4)
/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version
7.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version
1.0.0)
so I suppose the reason why this works here is that blas and lapack from
R are used.
Maybe we should remove the -L/usr/lib -larmadillo business in
RcppArmadillo so that there is no confusion. We used to compile the
package just fine without them, I think Dirk added the flags for some
windows related reason.
I would however strongly recommend you to have this in a package. Romain Le 26/03/10 19:00, Abhisek a ?crit :
Hi Dirk, I was referring to this page: http://dirk.eddelbuettel.com/code/rcpp.armadillo.html i was trying to run the code there. here is my understanding so far (im new to linux and c++ so i apologize for seeming rather slow!): 1. The Rcpp package helps C++ and R recognize each others stuff (like variables). 2. The RcppArmadillo package extends this functionality to objects used in armadillo (such as matrices and vectors e.g. colvec). 3. In FastLM, armadillo is being included but not RcppArmadillo. but that is ok because there is a loop in there which converts an vector as defined in armadillo to one which Rcpp recognizes. And it is this vector which which gets passed back to R through the Rcpp interface. also, it uses cfunction which is different from what im doing here as i think you mentioned earlier (it worked by the way!) what i tried to do was as follows: a) to run the code as in the link above and include Rcpp and RcppArmadillo and I was getting the errors as described in my initial post. b) then i tried the same code but only including Rcpp and armadillo. if my reasoning above is correct, part (b) should not run as Rcpp would not recognize stuff like arma::colvec. but, i get the exact same error as above! so that suggests, that while compiling the code, the compiler is not even getting to the point in procedure b when it should encounters an type it doesnt recognize. which means that somehow, armadillo is giving problems. but that is as far as i can understand. either that or my understanding is way off. appreciate your patience and help! abhisek On Fri, Mar 26, 2010 at 4:20 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: On 26 March 2010 at 15:32, Abhisek wrote: | Hi Dirk, | | Just so that I understand. I copied the code in the RcppArmadillo section | on your website and pasted and saved it. What code? What page? | Are you saying I should change | #include<RcppArmadillo> to #include<Rcpp> and #include<armadillo> ? No that is not what I said. I said You can't just look at FastLM() and think your code will run like it. RcppArmadillo __does not export its classes__. It is an implementation reference -- it gives you guidance as to how to implement C++ packages of your own against other libraries. If you "just" want to use Armadillo and have Rcpp help you, look at the installed example 'FastLM' in the Rcpp package. In other words ignore RcppArmadillo for now. So look at /usr/local/lib/Rcpp/examples/FastLM/ and the files there. Run fastLMviaArmadillo.r and look at it. That should work. You can also look at the _entire RcppArmadillo package_ and see how the pieces fit together, including src/Makevars. But don't just take semi-random shortcuts and expect that to work. If we could make it any simpler, we would. There is a reason RcppArmadilli is package and not just a file. Dirk | best, | abhisek | | On Fri, Mar 26, 2010 at 1:40 PM, Dirk Eddelbuettel<edd at debian.org <mailto:edd at debian.org>> wrote: | |> |> Hi Abhisek, |> |> On 26 March 2010 at 12:28, Abhisek wrote: |> | I downloaded the stuff just last friday so it should be the latest |> version |> | of Rcpp as well as Armadillo. I used install.packages() for Rcpp and |> | RcppArmadillo. Armadillo is 0.9.4. Im using xubuntu karmic koala. |> |> Ok, that is all good. And if RcppArmadillo installed you have proper |> libraries, Armadillo included. |> |> I think part of your problem is a misunderstanding of an issue we may not |> have made particularly clear: You can't just look at FastLM() and think |> your code will run like it. RcppArmadillo __does not export its classes__. |> It is an implementation reference -- it gives you guidance as to how to |> implement C++ packages of your own against other libraries. |> |> If you "just" want to use Armadillo and have Rcpp help you, look at the |> installed example 'FastLM' in the Rcpp package. In other words ignore |> RcppArmadillo for now. |> |> The example (in 0.7.10) uses an idiom we no longer like and I am about to |> change that for an upcoming 0.7.11 release, but it should works as is and |> just use inline -- so no messing with makefile etc. |> |> Try that and see how it goes and keep us posted. |> |> Cheers, Dirk |> |> |> | i also had some problem using Armadillo which I posted on the Armadillo |> | discussion board. Conrad got back to me. Here is the discussion: |> | https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4 <https://sourceforge.net/apps/phpbb/arma/viewtopic.php?f=1&t=4> |> | |> | so it may be that armadillo is the problem but im really not sure. |> | |> | Many thanks |> | Abhisek |> | |> | On Fri, Mar 26, 2010 at 12:17 PM, Dirk Eddelbuettel <edd at debian.org<mailto:edd at debian.org>> |> wrote: |> | |> |> |> |> (resending, this time to list I omitted last time, sorry. --Dirk) |> |> |> |> On 26 March 2010 at 11:10, Abhisek wrote: |> |> | Hi, |> |> | |> |> | Ive been trying to make RcppArmadillo work using the example file |> |> (fastLM). |> |> | I copied and pasted the code and saved it as RcppArmadilloEg.cpp (not |> to |> |> use |> |> | fastLM but to figure out how to work RcppArmadillo). Then i tried |> using |> |> the |> |> | command R CMD SHLIB RcppArmadilloEg.cpp but an error came up saying |> that |> |> | RcppArmadillo.h not found. |> |> | |> |> | So i tried doing a symbolic link from /usr/local/include to the |> directory |> |> | where RcppArmadillo.h and RcppArmadilloDefines.h is stored. I also |> did a |> |> | symbolic link analogously for RcppArmadillo.so. When i ran R CMD |> SHLIB |> |> | again I got the following error: |> |> | |> |> | abhisek at shieks:~/Desktop/Personal/Test$ R CMD SHLIB |> RcppArmadilloEg.cpp |> |> | g++ -I/usr/share/R/include |> |> | -I/home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib -fpic -g |> -O2 |> |> -c |> |> | RcppArmadilloEg.cpp -o RcppArmadilloEg.o |> |> |> |> So far so good: one -I for R as usual, one for Rcpp. |> |> |> |> | In file included from |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/RcppCommon.h:215, |> |> | from |> |> | /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp.h:28, |> |> | from RcppArmadilloEg.cpp:1: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h: |> |> | In function ?SEXPREC* |> |> Rcpp::internal::wrap_dispatch_unknown_iterable(const |> |> | T&, Rcpp::traits::false_type) [with T = arma::Col<double>]?: |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:491: |> |> | instantiated from ?SEXPREC* |> Rcpp::internal::wrap_dispatch_unknown(const |> |> T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:509: |> |> | instantiated from ?SEXPREC* |> |> | Rcpp::internal::wrap_dispatch_unknown_importable(const T&, |> |> | Rcpp::traits::false_type) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:526: |> |> | instantiated from ?SEXPREC* Rcpp::internal::wrap_dispatch(const T&, |> |> | Rcpp::traits::wrap_type_unknown_tag) [with T = arma::Col<double>]? |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:541: |> |> | instantiated from ?SEXPREC* Rcpp::wrap(const T&) [with T = |> |> | arma::Col<double>]? |> |> | |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/Named.h:54: |> |> | instantiated from ?Rcpp::Named::Named(const std::string&, const T&) |> [with |> |> T |> |> | = arma::colvec]? |> |> | RcppArmadilloEg.cpp:19: instantiated from here |> |> | |> |> |> /home/abhisek/R/i486-pc-linux-gnu-library/2.10/Rcpp/lib/Rcpp/internal/wrap.h:394: |> |> | error: cannot convert ?const arma::Col<double>? to ?SEXPREC*? in |> |> | initialization |> |> | make: *** [RcppArmadilloEg.o] Error 1 |> |> | |> |> | |> |> | could someone provide some advice? |> |> |> |> Which Rcpp version do you have installed? |> |> |> |> Which Armadillo version do you have installed? |> |> |> |> I have not tried the free-floating direct compile you try here. Maybe |> the |> |> defines for RcppArmadillo that we use are missing here -- hard to say. |> |> |> |> Could you try to create your own little package but copying the |> |> RcppArmadillo |> |> files, changes DESCRIPTION to what you do and changes the FastLM code |> in |> |> C++ |> |> and R? |> |> |> |> Dirk |> |>
Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: armaex.R Url: http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20100331/ed2eb227/attachment-0001.txt