Re: [Rcpp-devel] RcppArmadillo fails on FreeBSD

2011-05-31 Thread Rainer Hurling

Am 30.05.2011 18:21 (UTC+1) schrieb Dirk Eddelbuettel:


On 30 May 2011 at 17:21, Rainer Hurling wrote:
|  I do not understand what you are asking: as meant in RcppArmadilloConfig ?
|  Neither Romain, Doug nor I use a *BSD variant (if we ignore OS X as a 
BSD-derivative).
|  So nothing in RcppArmadillo explicitly enables or disables *BSD.
|
| Thanks for answering. Sorry for my bad english and the misunderstanding.
| I am not a developer so the following is just a wild guess:
|
| In FreeBSD there is a function snprintf in stdio of libc. I was
| wondering if this could be the function, which RcppArmadillo would
| expect to find (on linux etc.) at std:snprintf?
|
| If yes, is there some chance to use this type of snprintf on FreeBSD
| systems? Or is my below patch ok and there is no problem not using
| snprintf (on FreeBSD) at all?
|
| Hope this is not totally nonsense.

Between you and me, somebody is confused.


It's me, I am afraid ;-)


snprintf is a standard C library function going (IIRC) back to Kernighan and
Ritchie. My system's manual page shows

int snprintf(char *str, size_t size, const char *format, ...);

which is the same as what you quoted:

int snprintf(char * restrict str, size_t size, const char * restrict 
format, ...);

apart from the sole difference of 'restrict' which I've never seen before.


I agree.


So per se, we should not need anything special to use snprintf.  Can you try
something like this on your box, please?

edd@max:/tmp$ gcc -Wall -o rainer rainer.c
edd@max:/tmp$ ./rainer
Char vector is now [Hello, world]
edd@max:/tmp$ cat rainer.c

#includestdio.h

int main(void) {
 char foo[32];
 snprintf(foo, 31, Hello, world);
 printf(Char vector is now [%s]\n, foo);
 return(0);
}
edd@max:/tmp$
I erroneously thought that '#undef ARMA_HAVE_STD_SNPRINTF' will stop 
using the systems snprintf.

./rainer
Char vector is now [Hello, world]

So it works as aspected.


We may have turned snprintf off for you by accident, but following your patch
we should now be good.


Dirk, sorry again for my misunderstanding. Yes, I also think that 
FreeBSD people could live with this patch.



Unless I am totally undercaffeinated and missing something here.


Thanks again for your patience and advice,
Rainer


Dirk

|  You have to tell us what works or doesn't. We cannot test or develop changes
|  for *BSD.
|
|  | Many thanks in advance,
|  | Rainer Hurling
|  |
|  | --
|  | --- inst/include/RcppArmadilloConfig.h.origin  2011-05-27 
17:18:47.0 +0200
|  | +++ inst/include/RcppArmadilloConfig.h 2011-05-30 13:53:25.0 +0200
|  | @@ -37,7 +37,7 @@
|  |
|  |
|  |  /* TODO: we might need to undef this on other platforms as well */
|  | -#if defined(__GNUC__)   defined(_WIN64)
|  | +#if defined(__GNUC__)   defined(_WIN64) || defined(__FreeBSD__)
|  |  #undef ARMA_HAVE_STD_SNPRINTF
|  |  #endif
|
|  That patch looks fine to me and would presumabky play nicely with Armadillo
|  as the change would be solely at our level.
|
|  I'll apply it it now, so 0.2.22 will have it.
|
| Thanks for including the patch,
| Rainer
|
|  Dirk


___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] package .onLoad multiple modules

2011-05-31 Thread Christian Gunning
On Tue, May 31, 2011 at 3:00 AM,
rcpp-devel-requ...@r-forge.wu-wien.ac.at wrote:
 When FALSE it does what you want.

I can't begin to describe how long I've waited for such a function.
-x


-- 
A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] package .onLoad multiple modules

2011-05-31 Thread romain

