Re: [Rd] [R] Building with MKL on Ubuntu

2008-11-06 Thread Anand Patil
On Thu, Nov 6, 2008 at 6:48 AM, Prof Brian Ripley <[EMAIL PROTECTED]>wrote:

> And how does that help you?  At some future point on a real problem you
> will get incorrect answers/segfault.
>
> That test was put there as a result of such incorrect results found the
> hard way.
>

I appreciate that... but I never use the complex blas, so in my case the
test is preventing me from taking advantage of MKL's real blas. Or is the
zdotu error symptomatic of a problem that would affect the real blas also?

Anand

[[alternative HTML version deleted]]

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


Re: [Rd] [R] Building with MKL on Ubuntu

2008-11-06 Thread Anand Patil
On Thu, Nov 6, 2008 at 2:01 AM, Ei-ji Nakama <[EMAIL PROTECTED]> wrote:

> Hi
>
> If you want to use MKL10(no 8 or 9), you should obey instructions of
> R-admin.
> MKL10 needs openmp.  This needs gcc4.2 or later.
> OpenMP for Intel was necessary with MKL10.0.1.x (There was not it in a
> manual of MKL).
> # Please try an additional effect of "-liomp5" in the %*%
>
> # fp-model of Linux of IA32 is 387(80bit) about the precision,
> # but SSE2(64bit) is a default in Intel64.
> # It is caused by this that results are different.
>
> There was not the problem in R-2.8.0 either
>  MKL_LIB_PATH=/opt/intel/mkl/10.0.5.025/lib/em64t
>  MKL="   -L${MKL_LIB_PATH}   \
> -Wl,--start-group   \
> ${MKL_LIB_PATH}/libmkl_gf_lp64.a\
> ${MKL_LIB_PATH}/libmkl_gnu_thread.a \
> ${MKL_LIB_PATH}/libmkl_core.a   \
> -Wl,--end-group \
> -liomp5 -lguide -lpthread -lgomp"
>  ./configure --with-lapack="$MKL" --with-blas="$MKL"


Thanks Ei-Ji,

I tried that earlier, and it doesn't encounter the zdotu error (maybe it was
fixed in 10.0.5?) but I got a different error:

gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2
-I../../src/extra/pcre  -I. -I../../src/include -I../../src/include
-I/usr/local/include -DHAVE_CONFIG_H   -fpic  -g -O2 -c Rmain.c -o Rmain.o
gcc -std=gnu99 -Wl,--export-dynamic -L/usr/local/lib64 -o R.bin Rmain.o
-L../../lib -lR
/opt/intel/fce/10.1.018/lib/libiomp5.so: undefined reference to
`pthread_atfork'
collect2: ld returned 1 exit status
make[3]: *** [R.bin] Error 1
make[3]: Leaving directory `/working_copies/R/src/main'
make[2]: *** [R] Error 2

However, I saw the same error with 10.0.2 and the broken thermometer;
setting the environment variables listed previously:

CFLAGS=-pthread -O3
FC=gfortran -pthread
FFLAGS=-pthread
CXXFLAGS=-O3 -pthread
FCLAGS=-pthread
LDFLAGS=-lpthread

makes that error not happen, so it looks like we have a real solution!

Anand

[[alternative HTML version deleted]]

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


Re: [Rd] [R] Building with MKL on Ubuntu

2008-11-06 Thread Prof Brian Ripley

On Thu, 6 Nov 2008, Anand Patil wrote:


On Thu, Nov 6, 2008 at 6:48 AM, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
  And how does that help you?  At some future point on a real problem you 
will get
  incorrect answers/segfault.

  That test was put there as a result of such incorrect results found the 
hard way.


I appreciate that... but I never use the complex blas, so in my case the test 
is preventing me
from taking advantage of MKL's real blas. Or is the zdotu error symptomatic of 
a problem that
would affect the real blas also?


Only complex BLASAFAIK, *but* e.g. lapack uses it internally, AFAIK even 
for real inputs.




Anand




--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] puzzled by cat() behaviour when argument '...' is a vector (and argument 'sep' contains "\n")

2008-11-06 Thread Wacek Kusnierczyk
William Dunlap wrote:
>
> For what it is worth, S+ and R differ in how a vector sep argument
> is treated.  R uses the vector sep only if cat() is given a vector of
> strings for the ... argument but S+ treats cat(c(...),sep=sep)
> the same as cat(..., sep=sep).  E.g., the following cat(...,sep=sep)
> uses all of sep in S+ but only sep[1] in R:
>> cat("One.", "Two words.", "Three more words.",
> sep=c("", "\n", ""))
>S+: One.Two words.
>S+: Three more words.
>R : One.Two words.Three more words.
> but the following cat(c(...),sep=sep) uses all of sep in both
>> cat(c("One.", "Two words.", "Three more words."),
> sep=c("", "\n", ""))
>S+: One.Two words.
>S+: Three more words.
>R : One.Two words.
>R : Three more words.
> If there are several c(...) entries in cat() it gets more complicated.
> E.g.,
>> cat(c("One.", "Two words.", "Three more words."), c("Fourth
> entry.", "No. 5."),
>   sep=c("", "\n", ""))
>S+: One.Two words.
>S+: Three more words.Fourth entry.No. 5.
>R : One.Two words.
>R : Three more words.Fourth
> entry.No. 5.
>
>   

cat ues consecutive elements of sep circularly (see below) to separate
elements *within* each item in ..., and uses the first element in sep as
a separator *between* items in ...

cat(1:5, sep=letters[1:3])
# evaluates to "1a2b3c4a5"

cat(1:5, 6, sep=letters[1:3])
# evaluates to "1a2b3c4a5a6"

cat(1:5, 6, 7, sep=letters[1:3])
# evaluates to "1a2b3c4a5a6a7"

confusingly, the circulation over sep is *not* restarted for each item
in ..., and it is *not* stopped while separating between items in ...

cat(1:5, 6:10, sep=letters[1:3])
# evaluates to "1a2b3c4a5a6c7a8b9c10",
# not to "1a2b3c4a5a6a7b8c9a10" (which would be the case if circulation
were restarted for each item), and
# not to "1a2b3c4a5a6b7c8a9b10" (which would be the case if circulation
were not restarted, but were stopped for between-item separation)

cat(1:5, 6, 7:10, sep=letters[1:3])
# evaluates to "1ab3c4a5a6a7a8b9c10" (which is only *incidentally* the
same as it would be if circulation were restarted for each item), and
# not to "1a2b3c4a5a6a7b8c9a10" (which would be the case if circulation
were not restarted, but were stopped for between-item separation)


whether this is or is not reasonable, the man page should be explicit
about this behaviour, and the example section should clearly illustrate
it.  the examples above are a candidate.

i am not sure that there is any good scenario of where this behaviour
would be desirable and useful, and perhaps redesigning cat should be an
option to consider.

vQ


ps.  still using R 2.7.0, but i guess cat has not changed since.

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


Re: [Rd] [R] Building with MKL on Ubuntu

2008-11-06 Thread Ei-ji Nakama
Hi

2008/11/6 Anand Patil <[EMAIL PROTECTED]>:
> I tried that earlier, and it doesn't encounter the zdotu error (maybe it was
> fixed in 10.0.5?) but I got a different error:

no, see MKL manual.
Because fortran do not have compatibility, You appoint ABI of your
Fortran in a link of MKL.

> /opt/intel/fce/10.1.018/lib/libiomp5.so: undefined reference to
> `pthread_atfork'

MKL 10.0.1.x that libiomp5 was necessary.
Hmm, but not need libiomp5 with MKL 10.0.5.x.
I do not understand which version MKL were recovered in, but libiomp5
seems to be unnecessary in the latest edition.

MKL_LIB_PATH=/opt/intel/mkl/10.0.5.025/lib/em64t
MKL="   -L${MKL_LIB_PATH}   \
-Wl,--start-group   \
${MKL_LIB_PATH}/libmkl_gf_lp64.a\
${MKL_LIB_PATH}/libmkl_gnu_thread.a \
${MKL_LIB_PATH}/libmkl_core.a   \
-Wl,--end-group  -lgomp"
LDFLAGS="-L$MKL_LIB_PATH" ./configure --with-lapack="$MKL" --with-blas="$MKL"

-liomp5 -lguide -lpthread  You omit three library, and please link

Please check the result of the big %*% just to make sure.
-- 
EI-JI Nakama  
"\u4e2d\u9593\u6804\u6cbb"  

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


Re: [Rd] [R] Building with MKL on Ubuntu

2008-11-06 Thread Anand Patil
On Thu, Nov 6, 2008 at 3:08 PM, Ei-ji Nakama <[EMAIL PROTECTED]> wrote:

> Hi
>
> 2008/11/6 Anand Patil <[EMAIL PROTECTED]>:
> > I tried that earlier, and it doesn't encounter the zdotu error (maybe it
> was
> > fixed in 10.0.5?) but I got a different error:
>
> no, see MKL manual.
> Because fortran do not have compatibility, You appoint ABI of your
> Fortran in a link of MKL.
>
> > /opt/intel/fce/10.1.018/lib/libiomp5.so: undefined reference to
> > `pthread_atfork'
>
> MKL 10.0.1.x that libiomp5 was necessary.
> Hmm, but not need libiomp5 with MKL 10.0.5.x.
> I do not understand which version MKL were recovered in, but libiomp5
> seems to be unnecessary in the latest edition.
>
> MKL_LIB_PATH=/opt/intel/mkl/10.0.5.025/lib/em64t
> MKL="   -L${MKL_LIB_PATH}   \
>-Wl,--start-group   \
>${MKL_LIB_PATH}/libmkl_gf_lp64.a\
>${MKL_LIB_PATH}/libmkl_gnu_thread.a \
>${MKL_LIB_PATH}/libmkl_core.a   \
> -Wl,--end-group  -lgomp"
> LDFLAGS="-L$MKL_LIB_PATH" ./configure --with-lapack="$MKL"
> --with-blas="$MKL"
>
> -liomp5 -lguide -lpthread  You omit three library, and please link
>
> Please check the result of the big %*% just to make sure.
> --
> EI-JI Nakama  
> "\u4e2d\u9593\u6804\u6cbb"  
>

That worked for me too. The big %*% does indeed use 800% CPU for a while.

Thanks,
Anand

[[alternative HTML version deleted]]

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


[Rd] Fwd: SWIG with R and C++ STL

2008-11-06 Thread charlie
Hi, all

I didn't get any response from swig for my question.
see if I can get some help here

Thanks

-- Forwarded message --
From: charlie <[EMAIL PROTECTED]>
Date: Tue, Nov 4, 2008 at 1:55 PM
Subject: SWIG with R and C++ STL
To: [EMAIL PROTECTED]


Hi all,

I am new to SWIG. I encountered some problem when I try to SWIG to R some
C++ modules.
Here is the details. I got "myvector.i" and "myvector.h" as my two input
files, the contends are:

---myvector.i-
%module myvector
%{
#include "myvector.h"
%}

%include "std_vector.i"

namespace std {
%template(IntVector) vector;
%template(DoubleVector) vector;
};

%include "myvector.h"
--

--myvector.h---
/* File : example.h */

#include 
#include 
#include 
#include 

double average(std::vector v) {
  return std::accumulate(v.begin(),v.end(),0.0)/v.size();
}

std::vector half(const std::vector& v) {
  std::vector w(v);
  for (unsigned int i=0; i& v) {
  std::transform(v.begin(),v.end(),v.begin(),
 std::bind2nd(std::divides(),2.0));
}
-

Basicly they are just examples from the SWIG doc.
And I ran:
*swig -c++ -r -o myvector_wrap.cpp myvector.i
PKG_LIBS="myvector.h" R CMD SHLIB myvector_wrap.cpp*
Then in R I ran:
>*dyn.load("myvector.so")*
>*source("myvector.R")*
Then i tried to create a vector in R:
>*vi=IntVector(4)*
I go the following error:
*Error in .Call("R_swig_new_IntVector__SWIG_2", size, PACKAGE="myvector"):
  C symbol name "R_swig_new_IntVector__SWIG_2" not in DLL for package
"myvector"*

Since I basicly followed the steps in the doc, I don't understand where the
error comes from.
Can anybody help me out?

Thanks a lot!

Charlie

[[alternative HTML version deleted]]

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


[Rd] Two minor escaping issues using \preformatted{....} in Rd format

2008-11-06 Thread Peter Ruckdeschel
Hi r-devels,

I have two minor problems with special characters in Rd files when
used within a  \preformatted{} markup command:

--
1. issue: backslash + single brace
--

I would like to write "\\\}" to produce \} on output (documenting
the need to escape the brace once again before TeX-ing it);
this fails if there is no space between the second and third
backslash, but works if there is a space, but this produces
\ } then

--
2. issue: backslash + percent sign
--

I would like to write "\%" to give a string argument \\% on
output; this is needed for documenting how to register special
operators to TeX package 'listings'.
Again this fails, while " \%" works.

In neither case 1 or 2 the standard TeX trick to produce a
linebreak in the source without producing a space on output
helps, i.e.

\\%
\}

resp.
%
\%

both produce valid code [the resp. first % is read as a comment
sign] but also insert a non-intended space in the output.

Any idea how to circumvent this?
Best, Peter

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


Re: [Rd] Fwd: SWIG with R and C++ STL

2008-11-06 Thread Whit Armstrong
did you wrap your function prototype in extern "C" ?

-Whit


On Thu, Nov 6, 2008 at 1:16 PM, charlie <[EMAIL PROTECTED]> wrote:
> Hi, all
>
> I didn't get any response from swig for my question.
> see if I can get some help here
>
> Thanks
>
> -- Forwarded message --
> From: charlie <[EMAIL PROTECTED]>
> Date: Tue, Nov 4, 2008 at 1:55 PM
> Subject: SWIG with R and C++ STL
> To: [EMAIL PROTECTED]
>
>
> Hi all,
>
> I am new to SWIG. I encountered some problem when I try to SWIG to R some
> C++ modules.
> Here is the details. I got "myvector.i" and "myvector.h" as my two input
> files, the contends are:
>
> ---myvector.i-
> %module myvector
> %{
> #include "myvector.h"
> %}
>
> %include "std_vector.i"
>
> namespace std {
>%template(IntVector) vector;
>%template(DoubleVector) vector;
> };
>
> %include "myvector.h"
> --
>
> --myvector.h---
> /* File : example.h */
>
> #include 
> #include 
> #include 
> #include 
>
> double average(std::vector v) {
>  return std::accumulate(v.begin(),v.end(),0.0)/v.size();
> }
>
> std::vector half(const std::vector& v) {
>  std::vector w(v);
>  for (unsigned int i=0; iw[i] /= 2.0;
>  return w;
> }
>
> void halve_in_place(std::vector& v) {
>  std::transform(v.begin(),v.end(),v.begin(),
> std::bind2nd(std::divides(),2.0));
> }
> -
>
> Basicly they are just examples from the SWIG doc.
> And I ran:
> *swig -c++ -r -o myvector_wrap.cpp myvector.i
> PKG_LIBS="myvector.h" R CMD SHLIB myvector_wrap.cpp*
> Then in R I ran:
>>*dyn.load("myvector.so")*
>>*source("myvector.R")*
> Then i tried to create a vector in R:
>>*vi=IntVector(4)*
> I go the following error:
> *Error in .Call("R_swig_new_IntVector__SWIG_2", size, PACKAGE="myvector"):
>  C symbol name "R_swig_new_IntVector__SWIG_2" not in DLL for package
> "myvector"*
>
> Since I basicly followed the steps in the doc, I don't understand where the
> error comes from.
> Can anybody help me out?
>
> Thanks a lot!
>
> Charlie
>
>[[alternative HTML version deleted]]
>
> __
> 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


[Rd] .C(..., DUP=FALSE) memory costs depending on input size?

2008-11-06 Thread MarcelK

Hello,

I'm trying to create my own C code for use within R. While optimizing the
code I've noticed that even while only using pointers to get my data to C
the time needed still depends on data (vector) size.

To test this, I've created an empty C function to which I've send vectors
containing various sizes of elements. The time needed for each call is
measured and plotted. I would expect a flat line (a little above y=0) since
the only thing send are pointers. What I do not expect is to see a linear
climbing line when the vector size increases. Initializing the vectors isn't
being measured, only the '.C' call to an empty C function, see below.

Is there anything I'm missing that can explain this input-size dependent
latency? The only reason I can think of is that these vectors are being
copied along the way.

What follows is both the R and C code which I use only for testing and a
plot of both measurements with DUP=TRUE and DUP=FALSE:

(RED: DUP=FALSE, GREEN: DUP=TRUE)
http://www.nabble.com/file/p20368695/CandR.png 


R code:
--
# sequence from 512 to 2^23 with 2^17 stepsize
a <- seq(512, 2^23, 2^17)
# storage for wall time
h <- length(a); j <- length(a)
for (i in 1:length(a)) {
x <- as.double(1:a[i])
y <- as.double(x)
# system.time()[3] is (actual) wall time
h[i] <- system.time(.C("commTest", x, y, DUP=FALSE))[3]
j[i] <- system.time(.C("commTest", x, y, DUP=TRUE))[3]
x <- 0
y <- 0
}
# plot:
plot(a, h, type="l", col="red", xlab="Vector Size -->", ylab="Time in
Seconds -->"); lines(a, j, col="green")


C code: 
---
#include
extern "C" {
void commTest(double* a, double* b);
}

/*
* Empty function
* Just testing communication costs between R --> C
*/
void commTest(double* a, double* b) {
  /* Do ab-so-lute-ly-nothing.. */
}

System Details:
-
Linux gpu 2.6.18-6-amd64 #1 SMP Thu May 8 06:49:39 UTC 2008 x86_64 GNU/Linux
R version 2.7.1 (2008-06-23)
-- 
View this message in context: 
http://www.nabble.com/.C%28...%2C-DUP%3DFALSE%29-memory-costs-depending-on-input-size--tp20368695p20368695.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


Re: [Rd] .C(..., DUP=FALSE) memory costs depending on input size?

2008-11-06 Thread MarcelK

Sorry for spamming, legend with the plot is wrong:

RED: DUP = TRUE
GREEN: DUP = FALSE

Pretty clear from the plot itself, but it's both wrong in the plot header
and in the plot code (just swap 'h' and 'j').


-- 
View this message in context: 
http://www.nabble.com/.C%28...%2C-DUP%3DFALSE%29-memory-costs-depending-on-input-size--tp20368695p20368753.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


Re: [Rd] .C(..., DUP=FALSE) memory costs depending on input size?

2008-11-06 Thread William Dunlap
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of MarcelK
> Sent: Thursday, November 06, 2008 12:06 PM
> To: r-devel@r-project.org
> Subject: [Rd] .C(..., DUP=FALSE) memory costs depending on input size?
> 
> 
> Hello,
> 
> I'm trying to create my own C code for use within R. While 
> optimizing the code I've noticed that even while only using 
> pointers to get my data to C the time needed still depends on 
> data (vector) size.

Does using NAOK=TRUE in the .C() help?  That would avoid
an NA-scan of the input vectors.

Bill Dunlap
TIBCO Spotfire Inc
wdunlap tibco.com  

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


[Rd] Axis gives error message (PR#13259)

2008-11-06 Thread ggrothendieck
Full_Name: G. Grothendieck
Version: R version 2.8.0 Patched (2008-10-21 r46766)
OS: Vista
Submission from: (NULL) (69.63.56.110)


Was posted here on r-devel

https://stat.ethz.ch/pipermail/r-devel/2008-November/051173.html

but got no replies.

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


[Rd] problem packaging S4 class that contains a slot of jobjRef class

2008-11-06 Thread Adrian Dragulescu


Hello,

I'm trying to package some source files that link R to a broker using
a Java API and the rJava package.  I am successful doing the connection
and operate on it using my R code.  I would like to package the files and
release the package.

I created some S4 classes to hold several Java objects.  I use WinXP and R
2.7.1.  I've searched RSeek and the Wiki for help, but could not find a
solution.

Here is my class definition:
twsConnect <- function(...)
  new("twsConnect", ...)

setClass(
  Class="twsConnect",
  representation=representation(
clientId= "integer",
host= "character",
port= "integer",
reference   = "jobjRef"),
  prototype=prototype(
clientId= as.integer(0),
host= "",
port= as.integer(7496),
reference   = .jnull())
)

setMethod("initialize", "twsConnect", function(
  .Object, clientId = 0, host = "", port = 7496, ...)
  {
# hook up to the TWS
ref <- .jnew("dev/AAD_Trader", as.integer(clientId), host,
 as.integer(port))

if (class(ref)[1] != "jobjRef")
  stop("Could not connect.  Check your settings.")

[EMAIL PROTECTED] <- as.integer(clientId)
[EMAIL PROTECTED] <- as.character(host)
[EMAIL PROTECTED] <- as.integer(port)
[EMAIL PROTECTED] <- ref

.Object
  }
)


setMethod("show", "twsConnect",
  function(object){
cat("Object of class \"", class(object), "\":\n", sep="")
lines <- NULL
for (s in slotNames(object)){
  cont  <- slot(object, s)
  if (is.character(cont))cont <- paste('"', cont, '"', sep="")
  if (class(cont)=="jobjRef") cont <- "jobjRef"
  lines <- paste(lines, paste(s, " = ", cont, "\n",
  sep=""), sep="")
}
cat(lines)
  }
)



I have other files too.  Here is the output from package creation:
S:\All\Risk\Software\R\R-2.7.1\bin>Rcmd build --force --binary
H:/user/R/Adrian/RIB/
* checking for file 'H:/user/R/Adrian/RIB/DESCRIPTION' ... OK
* preparing 'H:/user/R/Adrian/RIB':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* excluding invalid files from 'RIB'
Subdirectory 'R' contains invalid file names:
  .make.IB.package.R .utilities.R
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
WARNING: directory 'RIB/inst/doc' is empty
* building binary distribution
WARNING: some HTML links may not be found
installing R.css in C:/DOCUME~1/e47187/LOCALS~1/Temp/Rinst238480883

Using auto-selected zip options ''

-- Making package RIB 
  adding build stamp to DESCRIPTION
  installing NAMESPACE file and metadata
  installing R files
  installing inst files
  preparing package RIB for lazy loading
Loading required package: rJava
Warning: package 'rJava' was built under R version 2.7.2
Loading required package: zoo

Attaching package: 'zoo'


The following object(s) are masked from package:base :

 as.Date.numeric

Creating a new generic function for "summary" in "RIB"
  installing man source files
  installing indices
  installing help
 >>> Building/Updating help pages for package 'RIB'
 Formats: text html latex example chm
  IBrokers-package  texthtmllatex   example chm
  reqAccountUpdates texthtmllatex   example chm
  reqHistoricalData texthtmllatex   example chm
  twsConnecttexthtmllatex   example chm
Note: removing empty section \details
Note: removing empty section \details
  twsContract   texthtmllatex   example chm
  twsOrder  texthtmllatex   example chm
hhc: not found
CHM compile failed: HTML Help Workshop not installed?
  adding MD5 sums

packaged installation of package 'RIB' as RIB_0.1.0.zip
* DONE (RIB)

Not clean yet, but good for testing.

So, from R:

> require("RIB")
Loading required package: RIB
Loading required package: rJava
Loading required package: zoo

Attaching package: 'zoo'


The following object(s) are masked from package:base :

 as.Date.numeric

Warning message:
package 'rJava' was built under R version 2.7.2
> tws <- twsConnect()
> tws
Object of class "twsConnect":
clientId = 0
host = ""
port = 7496
reference = jobjRef
> [EMAIL PROTECTED]
[1] "Java-Object"
So I have no connection...

> tws <- new("twsConnect", 1, "", 7496)
Error in initialize(value, ...) :
  cannot use object of class "numeric" in new():  class "twsConnect" does
not extend that class
>

but if I source the file:
> source("H:/user/R/Adrian/RIB/R/twsConnect.R")
> tws <- twsConnect()
> tws
Object of class "twsConnect":
clientId = 0
host = ""
port = 7496
reference = jobjRef
>
> [EMAIL PROTECTED]
[1] "[EMAIL PROTECTED]"
>
Things work as I want, I have the connection.  What does source do, that I
miss when packaging?

My NAMESPACE file is:
exportPattern("^[^\\.]")

exportClasses("twsConnect", "twsContract", "twsExecutionFilter",

[Rd] Compile error when configured with (PR#13256)

2008-11-06 Thread jon
Full_Name: Jon Hill
Version: 2.8.1
OS: Linux
Submission from: (NULL) (129.215.63.157)


A semicolon is missing from src/main/platform.c line 1657

#ifdef Unix
# ifdef HAVE_X11
int X11 = NA_LOGICAL;
# else
int X11 = FALSE   <--- missing ;
# endif
#endif

Results in a build error when compiling with no X11 libs, i.e. when configured
using:
./configure --with-x=no

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


Re: [Rd] 2.8.0 release bugs (PR#13210)

2008-11-06 Thread janek musek
Dear colleagues,
Thank you very much for information, the application of patches will
probably help. I apologize for answering delay due to my absence for some
days and for bothering you with my asking. I simply followed the suggestion
to report the possible troubles during the use of this R release (the only
one I must say) and certainly did not intend to cause any inconveniences.  
Best regards,
Prof. Dr. Janek Musek

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


Re: [Rd] .C(..., DUP=FALSE) memory costs depending on input size?

2008-11-06 Thread Jeff Ryan
Marcel,

If you are writing the C code from scratch, take a look at either
.Call or .External, as both make no copies of the input objects, and
require no explicit conversion to the underlying storage type
(numeric/integer/etc) within the function call.

An even greater benefit is that you will also have access to the
actual R objects within C.

Jeff

On Thu, Nov 6, 2008 at 2:05 PM, MarcelK <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm trying to create my own C code for use within R. While optimizing the
> code I've noticed that even while only using pointers to get my data to C
> the time needed still depends on data (vector) size.
>
> To test this, I've created an empty C function to which I've send vectors
> containing various sizes of elements. The time needed for each call is
> measured and plotted. I would expect a flat line (a little above y=0) since
> the only thing send are pointers. What I do not expect is to see a linear
> climbing line when the vector size increases. Initializing the vectors isn't
> being measured, only the '.C' call to an empty C function, see below.
>
> Is there anything I'm missing that can explain this input-size dependent
> latency? The only reason I can think of is that these vectors are being
> copied along the way.
>
> What follows is both the R and C code which I use only for testing and a
> plot of both measurements with DUP=TRUE and DUP=FALSE:
>
> (RED: DUP=FALSE, GREEN: DUP=TRUE)
> http://www.nabble.com/file/p20368695/CandR.png
>
>
> R code:
> --
> # sequence from 512 to 2^23 with 2^17 stepsize
> a <- seq(512, 2^23, 2^17)
> # storage for wall time
> h <- length(a); j <- length(a)
> for (i in 1:length(a)) {
>x <- as.double(1:a[i])
>y <- as.double(x)
># system.time()[3] is (actual) wall time
>h[i] <- system.time(.C("commTest", x, y, DUP=FALSE))[3]
>j[i] <- system.time(.C("commTest", x, y, DUP=TRUE))[3]
>x <- 0
>y <- 0
> }
> # plot:
> plot(a, h, type="l", col="red", xlab="Vector Size -->", ylab="Time in
> Seconds -->"); lines(a, j, col="green")
>
>
> C code:
> ---
> #include
> extern "C" {
>void commTest(double* a, double* b);
> }
>
> /*
> * Empty function
> * Just testing communication costs between R --> C
> */
> void commTest(double* a, double* b) {
>  /* Do ab-so-lute-ly-nothing.. */
> }
>
> System Details:
> -
> Linux gpu 2.6.18-6-amd64 #1 SMP Thu May 8 06:49:39 UTC 2008 x86_64 GNU/Linux
> R version 2.7.1 (2008-06-23)
> --
> View this message in context: 
> http://www.nabble.com/.C%28...%2C-DUP%3DFALSE%29-memory-costs-depending-on-input-size--tp20368695p20368695.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
>



-- 
Jeffrey Ryan
[EMAIL PROTECTED]

ia: insight algorithmics
www.insightalgo.com

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


Re: [Rd] Compile error when configured with (PR#13256)

2008-11-06 Thread Prof Brian Ripley
This was fixed in R-patched two weeks ago and is the *third* bug report 
filed on this topic.


Do please follow the FAQ and not report on already reported and already 
fixed problems (which were not reported in the alpha/beta test period).


On Thu, 6 Nov 2008, [EMAIL PROTECTED] wrote:


Full_Name: Jon Hill
Version: 2.8.1
OS: Linux
Submission from: (NULL) (129.215.63.157)


A semicolon is missing from src/main/platform.c line 1657

#ifdef Unix
# ifdef HAVE_X11
   int X11 = NA_LOGICAL;
# else
   int X11 = FALSE   <--- missing ;
# endif
#endif

Results in a build error when compiling with no X11 libs, i.e. when configured
using:
./configure --with-x=no

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



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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


Re: [Rd] problem packaging S4 class that contains a slot of jobjRef class

2008-11-06 Thread Simon Urbanek

Adrian,

my guess would be that you're trying to crate some Java objects at the  
top level of your package. That won't work, because R stores a  
serialized image of created objects for efficiency and hence the  
reference to any Java objects that you create will disappear as soon  
as you're done installing the package. When you try to load the  
package you'll end up with null references for all objects you have  
attempted to create that way. You have two options to avoid that:


1) create objects at load time - i.e. in the initialization function  
after you have called .jpackage. Only then is Java up and running so  
you can safely create Java objects


2) [not recommended] use .jcache to serialize objects you want to keep  
at the top level after creating them. They will be then lazily  
deserialized after the package has been loaded. However, this requires  
all such classes to implement Serializable interface on the Java side  
and is conceptually not clean, because you have to be careful when  
your cached serialization goes out of sync with the actual object (see  
details in the documentation of .jcache).


This is just my guess based on the symptoms since I think you actually  
failed to send us the part of code that triggers the problem.


Cheers,
Simon


On Nov 6, 2008, at 10:04 , Adrian Dragulescu wrote:




Hello,

I'm trying to package some source files that link R to a broker using
a Java API and the rJava package.  I am successful doing the  
connection
and operate on it using my R code.  I would like to package the  
files and

release the package.

I created some S4 classes to hold several Java objects.  I use WinXP  
and R
2.7.1.  I've searched RSeek and the Wiki for help, but could not  
find a

solution.

Here is my class definition:
twsConnect <- function(...)
 new("twsConnect", ...)

setClass(
 Class="twsConnect",
 representation=representation(
   clientId= "integer",
   host= "character",
   port= "integer",
   reference   = "jobjRef"),
 prototype=prototype(
   clientId= as.integer(0),
   host= "",
   port= as.integer(7496),
   reference   = .jnull())
)

setMethod("initialize", "twsConnect", function(
 .Object, clientId = 0, host = "", port = 7496, ...)
 {
   # hook up to the TWS
   ref <- .jnew("dev/AAD_Trader", as.integer(clientId), host,
as.integer(port))

   if (class(ref)[1] != "jobjRef")
 stop("Could not connect.  Check your settings.")

   [EMAIL PROTECTED] <- as.integer(clientId)
   [EMAIL PROTECTED] <- as.character(host)
   [EMAIL PROTECTED] <- as.integer(port)
   [EMAIL PROTECTED] <- ref

   .Object
 }
)


setMethod("show", "twsConnect",
 function(object){
   cat("Object of class \"", class(object), "\":\n", sep="")
   lines <- NULL
   for (s in slotNames(object)){
 cont  <- slot(object, s)
 if (is.character(cont))cont <- paste('"', cont, '"', sep="")
 if (class(cont)=="jobjRef") cont <- "jobjRef"
 lines <- paste(lines, paste(s, " = ", cont, "\n",
 sep=""), sep="")
   }
   cat(lines)
 }
)



I have other files too.  Here is the output from package creation:
S:\All\Risk\Software\R\R-2.7.1\bin>Rcmd build --force --binary
H:/user/R/Adrian/RIB/
* checking for file 'H:/user/R/Adrian/RIB/DESCRIPTION' ... OK
* preparing 'H:/user/R/Adrian/RIB':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* excluding invalid files from 'RIB'
Subdirectory 'R' contains invalid file names:
 .make.IB.package.R .utilities.R
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
WARNING: directory 'RIB/inst/doc' is empty
* building binary distribution
WARNING: some HTML links may not be found
installing R.css in C:/DOCUME~1/e47187/LOCALS~1/Temp/Rinst238480883

Using auto-selected zip options ''

-- Making package RIB 
 adding build stamp to DESCRIPTION
 installing NAMESPACE file and metadata
 installing R files
 installing inst files
 preparing package RIB for lazy loading
Loading required package: rJava
Warning: package 'rJava' was built under R version 2.7.2
Loading required package: zoo

Attaching package: 'zoo'


   The following object(s) are masked from package:base :

as.Date.numeric

Creating a new generic function for "summary" in "RIB"
 installing man source files
 installing indices
 installing help

Building/Updating help pages for package 'RIB'

Formats: text html latex example chm
 IBrokers-package  texthtmllatex   example chm
 reqAccountUpdates texthtmllatex   example chm
 reqHistoricalData texthtmllatex   example chm
 twsConnecttexthtmllatex   example chm
Note: removing empty section \details
Note: removing empty section \details
 twsContract   texthtmllatex   example chm
 twsOrder  texthtmllatex   example chm

[Rd] problems executing a bulk load with SQL server

2008-11-06 Thread Grey Moran Tzamouranis
Hello,

New to this forum so I hope the content is appropriate...

I was building a some code to maniputlate some data.  Given the bulk of it
(the csv is about a GB), I opted to use a database.
The setup, which may be part of the issue is that the SQL is one remote
machine (call it 'A'), the disk that contains the data is on some other
remote drive - call it 'B' and the server on which I program is a third
machine with access to both A and B.  SQL Server is 2003, I believe, and the
environment is XP.

Commands such as "CREATE TABLE", "SELECT * FROM", "ALTER TABLE" and "INSERT"
data work well.
But, given the size of the data to be loaded, I had to opt for a bulk load
like this:
sqlQuery(channel, "BULK INSERT mytable FROM
rhea\\users\\Risk\\Dump\\myfile.csv WITH (FIRSTROW=2, LASTROW=10);")
The response is
[1] "[RODBC] ERROR: Could not
SQLExecDirect"
[2] "42000 170 [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
Incorrect syntax near '\\'."
Similar errors are produced by using the "/" slashes instead.   Therefore,
the first question would be: "Where do I go wrong with my file definition?"

A stored procedure the dba created to get around this problem also produces
an error but without much content.

The stored procedure definition would be something like:

create procedure LoadFile ( @TableName varchar(256), @FileName varchar(256)
)

as

begin

declare @FilePath varchar(1024);

declare @Command varchar(1024);

set @FilePath = '*\\rhea\users\Risk\Dump\* ' +
@FileName;

set @Command = 'BULK INSERT ' + @TableName + ' FROM ' + Char(39) + @FilePath
+ Char(39) + ' WITH (FIRSTROW=2, LASTROW=10)';

exec (@Command);

end;

When I issue the command:

sqlQuery(channel, "exec LoadFile 'US15Aug2008',
'US_15Aug2008_50paths.csv';")

 I get the cryptic message:

[1] "[RODBC] ERROR: Could not SQLExecDirect"
 Any ideas?  Anything would be highly appreciated!

[[alternative HTML version deleted]]

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


Re: [Rd] Two minor escaping issues using \preformatted{....} in Rd format

2008-11-06 Thread Mark.Bravington
Hi Peter

I've recently run into very similar phenomena, not just in \preformatted. After 
extensive experimentation, I've found some ugly but effective workarounds. The 
Rd problems can occur *after* either a backslash or a left brace; that's a 
necessary but not sufficient condition, as they only occur with certain 
following characters or sequences. For (one) example, interesting things happen 
if you try to output the string "\code" in certain parts of your documentation, 
whereas "\dode" is fine; I speculate that Rdconv may use global searches for 
"\code" which ignore context.

My ugly workarounds are as follows:

In verbatim-like modes (eg \preformatted, USAGE, EXAMPLES, and \code 
fragments), insert \link{} after a backslash or left brace.

In text-like modes, insert \enc{}{} after the backslash or left brace.

This seems to work very generally. AFAICS the insertions leave no trace in the 
final help products, but they are not strictly necessary in all cases; it does 
depend on the following character(s), as you've noted. I'm not 100% sure what 
all the dangerous following characters are.

The only problem with the verbatim-mode fix is that it will trigger a "missing 
link:" warning during RCMD CHECK. The missing link in question is empty, but 
doesn't cause any problem in the final documentation (text, html, or pdf). 
Based on recent experience, this is probably OK with the CRAN maintainers if 
you explain why, but in the longer term I guess it would be good if the 
fundamental conversion issues were addressed.

The absolutely simplest way to get things to behave for now, might be (i) for 
writers to use the above fixes, and (ii) for RCMD CHECK to not issue warnings 
for missing links *iff* the link is empty. Presumably this would not appeal to 
the pure of heart, but it would save anyone having to crawl through the bowels 
of Rdconv...

HTH

Mark

--
Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001
TAS

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Ruckdeschel
Sent: Friday, 7 November 2008 5:27 AM
To: r-devel@r-project.org
Subject: [Rd] Two minor escaping issues using \preformatted{} in Rd format

Hi r-devels,

I have two minor problems with special characters in Rd files when
used within a  \preformatted{} markup command:

--
1. issue: backslash + single brace
--

I would like to write "\\\}" to produce \} on output (documenting
the need to escape the brace once again before TeX-ing it);
this fails if there is no space between the second and third
backslash, but works if there is a space, but this produces
\ } then

--
2. issue: backslash + percent sign
--

I would like to write "\%" to give a string argument \\% on
output; this is needed for documenting how to register special
operators to TeX package 'listings'.
Again this fails, while " \%" works.

In neither case 1 or 2 the standard TeX trick to produce a
linebreak in the source without producing a space on output
helps, i.e.

\\%
\}

resp.
%
\%

both produce valid code [the resp. first % is read as a comment
sign] but also insert a non-intended space in the output.

Any idea how to circumvent this?
Best, Peter

__
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] Two minor escaping issues using \preformatted{....} in Rd format

2008-11-06 Thread Duncan Murdoch

On 06/11/2008 1:26 PM, Peter Ruckdeschel wrote:

Hi r-devels,

I have two minor problems with special characters in Rd files when
used within a  \preformatted{} markup command:

--
1. issue: backslash + single brace
--

I would like to write "\\\}" to produce \} on output (documenting
the need to escape the brace once again before TeX-ing it);
this fails if there is no space between the second and third
backslash, but works if there is a space, but this produces
\ } then


We have started some work on overhauling Rd processing.  Your comments 
on the early work would be welcome.  These might appear in 2.9.0, or 
maybe later, or maybe not at all.  You can read about them on 
developer.r-project.org.


In this case, what you want to write would be supported.  Mark's 
workaround would no longer work, because \link{} wouldn't be recognized 
within \preformatted.




--
2. issue: backslash + percent sign
--

I would like to write "\%" to give a string argument \\% on
output; this is needed for documenting how to register special
operators to TeX package 'listings'.
Again this fails, while " \%" works.

In neither case 1 or 2 the standard TeX trick to produce a
linebreak in the source without producing a space on output
helps, i.e.

\\%
\}

resp.
%
\%

both produce valid code [the resp. first % is read as a comment
sign] but also insert a non-intended space in the output.


Those would probably still insert spaces under the proposed changes.

Duncan Murdoch


Any idea how to circumvent this?
Best, Peter

__
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] Axis gives error message (PR#13259)

2008-11-06 Thread Peter Dalgaard

[EMAIL PROTECTED] wrote:

Full_Name: G. Grothendieck
Version: R version 2.8.0 Patched (2008-10-21 r46766)
OS: Vista
Submission from: (NULL) (69.63.56.110)


Was posted here on r-devel

https://stat.ethz.ch/pipermail/r-devel/2008-November/051173.html

but got no replies.


The list probably knows you well enough to expect that you'd come up 
with a patch for axis.date...


The issue is that it is clipping the "at" values

z <- z[z >= range[1] & z <= range[2]]

but not the corresponding "labels". A slight complication is that labels 
can be absent or TRUE/FALSE.


--
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

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