Re: [Rd] View() crashy on Ubuntu 9.04

2009-05-13 Thread Wacek Kusnierczyk
Ben Bolker wrote:
   It's my vague impression that View() is workable on Windows and maybe
 on MacOS, but on Ubuntu Linux 9.04 (intrepid) it seems completely
 unstable.  I can reliably crash R by trying to look  at a very small,
 simple data frame ...
   

on my 8.04, r is reliable at crashing with, e.g.,

View(1)

with a subsequent attempt to move through the spreadsheet with an arrow
key.  this always causes a segfault.

I was going to try to run with debug turned on, but my installed
 version (2.9.0) doesn't have debugging symbols, and I'm having trouble
 building the latest SVN version (./configure gives checking for
 recommended packages... ls: cannot access
 ./src/library/Recommended/boot_*.tar.gz: No such file or directory)
   

tools/rsync-recommended


vQ

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] View() crashy on Ubuntu 9.04

2009-05-13 Thread Ei-ji Nakama
Hi

2009/5/13 Dirk Eddelbuettel e...@debian.org:
snip
 #0  0xb70e685e in XmbLookupString () from /usr/lib/libX11.so.6
 #1  0xb73a9d48 in doSpreadKey (DE=0x8bfd040, key=value optimized out, 
 event=0xbfed68d8) at dataentry.c:1828

It is generated by XmbLookupString and Xutf8LookupString because
this doesn't make Input context of X11 when dataeditor is View.

static char *GetCharP(DEEvent * event)
{
 snip
XmbLookupString(ioic, (XKeyEvent *)event, /* ioic at view
time is NULL*/
text, sizeof(text) - clength,
iokey, status);
 snip
}

I think that this only has to limit GetCharP to isEditor=TRUE.
moreover View() was strange operation of  page down.


http://prs.ism.ac.jp/~nakama/working/dataentry.patch

I think that I improve the above-mentioned by this patch.

-- 
EI-JI Nakama  nakama (a) ki.rim.or.jp
\u4e2d\u9593\u6804\u6cbb  nakama (a) ki.rim.or.jp

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] View() crashy on Ubuntu 9.04

2009-05-13 Thread Ben Bolker
  This patch fixes the problem for me with latest R-devel.  Thanks!
(This kind of X-hacking would take me hours if not days to figure out ...)

  cheers
Ben Bolker


Ei-ji Nakama wrote:
 Hi
 
 2009/5/13 Dirk Eddelbuettel e...@debian.org:
 snip
 #0  0xb70e685e in XmbLookupString () from /usr/lib/libX11.so.6
 #1  0xb73a9d48 in doSpreadKey (DE=0x8bfd040, key=value optimized out, 
 event=0xbfed68d8) at dataentry.c:1828
 
 It is generated by XmbLookupString and Xutf8LookupString because
 this doesn't make Input context of X11 when dataeditor is View.
 
 static char *GetCharP(DEEvent * event)
 {
  snip
 XmbLookupString(ioic, (XKeyEvent *)event, /* ioic at view
 time is NULL*/
 text, sizeof(text) - clength,
 iokey, status);
  snip
 }
 
 I think that this only has to limit GetCharP to isEditor=TRUE.
 moreover View() was strange operation of  page down.
 
 
 http://prs.ism.ac.jp/~nakama/working/dataentry.patch
 
 I think that I improve the above-mentioned by this patch.
 


-- 
Ben Bolker
Associate professor, Biology Dep't, Univ. of Florida
bol...@ufl.edu / www.zoology.ufl.edu/bolker
GPG key: www.zoology.ufl.edu/bolker/benbolker-publickey.asc



signature.asc
Description: OpenPGP digital signature
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] [R] rmath.h functions reentrant

2009-05-13 Thread Ravi Patel
Hello
I am trying to create a parallelized r extension using C++. I was wondering
if calls to the RNG in R (using Rmath.h) are
reentrant or if i need to serialize them explicitly.

Specifically i would like to use the runif() function call to generate
variables.

Thank you again,
Ravi Patel

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Can we generate exe file using R? What is the maximum file size valid?

2009-05-13 Thread Matthew Dowle