Le 31 mai 2011 à 13:11, Christian Gunning x...@unm.edu a écrit :

 On Tue, May 31, 2011 at 3:00 AM,
 rcpp-devel-requ...@r-forge.wu-wien.ac.at wrote:
 When FALSE it does what you want.
 
 I can't begin to describe how long I've waited for such a function.
 -x

:-)
Well it does what you want ... in this context...

It might not accomodate other needs you might have such as time travel, etc ...

 
 -- 
 A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Romain Francois
Works fine for me. Laurent, can you try with the current svn version of 
Rcpp.


svn checkout svn://svn.r-forge.r-project.org/svnroot/rcpp
cd rcpp/pkg
R CMD INSTALL Rcpp
Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
R CMD check anRpackage

Romain

Le 30/05/11 21:58, Romain Francois a écrit :

Le 28/05/11 04:04, Dirk Eddelbuettel a écrit :


Hi Laurent,

On 27 May 2011 at 17:17, Laurent Gatto wrote:
| Dear all,
|
| A basic packages with Rcpp modules produces the warning described
| below, that I would ideally, with your help, get rid of.
|
| Rscript -e require(Rcpp); Rcpp.package.skeleton(module=FALSE)
| R CMD check anRpackage
|
| produces obvious warnings related to badly formatted documentation and
| license. However
|
| Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
| R CMD check anRpackage
|
| produces this additional warning that puzzles me:
|
| [ ...checker output... ]
| * checking whether the name space can be loaded with stated
| dependencies ... WARNING
| Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
| call: value[[3L]](cond)
| error: failed to load module yada from package anRpackage
| Execution halted
|
| A namespace must be able to be loaded with just the base namespace
| loaded: otherwise if the namespace gets loaded by a saved object, the
| session will be unable to start.
|
| Probably some imports need to be declared in the NAMESPACE file.
| [ ...checker output...]
|
| I suspect this may be related to the yada module not being exposed and
| thus not available when the package is loaded. Any further explanation
| or hints would however be warmly appreciated.

I think you are pretty close. As I recall, this 'warning' has been a
bit of a
wart that won't quite go away. I just checked again what we do in the
unit
tests in file runit.Module.client.package.R: we build a package (ie
create a
tar.gz) and then install from it. That also triggers the warning, but
passes
it.

Romain may have more details about how this is related to module
initialization and startup.

Dirk


I'll have a go at installing a fresher R-devel and see what the next
move is. My guess is that R checks are tighter now.


|
| sessionInfo() is appended below.
|
| Thank you very much in advance.
|
| Best wishes,
|
| Laurent
|
|
| sessionInfo()
| R version 2.14.0 Under development (unstable) (2011-05-04 r55760)
| Platform: x86_64-unknown-linux-gnu (64-bit)
|
| locale:
| [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
| [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
| [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8
| [7] LC_PAPER=en_GB.utf8 LC_NAME=C
| [9] LC_ADDRESS=C LC_TELEPHONE=C
| [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
|
| attached base packages:
| [1] stats graphics grDevices utils datasets methods base
|
| other attached packages:
| [1] Rcpp_0.9.4.1






--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
http://romain-francois.com
|- http://bit.ly/hdKhCy : Rcpp article in JSS
|- http://bit.ly/elZJRJ : Montpellier Comedie Club - Avril 2011
`- http://bit.ly/fhqbRC : Rcpp workshop in Chicago on April 28th


___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


[Rcpp-devel] Fwd: problem with rmultinom function

2011-05-31 Thread s niani
-- Forwarded message --
From: s niani riahina...@gmail.com
Date: Mon, May 30, 2011 at 9:20 AM
Subject: problem with rmultinom function
To: rcpp-devel@lists.r-forge.r-project.org


Hi,
I sent this message a couple of days ago, but I haven't heard anything yet.
I think you didnt receive it, that's why I send it again.

I have a strange problem that I spent several days trying to fix it, but
unfortunately I wasn't able to catch it. I'm running the rcpp code for 3000
iterations(running the same code for 3000 times) on different datasets. but
for some datasets, in the final iterations (like 2667 th iteration) the code
stops running and it jumps out of the R environment. and if I run the same
code (without any changes) on the same dataset(still without any changes)
the problem might never happen and it goes to the last iteration without any
problem(or the problem may occur in another iteration). and the interesting
part is that error code is different each time, I got error codes like:

what():  invalid partial string match
what():  'prob' is missing
what():  unused argument(s) (environment)
and etc...
I'm pretty sure that problem occurs in the line of code that I am using
rmultinom function, but I included the necessary function
Function rmultinom = stats[rmultinom];

to be more clear I wrote a simple function and I attached it in this email.
in this code I didn't read any dataset, I just used some variables to define
the size of structures that I need to get from dataset. if you run the code
with these values for P, K, unum,qnum, the error occurs in the first 10
iterations, but If you change the values of those parameters to smaller
values, the error may never happen.
I tried to used an cpp implementation for rmultinom, it works but the
program would be as slow as R version.


do you have any idea why this problem occur? or did anybody ever have the
same problem or can give me some tips to fix it?

ps: all datasets are generated through the sampe process(with a single
simulation code)

Thanks
#include SamplingCode.h


int Cwhich(IntegerVector binVec){
  int vecsize = binVec.size();
  for ( int i =0; i  vecsize; i++)
if (binVec(i) == 1)
  return i;
  cout  soemthing went wrong, no value equal to one was found !  endl;
  return -1;
}

RcppExport SEXP doGibbs(SEXP RmaxItr){//doGibbs - function(Questions, K, P, gibbs.max.iter, Z.Q=NULL, Y.Q = NULL){

	Environment stats(package:stats); 
	Function rmultinom = stats[rmultinom];
	Rcpp::RNGScope scope;

//	Rcpp::List questions(Rquestions);
	
	unsigned int K =50;
	unsigned int P = 50;
	unsigned int maxItr = Rcpp::asint(RmaxItr);
	
	
	
	Rcpp::List ZQ;
	Rcpp::List YQ;


	unsigned int unum=300;
	coutunumendl;
	coutpoint1endl;
	for(unsigned itr=0; itr5000; itr++){
			coutitritrendl;
		for ( unsigned u=0; u  unum; u++) {
	
			Rcpp::List QZQ;
		
			unsigned qnum= 100;
			 
			 
			 YQ.insert(u, rep(0, qnum ));	

			for( unsigned q=0; qqnum; q++){
			
asRcpp::IntegerVector(YQ(u))(q) = Cwhich(rmultinom(1,1, rep(1.0/P,P) ));
		
unsigned qlength=200;
	
QZQ.insert(q, rep(0, qlength ));
for( unsigned n=0; nqlength; n++){   
	
		asRcpp::IntegerVector(QZQ(q))(n)= Cwhich(rmultinom(1,1, rep(1.0/K,K) ));	
}
			}
			ZQ.insert(u, QZQ);
		}

}
}


#ifndef _CQA_H
#define _CQA_H

#include Rcpp.h
#include vector
#include list

using namespace Rcpp;
using namespace std;

/*
 * note : RcppExport is an alias to `extern C` defined by Rcpp.
 *
 * It gives C calling convention to the rcpp_hello_world function so that 
 * it can be called from .Call in R. Otherwise, the C++ compiler mangles the 
 * name of the function and .Call can't find it.
 *
 * It is only useful to use RcppExport when the function is intended to be called
 * by .Call. See the thread http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672
 * on Rcpp-devel for a misuse of RcppExport
 */
RcppExport SEXP doGibbs(SEXP RmaxItr);
#endif

___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Laurent Gatto
Dear Romain,

On 31 May 2011 13:34, Romain Francois rom...@r-enthusiasts.com wrote:
 Works fine for me. Laurent, can you try with the current svn version of
 Rcpp.

 svn checkout svn://svn.r-forge.r-project.org/svnroot/rcpp
 cd rcpp/pkg
 R CMD INSTALL Rcpp
 Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
 R CMD check anRpackage

Warning still there, although possibly with a hint:

* checking whether the name space can be loaded with stated
dependencies ... WARNING
Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
  call: value[[3L]](cond)
  error: failed to load module yada from package anRpackage
could not find function getClass
Execution halted

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.

I also updated R-devel; session information is:

R version 2.14.0 Under development (unstable) (2011-05-30 r56024)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C
 [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
 [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8
 [7] LC_PAPER=CLC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] methods   stats graphics  grDevices utils datasets  base

other attached packages:
[1] Rcpp_0.9.4.2


Note that I observed this warning while working on a 'real' package.
In the hope to track its origin down and provide a reproducible
example, I realised that the warning also came up with the standard
Rcpp.package.skeleton output, which ended up in this thread. However,
to my surprise (and embarrassment), I do not have the warning in the
original package any more (whether with Rcpp 0.9.4.2 or 0.9.4.1). I
tried to revert some of the changes I did (moving Rcpp from Depends to
Imports for instance, removing the import(Rcpp) statement in the
NAMESPACE file,...) but without any success.

Not sure I am of any help here...

Best wishes,

Laurent


 Romain

 Le 30/05/11 21:58, Romain Francois a écrit :

 Le 28/05/11 04:04, Dirk Eddelbuettel a écrit :

 Hi Laurent,

 On 27 May 2011 at 17:17, Laurent Gatto wrote:
 | Dear all,
 |
 | A basic packages with Rcpp modules produces the warning described
 | below, that I would ideally, with your help, get rid of.
 |
 | Rscript -e require(Rcpp); Rcpp.package.skeleton(module=FALSE)
 | R CMD check anRpackage
 |
 | produces obvious warnings related to badly formatted documentation and
 | license. However
 |
 | Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
 | R CMD check anRpackage
 |
 | produces this additional warning that puzzles me:
 |
 | [ ...checker output... ]
 | * checking whether the name space can be loaded with stated
 | dependencies ... WARNING
 | Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
 | call: value[[3L]](cond)
 | error: failed to load module yada from package anRpackage
 | Execution halted
 |
 | A namespace must be able to be loaded with just the base namespace
 | loaded: otherwise if the namespace gets loaded by a saved object, the
 | session will be unable to start.
 |
 | Probably some imports need to be declared in the NAMESPACE file.
 | [ ...checker output...]
 |
 | I suspect this may be related to the yada module not being exposed and
 | thus not available when the package is loaded. Any further explanation
 | or hints would however be warmly appreciated.

 I think you are pretty close. As I recall, this 'warning' has been a
 bit of a
 wart that won't quite go away. I just checked again what we do in the
 unit
 tests in file runit.Module.client.package.R: we build a package (ie
 create a
 tar.gz) and then install from it. That also triggers the warning, but
 passes
 it.

 Romain may have more details about how this is related to module
 initialization and startup.

 Dirk

 I'll have a go at installing a fresher R-devel and see what the next
 move is. My guess is that R checks are tighter now.

 |
 | sessionInfo() is appended below.
 |
 | Thank you very much in advance.
 |
 | Best wishes,
 |
 | Laurent
 |
 |
 | sessionInfo()
 | R version 2.14.0 Under development (unstable) (2011-05-04 r55760)
 | Platform: x86_64-unknown-linux-gnu (64-bit)
 |
 | locale:
 | [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
 | [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
 | [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8
 | [7] LC_PAPER=en_GB.utf8 LC_NAME=C
 | [9] LC_ADDRESS=C LC_TELEPHONE=C
 | [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
 |
 | attached base packages:
 | [1] stats graphics grDevices utils datasets methods base
 |
 | other attached packages:
 | [1] Rcpp_0.9.4.1




 --
 Romain Francois
 Professional R Enthusiast
 +33(0) 6 28 91 30 30
 http://romainfrancois.blog.free.fr
 http://romain-francois.com
 |- http://bit.ly/hdKhCy : Rcpp article in JSS
 

Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Romain Francois

I'm using the same versions and I don't get the problem.

getClass is in methods, and Rcpp does have

import(methods)

in its NAMESPACE file.

Maybe this means that the client package also needs it. not sure.

Le 31/05/11 19:55, Laurent Gatto a écrit :

Dear Romain,

On 31 May 2011 13:34, Romain Francoisrom...@r-enthusiasts.com  wrote:

Works fine for me. Laurent, can you try with the current svn version of
Rcpp.

svn checkout svn://svn.r-forge.r-project.org/svnroot/rcpp
cd rcpp/pkg
R CMD INSTALL Rcpp
Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
R CMD check anRpackage


Warning still there, although possibly with a hint:

* checking whether the name space can be loaded with stated
dependencies ... WARNING
Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
   call: value[[3L]](cond)
   error: failed to load module yada from package anRpackage
could not find function getClass
Execution halted

A namespace must be able to be loaded with just the base namespace
loaded: otherwise if the namespace gets loaded by a saved object, the
session will be unable to start.

Probably some imports need to be declared in the NAMESPACE file.

I also updated R-devel; session information is:

R version 2.14.0 Under development (unstable) (2011-05-30 r56024)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_GB.utf8   LC_NUMERIC=C
  [3] LC_TIME=en_GB.utf8LC_COLLATE=en_GB.utf8
  [5] LC_MONETARY=en_GB.utf8LC_MESSAGES=en_GB.utf8
  [7] LC_PAPER=CLC_NAME=C
  [9] LC_ADDRESS=C  LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C

attached base packages:
[1] methods   stats graphics  grDevices utils datasets  base

other attached packages:
[1] Rcpp_0.9.4.2


Note that I observed this warning while working on a 'real' package.
In the hope to track its origin down and provide a reproducible
example, I realised that the warning also came up with the standard
Rcpp.package.skeleton output, which ended up in this thread. However,
to my surprise (and embarrassment), I do not have the warning in the
original package any more (whether with Rcpp 0.9.4.2 or 0.9.4.1). I
tried to revert some of the changes I did (moving Rcpp from Depends to
Imports for instance, removing the import(Rcpp) statement in the
NAMESPACE file,...) but without any success.

Not sure I am of any help here...

Best wishes,

Laurent



Romain

Le 30/05/11 21:58, Romain Francois a écrit :


Le 28/05/11 04:04, Dirk Eddelbuettel a écrit :


Hi Laurent,

On 27 May 2011 at 17:17, Laurent Gatto wrote:
| Dear all,
|
| A basic packages with Rcpp modules produces the warning described
| below, that I would ideally, with your help, get rid of.
|
| Rscript -e require(Rcpp); Rcpp.package.skeleton(module=FALSE)
| R CMD check anRpackage
|
| produces obvious warnings related to badly formatted documentation and
| license. However
|
| Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
| R CMD check anRpackage
|
| produces this additional warning that puzzles me:
|
| [ ...checker output... ]
| * checking whether the name space can be loaded with stated
| dependencies ... WARNING
| Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
| call: value[[3L]](cond)
| error: failed to load module yada from package anRpackage
| Execution halted
|
| A namespace must be able to be loaded with just the base namespace
| loaded: otherwise if the namespace gets loaded by a saved object, the
| session will be unable to start.
|
| Probably some imports need to be declared in the NAMESPACE file.
| [ ...checker output...]
|
| I suspect this may be related to the yada module not being exposed and
| thus not available when the package is loaded. Any further explanation
| or hints would however be warmly appreciated.

I think you are pretty close. As I recall, this 'warning' has been a
bit of a
wart that won't quite go away. I just checked again what we do in the
unit
tests in file runit.Module.client.package.R: we build a package (ie
create a
tar.gz) and then install from it. That also triggers the warning, but
passes
it.

Romain may have more details about how this is related to module
initialization and startup.

Dirk


I'll have a go at installing a fresher R-devel and see what the next
move is. My guess is that R checks are tighter now.


|
| sessionInfo() is appended below.
|
| Thank you very much in advance.
|
| Best wishes,
|
| Laurent
|
|
|  sessionInfo()
| R version 2.14.0 Under development (unstable) (2011-05-04 r55760)
| Platform: x86_64-unknown-linux-gnu (64-bit)
|
| locale:
| [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
| [3] LC_TIME=en_GB.utf8 LC_COLLATE=en_GB.utf8
| [5] LC_MONETARY=C LC_MESSAGES=en_GB.utf8
| [7] LC_PAPER=en_GB.utf8 LC_NAME=C
| [9] LC_ADDRESS=C LC_TELEPHONE=C
| [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C
|
| attached base packages:
| [1] stats graphics grDevices utils datasets methods base
|
| other attached packages:
| [1] Rcpp_0.9.4.1





Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Laurent Gatto
On 31 May 2011 20:11, Romain Francois rom...@r-enthusiasts.com wrote:
 I'm using the same versions and I don't get the problem.

 getClass is in methods, and Rcpp does have

 import(methods)

 in its NAMESPACE file.

 Maybe this means that the client package also needs it. not sure.

Yes, I am confused here...
Never mind. I will report back if I come up with helpful data, but in
the mean time, thank you for looking at it.

Best wishes,

Laurent

 Le 31/05/11 19:55, Laurent Gatto a écrit :

 Dear Romain,

 On 31 May 2011 13:34, Romain Francoisrom...@r-enthusiasts.com  wrote:

 Works fine for me. Laurent, can you try with the current svn version of
 Rcpp.

 svn checkout svn://svn.r-forge.r-project.org/svnroot/rcpp
 cd rcpp/pkg
 R CMD INSTALL Rcpp
 Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
 R CMD check anRpackage

 Warning still there, although possibly with a hint:

 * checking whether the name space can be loaded with stated
 dependencies ... WARNING
 Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
   call: value[[3L]](cond)
   error: failed to load module yada from package anRpackage
 could not find function getClass
 Execution halted

 A namespace must be able to be loaded with just the base namespace
 loaded: otherwise if the namespace gets loaded by a saved object, the
 session will be unable to start.

 Probably some imports need to be declared in the NAMESPACE file.

 I also updated R-devel; session information is:

 R version 2.14.0 Under development (unstable) (2011-05-30 r56024)
 Platform: x86_64-unknown-linux-gnu (64-bit)

 locale:
  [1] LC_CTYPE=en_GB.utf8       LC_NUMERIC=C
  [3] LC_TIME=en_GB.utf8        LC_COLLATE=en_GB.utf8
  [5] LC_MONETARY=en_GB.utf8    LC_MESSAGES=en_GB.utf8
  [7] LC_PAPER=C                LC_NAME=C
  [9] LC_ADDRESS=C              LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_GB.utf8 LC_IDENTIFICATION=C

 attached base packages:
 [1] methods   stats     graphics  grDevices utils     datasets  base

 other attached packages:
 [1] Rcpp_0.9.4.2


 Note that I observed this warning while working on a 'real' package.
 In the hope to track its origin down and provide a reproducible
 example, I realised that the warning also came up with the standard
 Rcpp.package.skeleton output, which ended up in this thread. However,
 to my surprise (and embarrassment), I do not have the warning in the
 original package any more (whether with Rcpp 0.9.4.2 or 0.9.4.1). I
 tried to revert some of the changes I did (moving Rcpp from Depends to
 Imports for instance, removing the import(Rcpp) statement in the
 NAMESPACE file,...) but without any success.

 Not sure I am of any help here...

 Best wishes,

 Laurent


 Romain

 Le 30/05/11 21:58, Romain Francois a écrit :

 Le 28/05/11 04:04, Dirk Eddelbuettel a écrit :

 Hi Laurent,

 On 27 May 2011 at 17:17, Laurent Gatto wrote:
 | Dear all,
 |
 | A basic packages with Rcpp modules produces the warning described
 | below, that I would ideally, with your help, get rid of.
 |
 | Rscript -e require(Rcpp); Rcpp.package.skeleton(module=FALSE)
 | R CMD check anRpackage
 |
 | produces obvious warnings related to badly formatted documentation
 and
 | license. However
 |
 | Rscript -e require(Rcpp); Rcpp.package.skeleton(module=TRUE)
 | R CMD check anRpackage
 |
 | produces this additional warning that puzzles me:
 |
 | [ ...checker output... ]
 | * checking whether the name space can be loaded with stated
 | dependencies ... WARNING
 | Error: .onLoad failed in loadNamespace() for ‘anRpackage’, details:
 | call: value[[3L]](cond)
 | error: failed to load module yada from package anRpackage
 | Execution halted
 |
 | A namespace must be able to be loaded with just the base namespace
 | loaded: otherwise if the namespace gets loaded by a saved object, the
 | session will be unable to start.
 |
 | Probably some imports need to be declared in the NAMESPACE file.
 | [ ...checker output...]
 |
 | I suspect this may be related to the yada module not being exposed
 and
 | thus not available when the package is loaded. Any further
 explanation
 | or hints would however be warmly appreciated.

 I think you are pretty close. As I recall, this 'warning' has been a
 bit of a
 wart that won't quite go away. I just checked again what we do in the
 unit
 tests in file runit.Module.client.package.R: we build a package (ie
 create a
 tar.gz) and then install from it. That also triggers the warning, but
 passes
 it.

 Romain may have more details about how this is related to module
 initialization and startup.

 Dirk

 I'll have a go at installing a fresher R-devel and see what the next
 move is. My guess is that R checks are tighter now.

 |
 | sessionInfo() is appended below.
 |
 | Thank you very much in advance.
 |
 | Best wishes,
 |
 | Laurent
 |
 |
 |  sessionInfo()
 | R version 2.14.0 Under development (unstable) (2011-05-04 r55760)
 | Platform: x86_64-unknown-linux-gnu (64-bit)
 |
 | locale:
 | [1] LC_CTYPE=en_GB.utf8 LC_NUMERIC=C
 | 

Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Dirk Eddelbuettel

On 31 May 2011 at 21:11, Romain Francois wrote:
| I'm using the same versions and I don't get the problem.

Really random guess: Could R 2.13 vs 2.14 have something to with it?
 
| getClass is in methods, and Rcpp does have
| 
| import(methods)
| 
| in its NAMESPACE file.
| 
| Maybe this means that the client package also needs it. not sure.

Dirk 

-- 
Gauss once played himself in a zero-sum game and won $50.
  -- #11 at http://www.gaussfacts.com
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] RcppArmadillo fails on FreeBSD

2011-05-31 Thread Dirk Eddelbuettel

On 31 May 2011 at 09:27, Rainer Hurling wrote:
| Dirk, sorry again for my misunderstanding.

No worries. I do appreciate how you (pretty much single-handedly) try to keep
R and its packages viable on your chosen platform.

| Yes, I also think that 
| FreeBSD people could live with this patch.

The patch currently says (and I now include the forward-looking comment :)

/* TODO: we might need to undef this on other platforms as well */
#if defined(__GNUC__)  defined(_WIN64) || defined(__FreeBSD__)
#undef ARMA_HAVE_STD_SNPRINTF
#endif


Would we need additional defines for NetBSD and/or OpenBSD?

Dirk

-- 
Gauss once played himself in a zero-sum game and won $50.
  -- #11 at http://www.gaussfacts.com
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] trans() changed in latest RcppArmadillo

2011-05-31 Thread baptiste auguie
Thanks so much, Conrad!

Best regards,

Baptiste

On 31 May 2011 23:37, Conrad Sand conradsand.r...@gmail.com wrote:
 I've found the cause of the issue (involves handling of small matrices).

 The fix is easy (and already done in the SVN repo), but I currently
 don't have the time to roll out another release.  I'll aim to release
 a fix on the weekend, which will also give me time to double-check if
 there is a problem in inv().

 In the meantime I recommend sticking to the previous version of
 Armadillo and RcppArmadillo.

 btw, for dot products I recommend using the dot() and cdot() functions
 -- they're generally faster than going through the multiplication
 operator.


 On 31 May 2011 11:39, Conrad Sand conradsand.r...@gmail.com wrote:
 Hi Baptiste,

 Thanks for the bug report.  I'll take a look at the underlying issues.


 On 31 May 2011 09:48, baptiste auguie baptiste.aug...@googlemail.com wrote:
 Sorry, I had too many spaces in the vectors. The conclusion is the same 
 though.

 library(inline)
 require( RcppArmadillo )

 ## let's calculate this product
 c(-1-1i, 1-1i) %*% c(1i, -1i)
  ## 0-2i

 ## trans() with v0.2.19
 fx - cxxfunction( signature() , '
  arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ;
                arma::cx_colvec res = trans(A) * B;

                return wrap( res ) ;
        ', plugin = RcppArmadillo )

 fx()
 ## 0-2i

 ## strans() with v0.2.21
 fx - cxxfunction( signature() , '
  arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ;
                arma::cx_colvec res = strans(A) * B;
                return wrap( res ) ;
        ', plugin = RcppArmadillo )

 fx()
 ## 1-1i


___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] Error: .onLoad failed in loadNamespace()

2011-05-31 Thread Laurent Gatto
On 31 May 2011 20:41, Dirk Eddelbuettel e...@debian.org wrote:

 On 31 May 2011 at 21:11, Romain Francois wrote:
 | I'm using the same versions and I don't get the problem.

 Really random guess: Could R 2.13 vs 2.14 have something to with it?

Tested Rcpp 0.9.4.2 with R 2.13.0 (svn rev 55427, 2011-04-13) before
replying, as I was not sure which version Romain used, and I got the
same warning.

Laurent

 | getClass is in methods, and Rcpp does have
 |
 | import(methods)
 |
 | in its NAMESPACE file.
 |
 | Maybe this means that the client package also needs it. not sure.

 Dirk

 --
 Gauss once played himself in a zero-sum game and won $50.
                      -- #11 at http://www.gaussfacts.com




-- 
Laurent Gatto
Cambridge Centre For Proteomics
http://www.bio.cam.ac.uk/proteomics
___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] RcppArmadillo fails on FreeBSD

2011-05-31 Thread Rainer Hurling

On 31.05.2011 21:44 (UTC+1), Dirk Eddelbuettel wrote:


On 31 May 2011 at 09:27, Rainer Hurling wrote:
| Dirk, sorry again for my misunderstanding.

No worries. I do appreciate how you (pretty much single-handedly) try to keep
R and its packages viable on your chosen platform.


That's nice circumscribed for a bundle of packages we have to use at 
work ;-)


From my point of view the very most work with R on FreeBSD is done by 
Brendan Fabeny (b.f.) and he does a great job.



| Yes, I also think that
| FreeBSD people could live with this patch.

The patch currently says (and I now include the forward-looking comment :)

/* TODO: we might need to undef this on other platforms as well */
#if defined(__GNUC__)  defined(_WIN64) || defined(__FreeBSD__)
#undef ARMA_HAVE_STD_SNPRINTF
#endif


Would we need additional defines for NetBSD and/or OpenBSD?


I am afraid that I do not have any knowledge about it. (If it would be 
needed the preprocessor defines should be __OpenBSD__ and __NetBSD__, 
but this is well known, isn't it?)


Rainer



Dirk



___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel


Re: [Rcpp-devel] package .onLoad multiple modules

2011-05-31 Thread baptiste auguie
On 31 May 2011 23:19,  rom...@r-enthusiasts.com wrote:

 Le 31 mai 2011 à 13:11, Christian Gunning x...@unm.edu a écrit :

 On Tue, May 31, 2011 at 3:00 AM,
 rcpp-devel-requ...@r-forge.wu-wien.ac.at wrote:
 When FALSE it does what you want.

Fantastic, thanks a lot.

baptiste


 I can't begin to describe how long I've waited for such a function.
 -x

 :-)
 Well it does what you want ... in this context...

 It might not accomodate other needs you might have such as time travel, etc 
 ...


 --
 A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal – Panama!
 ___
 Rcpp-devel mailing list
 Rcpp-devel@lists.r-forge.r-project.org
 https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

___
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel