Thank you very much! In fact the trouble was between malloc() and free()!
Type: Posts; User: violatro
Thank you very much! In fact the trouble was between malloc() and free()!
I tried the following inside "func" (hence wothout using the function matrix)
double func()
{
int n=1;
double **P;
P = (double **) malloc((n + 1)*sizeof(double *));
for (i =...
Hi guys,
I am using some a piece of code that blows up the memory usage. The function is the following
static double ** matrix(int nrh, int nch)
{
int i;
double **m;
m =...
In real data sets it takes about 2 minutes (the number of operations is about 10^10). I sharpened a lot the origininal Fortran code (written not by me) and I cutted down a lot the time. Now I am...
I compiled it by hand and I gained 3-4 seconds! Thank you!
I am aware of this. I tried to find out some optimized function for computing the exp(x), but I only fond some approximation to exp(x) (that indeed speed up the code). As far as you know, is there...
Thank you gusy for the quick and interesting replies.
I will try to answer to all of you.
I tried the "pointer" trick, i.e. *f++=s but it did not improve the speed at all.
As I told in the first...
I guys, I have this function that computes the kernel density estimate. Since both *neval and *nx are O(n^4) I am trying to optimize the function but up to now I did not get better results (for...
awesome! Now the code takes half of the time. I did not put the inline function in the header, but after your advise I did it and it works! Thank you!
Hi guys,
I have a bigger function that calls, in mean 1000-2000 times, a smaller function. I "discover" that calling the smaller function make the code very slow. Is there any hint to fix it? I read...
I have fixed it editing the source code. I thought that it was a reliable source, but it was not!
ok, thank you guys for the lectures and the suggestions!
ok, that was my guess...but it works in C. Calling the shared library in R causes this. Ok, for the moment forget about this...
The point is that I can't allocate in this way
static struct...
Thank you guys...This is a new "topic" for me because, up to now, I took care about my segmentation faults..
I compile with this string in order to create an executable to run in gdb: gcc...
Hi guys...another "bad new"...I was compiling some code and checking it within C and everithing was ok...but when I compile the code in order to use it inside R there something wrong.
This is what I...
indeed, they are (at least after running the sample program above).
This is a very good remark, to keep in mind (at least for me)
Thanks!
very wise suggestion!
int main()
{
int array[2], scalar;
printf("%p %p\n",&array,&array[0]);
printf("%p %p\n",array,&array);
}
indeed..I have changed it with foo(array) :-)
oh, now is very clear why this "trick" is not working with scalars :-) (but actually they also have a memory address...). Thanks a lot! Now I can save a lot of lines in my codes
mmmhh, actually if I put array the program is working (with std=gnu99)...well I have discovered something new.
Thanks a lot!
solved! Usually I compile with this
gcc -std=gnu99 -shared ...
but keeping the default standard
gcc -shared ...
the compiler does not complain anymore
Actually I do not know what is the...
Hi guys...as you can see I have a lot of questions about C...
Today I was changing my functions and I got complains from the compiler. This is the question: I have a function that takes one...
Thank you guys for the support. now all is working. I have to change a bit something into my functions in order to do all the heavy "work" inside them.
with this "minor" modification the function is working well (I add loops to fill the arrays)
void cb_WLS(double *res, double *y, double *X, double *W, int *length_y, int *length_beta)
{
int...
memset() is very interesting and solves some of the problems that I had some time ago! Thanks...
no I am saying that I am wasting in speed. To fill up arrays for, say, 1000 iterations is time...
it is about 20 seconds...but with wrong results