Does Ra get close to compiled R ?   The R code is compiled on the fly to 
bytecode which is executed internally by an interpreter in C.  The timing 
tests look impressive.
http://www.milbo.users.sonic.net/ra/

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Can we generate exe file using R? What is the maximum file size valid?

2009-05-13 Thread Stavros Macrakis
There are two distinct and orthogonal questions here:

1) Is it possible to package an R program/system in such a way that it
can be distributed as a single executable file (including the R
system, any necessary loaded packages, plus the application program)
and run without an installation of R (which sets up library
directories etc.)?

2) Is it possible to compile R to bytecodes or machine language?

The answers to these questions are independent.  It is perfectly
possible to have an interpreted system which is distributed as a
single executable file (using e.g. unexec to save the fully-loaded
state).  It is also perfectly possible to have a compiled system which
requires configuration of library directories etc.

I believe the original question on this thread was about (1), but I am
not certain.  It also appears that the answer to (1) is 'no', but I am
not certain about that either.  I wouldn't think that it would be
impossible to add 'unexec' to R, but I don't know R's internals.

   -s

On Wed, May 13, 2009 at 4:17 PM, Matthew Dowle mdo...@mdowle.plus.com wrote:

 Does Ra get close to compiled R ?   The R code is compiled on the fly to
 bytecode which is executed internally by an interpreter in C.  The timing
 tests look impressive.
 http://www.milbo.users.sonic.net/ra/

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] simple add error (PR#13699)

2009-05-13 Thread Joshua Ulrich
Gostan,

This is not a bug.  You're asking for 20 decimal digits of precision,
which is impossible with double-precision floating point arithmetic.

http://fr.wikipedia.org/wiki/Virgule_flottante

Best,
Josh
--
http://www.fosstrading.com



On Wed, May 13, 2009 at 7:35 AM,  gos...@igmm.cnrs.fr wrote:
 Full_Name: Gostan Thierry
 Version: 2.6.1 (2007-11-26)
 OS: Windows XP
 Submission from: (NULL) (193.49.190.42)


 I cannot explain why R seems to have problems adding two big numbers.

 sprintf(%f,10^4+10^19) gives 10010240.00
                    instead of 1001.00

 problems seems to arrive when i'm trying to add a big and a small number...

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel


__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] simple add error (PR#13699)

2009-05-13 Thread Ben Bolker



gostan wrote:
 
 Full_Name: Gostan Thierry
 Version: 2.6.1 (2007-11-26)
 OS: Windows XP
 Submission from: (NULL) (193.49.190.42)
 
 I cannot explain why R seems to have problems adding two big numbers.
 
 sprintf(%f,10^4+10^19) gives 10010240.00 
 instead of 1001.00
 
 problems seems to arrive when i'm trying to add a big and a small
 number...
 

  I can't give you the exact answer here -- someone else may chime in with
more details -- but the basic problem is that you are reaching the limits of
double precision arithmetic -- see ?.Machine , which gives 

double.eps: the smallest positive floating-point number 'x' such that
  '1 + x != 1'.  It equals 'base^ulp.digits' if either 'base'
  is 2 or 'rounding' is 0;  otherwise, it is '(base^ulp.digits)
  / 2'.  Normally '2.220446e-16'.

  I can't say exactly why things get wonky at 10^4+10^18 (I would have
guessed you 
would be good for another order of magnitude), but that's just my
ignorance/unwilling
to think about numerical computation more carefully at the moment.

Check out various threads on the mailing lists about bc and yacas (although
I'm not sure if yacas runs on Windows or not).

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/simple-add-error-%28PR-13699%29-tp23530242p23531057.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] simple add error (PR#13699)

2009-05-13 Thread gostan
Full_Name: Gostan Thierry
Version: 2.6.1 (2007-11-26)
OS: Windows XP
Submission from: (NULL) (193.49.190.42)


I cannot explain why R seems to have problems adding two big numbers.

sprintf(%f,10^4+10^19) gives 10010240.00 
instead of 1001.00

problems seems to arrive when i'm trying to add a big and a small number...

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] different results on linux and windows

2009-05-13 Thread Klaus Nordhausen

Dear R experts,

we are preparing an R-package to compute the Oja Median which contains
some C++ code in which random numbers are needed. To generate the random
numbers we use the following Mersenne-Twister implementation:

// MersenneTwister.h
// Mersenne Twister random number generator -- a C++ class MTRand
// Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus
// Richard J. Wagner  v1.0  15 May 2003  rjwag...@writeme.com

the random seed for the Mersenne-Twister is provided by our R-function
which gives an (random) integer to  the C++ function srand() which in
turn sets the seed in the code.

Using the set.seed in R makes now the results reproducible, but the
results differ between windows and linux.

Does anyone know what the problem there is?

Our suspicion is that the reason is that some libraries are different
implemented on linux and windows (XP) compilers.

After the program start we set the seed in row 447(vkm.cpp) with srand(int);

When the median will be calculated, an intern seed is set with unsigned
 int seed = rand();   ( in row 100 (vkm.cpp)). This seed will be used
to calculate some random subsets and to
create a Mersenne Twister object with MTRand rr(seed);  (row 156, vkm.cpp).

The MTRand Object rr is called with an unsigned Integer, so the
important function in the mersenneTwister.h class is in line 87:
MTRand( const uint32 oneSeed );

According to that the Random Number Generator uses the methods
initialize(oneSeed); and reload();  (inside the method, beginning in
line 215)

This both methods (line 283 and line 301) are using beside others
registers. Could it be that there is a different behavior between
Windows and Linux?

We do not want to use only srand() since we might need more then the
number of pseudo random numbers that algorithm can provide.

For those interested and which would like to see the code, a first
version of the package, called OjaMedian, is available as source file
and windows binary on my homepage:
http://www.uta.fi/~klaus.nordhausen/down.html

The problem is in the ojaMedian function when the evolutionary algorithm
is used. Involved C++-files are mainly vkm.cpp and MersenneTwister.h.

We would be very grateful for any advice on how to solve this problem.
(below is also a demonstration)

Thank you very much in advance,

Klaus

Results on windows XP:

Compiler used: gcc version 4.2.1-sjlj (mingw32-2)


library(OjaMedian)
set.seed(1)
testD - rmvnorm(20,c(0,0))
summary(testD)

   V1V2
 Min.   :-2.2147   Min.   :-1.989352
 1st Qu.:-0.3844   1st Qu.:-0.399466
 Median : 0.3597   Median :-0.054967
 Mean   : 0.1905   Mean   :-0.006472
 3rd Qu.: 0.7590   3rd Qu.: 0.655663
 Max.   : 1.5953   Max.   : 1.358680

set.seed(1)
ojaMedian(testD)

[1]  0.21423705 -0.05799643

sessionInfo()

R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=Finnish_Finland.1252;LC_CTYPE=Finnish_Finland.1252;LC_MONETARY=Finnish_Finland.1252;LC_NUMERIC=C;LC_TIME=Finnish_Finland.1252

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

other attached packages:
[1] OjaMedian_0.0-14 ICSNP_1.0-3  ICS_1.2-1survey_3.14
[5] mvtnorm_0.9-5

loaded via a namespace (and not attached):
[1] tools_2.9.0




Results on Linux Kubuntu 8.10
result of: cat /proc/version:
Linux version 2.6.28-11-generic (bui...@palmer) (gcc version 4.3.3
(Ubuntu 4.3.3-5ubuntu4) ) #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009


library(OjaMedian)
 set.seed(1)
 testD - rmvnorm(20,c(0,0))
 summary(testD)


   V1V2
 Min.   :-2.2147   Min.   :-1.989352
 1st Qu.:-0.3844   1st Qu.:-0.399466
 Median : 0.3597   Median :-0.054967
 Mean   : 0.1905   Mean   :-0.006472
 3rd Qu.: 0.7590   3rd Qu.: 0.655663
 Max.   : 1.5953   Max.   : 1.358680


set.seed(1)
 ojaMedian(testD)


(-0.501381, 0.193929)[1] 0.119149071 0.002732100


sessionInfo()


R version 2.8.1 (2008-12-22)
i486-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

other attached packages:
[1] OjaMedian_0.0-14 ICSNP_1.0-3  ICS_1.2-1survey_3.14
[5] mvtnorm_0.9-5





--
Klaus Nordhausen
Researcher
Tampere School of Public Health
FIN-33014 University of Tampere

phone:  +358 3 3551 4153
fax:+358 3 3551 4150
e-mail: klaus.nordhau...@uta.fi

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel