Re: [Rd] Why does my RPy2 program run faster on Windows?

2010-06-02 Thread Abhijit Bera
Hi This problem is fixed. I was running an older kernel 2.6.28. I upgraded to 2.6.32-5 Debian Sid/Squeeze and now the performance is similar. Regards Abhijit Bera On Wed, May 19, 2010 at 6:49 PM, Carlos J. Gil Bellosta < c...@datanalytics.com> wrote: > Dear Abhijit, > > If

Re: [Rd] Why does my RPy2 program run faster on Windows?

2010-05-19 Thread Abhijit Bera
at 6:34 PM, Abhijit Bera wrote: > Update: it appears that the time taken isn't so much on the Data > conversion. The maximum time taken is in CAPM calculation. :( Anyone know > why the CAPM calculation would be faster on Windows? > > > On Wed, May 19, 2010 at 5:51 PM, Abhij

Re: [Rd] Why does my RPy2 program run faster on Windows?

2010-05-19 Thread Abhijit Bera
Update: it appears that the time taken isn't so much on the Data conversion. The maximum time taken is in CAPM calculation. :( Anyone know why the CAPM calculation would be faster on Windows? On Wed, May 19, 2010 at 5:51 PM, Abhijit Bera wrote: > Hi > > This is my function. It

[Rd] Why does my RPy2 program run faster on Windows?

2010-05-19 Thread Abhijit Bera
time elapsed:0:00:02.467000 Why is there such a huge difference in the time taken by R on the two platforms? Am I doing something wrong? It's my first Rpy2 code so I guess it's badly written. I'm loading the following libraries: 'PerformanceAnalytics','timeSeries','fPortfolio','fPortfolioBacktest' I'm using Rpy2 2.1.0 and R 2.11 Regards Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] How do I bundle R with my Win32 Application?

2009-11-20 Thread Abhijit Bera
nsure that my package and it's dependencies work without creating conflict with the version numbers? Regards Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Help with R on windows

2009-11-18 Thread Abhijit Bera
Hi I have managed to link R.dll to my Visual Studio Win32 GUI project. However I am unable to see any of the R messages on a console. I'm hitting a dead end trying to use R_tryEval. Is there a way I can obtain the error message when R_tryEval fails? Regards Abhijit Bera [[altern

[Rd] Help with fPortfolio

2009-11-11 Thread Abhijit Bera
1 stock2 stock3 I don't understand why I'm getting these errors. I tried the same functions using the SWX.RET and LPPDATA2005.RET time series and I got results. Regards Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-pr

Re: [Rd] Help with lang4

2009-10-29 Thread Abhijit Bera
Can't find the source to Rf_lang* series of functions. :| But I'm thinking it should be like this correct me if I'm wrong: PROTECT(e=lang4(install("myfunction"),arg1,arg2,arg3); PROTECT(SETCAR(CDR(e),portConstraints)); PROTECT(portVal=R_tryEval(e,R_GlobalEnv, NULL));

[Rd] Help with lang4

2009-10-29 Thread Abhijit Bera
Hi I seem to have run into a situation where I have more than 3 arguments to pass to a function from C. the following functions help me build an expression for evaluation: lang lang2 lang3 lang4 What should one do if there are more arguments than lang4 can handle? Regards Abhijit Bera

Re: [Rd] Confusion regarding allocating Matrices.

2009-10-24 Thread Abhijit Bera
d copy the data (provided the size is within system limits). In this manner I should be able to reduce the number of expensive operations of allocing and copying. Thanks for your input. Regards Abhijit Bera On Sat, Oct 24, 2009 at 10:06 PM, Douglas Bates wrote: > On Fri, Oct 23, 2009 at 2:0

Re: [Rd] Confusion regarding allocating Matrices.

2009-10-23 Thread Abhijit Bera
dim(m) I get NULL instead of 10 10 So what is happening here? I am aware that R matrices are stored in column major order. Thanks for the tip on using float *dat= REAL(Data); Regards Abhijit Bera On Fri, Oct 23, 2009 at 7:27 PM, Douglas Bates wrote: > On Fri, Oct 23, 2009 at 9:2

[Rd] Confusion regarding allocating Matrices.

2009-10-23 Thread Abhijit Bera
ctions for reallocation incase my data set grows. How do I reallocate? Is it necessary to reallocate or is R handling the memory management for the matrix that I have allocated? Regards Abhijit Bera [[alternative HTML version deleted]] __ R-de

Re: [Rd] How do I access class slots from C?

2009-09-30 Thread Abhijit Bera
way. So, I can do away with all these confusing constructs. :) What about performance? You think I will see a difference if I follow a C only approach of creating all the objects? Regards Abhijit On Wed, Sep 30, 2009 at 12:45 PM, Abhijit Bera wrote: > Hi > > I'm pulling financial

Re: [Rd] How do I access class slots from C?

2009-09-30 Thread Abhijit Bera
romain.franc...@dbmail.com> wrote: > On 09/30/2009 08:51 AM, Abhijit Bera wrote: > >> >> Hi >> >> Thanks all of you for your suggestions. I will put up my code shortly >> based >> on your suggestions. >> >> I wonder how the parsing and eval wil

Re: [Rd] How do I access class slots from C?

2009-09-29 Thread Abhijit Bera
/inst/examples> > > The final few lines are C++ accessing the result, earlier in the code I > assign the weight vector from C++ as you desired from C. All with error > checking / exception handling and what have in under 60 lines of (IMHO more > readable) code -- see below. >

[Rd] How do I access class slots from C?

2009-09-29 Thread Abhijit Bera
slots from C. // Not much is writted on this in the R extensions manual. PROTECT(e=lang3(install("setWeights"),portSpec,portWeights)); PROTECT(portSpec=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang2(install("print"),portSpec)); R_tryEval(e,R_GlobalEnv,NULL); UNPROTECT(3); Rf_endEmbeddedR(0); return 0; } Regards Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Re: [Rd] I want to get a reference to this time series object

2009-09-16 Thread Abhijit Bera
Thanks guys. I see the mistake I was doing. I was forgetting an argument; that's why I wasn't getting the output. "[" is a function. On 9/16/09, mtmor...@fhcrc.org wrote: > > Quoting Abhijit Bera : > > I'm trying to get a reference to this object in

Re: [Rd] I want to get a reference to this time series object

2009-09-16 Thread Abhijit Bera
PM, Romain Francois < romain.franc...@dbmail.com> wrote: > Hi, > > Luckily, R has its own parser, so you don't have to reimplement it. Just > parse your string 'SWX.RET[1:6,c("SBI,"SPI","SII")]' and eval the parsed > expression(s). The R_Par

[Rd] I want to get a reference to this time series object

2009-09-16 Thread Abhijit Bera
I'm trying to get a reference to this object in C SWX.RET[1:6,c("SBI,"SPI","SII")] While i am able to access and use a plain SWX.RET object, I'm getting confused on how to create an object with the array subscripts like above. Here is what I tried to do. It doesn't work because "[" is obviously

Re: [Rd] Clarifications please.

2009-09-15 Thread Abhijit Bera
uot;SPI"),mkString("SII"))); PROTECT(c=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang3(install("["),install("SWX.RET"),c)); PROTECT(portData=R_tryEval(e,R_GlobalEnv,NULL)); PROTECT(e=lang2(install("print"),portData)); R_tryEval(e,R

Re: [Rd] Clarifications please.

2009-09-15 Thread Abhijit Bera
I thought of creating vectors for 1:6 and c("SBI","SPI","SII") But I don't know how to create the object SWX.RET[1:6,c("SBI","SPI","SII")] On Tue, Aug 25, 2009 at 6:11 PM, Abhijit Bera wrote: > Hi > > I think I have ask

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
es.html> > > In the meantime I got your reply. Then I read the documentation and it made > sense! > > Regards > > Abhijit Bera > > > On Fri, Aug 28, 2009 at 6:49 PM, Simon Urbanek < > simon.urba...@r-project.org> wrote: > >> >> On Aug 28, 2009, at 7:41 AM,

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
Hi Simon Thanks. All the confusion between CHAR and STRING. First I read this : http://www1.cuni.cz/~obo/r_surprises.html In the meantime I got your reply. Then I read the documentation and it made sense! Regards Abhijit Bera On Fri, Aug 28, 2009 at 6:49 PM, Simon Urbanek wrote: > >

Re: [Rd] Clarifications please.

2009-08-28 Thread Abhijit Bera
t. strcpy(x,(CHAR(VECTOR_ELT(t2,0))[0])); strcpy(y,(CHAR(VECTOR_ELT(t2,1))[0])); printf("%d * %d\n %s %s \n Matrix:\n",nx,ny,x,y); // The matrix is stored in column major order so // we print it in this manner. // my previous code was incorrect. for(i=0;i wrote

Re: [Rd] Clarifications please.

2009-08-27 Thread Abhijit Bera
ing how to access the different data types using different methods. Regards Abhijit Bera On Wed, Aug 26, 2009 at 10:25 PM, Martin Morgan wrote: > Hi Abhijit -- > > Abhijit Bera wrote: > > Hi Martin > > > > Thanks. I think I got it! Read the R extensions documentation ag

Re: [Rd] Clarifications please.

2009-08-26 Thread Abhijit Bera
can convert * data types b/w R and C */ printf("Matrix:\n"); for(i=0,j=0;i<(nx*ny);i++,j++) { printf("%.4f ",v[i]); if(j==ny-1) { printf("\n"); j=0; } } UNPROTECT(6); return 0; } Regards Abhijit

[Rd] R command line behaving funny

2009-08-25 Thread Abhijit Bera
41923e-07 3.616704e-05 4.108008e-07 9.927796e-06 1.577805e-05 LP60 -2.064749e-06 5.463615e-05 6.150988e-07 1.463853e-05 2.372445e-05 LP60 SBI -2.064749e-06 SPI 5.463615e-05 SII 6.150988e-07 LP25 1.463853e-05 LP40 2.372445e-05 LP60 3.609053e-05 Thanks Abhijit Bera [[alternative HTML version deleted]] __ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

[Rd] Clarifications please.

2009-08-25 Thread Abhijit Bera
mean? 4) From the above code segment, how can I deal with the SEXPREC val which is returned by R_tryEval in the above code and convert it to my own local vector datatype? How do I access the values of val? val will now be a timeseries so how do i convert

[Rd] Help with embedding R

2009-08-07 Thread Abhijit Bera
Hi I plan to use the Rmetrics package in a software tool for risk management written in C. I have some questions regarding embedding R: 1) Can someone elaborate more on R_tryEval? a) I was looking at the Rpackage.c example under the testing/Embedding folder. I vaguely understood that R_tryEval