Hi
I am having trouble trying to read in name, value pair data from a text file. I want each name and value on each line and be able to check the value of each name or value indepently (stored in sep varables). I seem to have tied myself in knots trying to get this working.
#!/usr/bin/perl...
Just to follow up, I managed to play around and replace the fmod with a floor function with modifications. This seems to run a little quicker. I guess it is much easier to calculate than fmod or so it would seem!
Thanks again guys!
Hi
In my efforts to speed things up somewhat I would like to output an integer (1) if x > Xmax or x < 0, but if x is between the limits 0 to Xmax then will return. Obviously I can write withif then and have done so, but as this routine is being called billions of times any potential time saving...
Typical length of time is 1 week. Complex simulation, so you can imagine the typical time saving that removing a slow expression. I might be called fmod 1 Billion times so if I can avoid using it and replace with something quicker than that would be an advantage.
As for processing power, we...
How can I introduce timing for a routine/loop in C, I seem to see so many conflicting and not working examples on the web. I can time in seconds but some of these processes are lasting less than a second so it does not help with my optimisation. Could some point to some useful code that will...
I have the for loop working just fine and hence the copying function works fine. However the memcpy function causes a segmentation fault and I just cannot see from where it would occur, the sizes should be ok.
1. yes of course I can change the code, but there are limits to what I can do. Integrity of data remains at the foremost.
This is a well used funtion in the program which is why I am udertaking the speed analysis. The code is for a numerical simuation and hence at every move the mod has the...
I have explicitly listed how the arrays have been defined below.
the source array is passed to the function handling the opy with the following form:
void cop_fun (double ***ptrBeadArray)
ptrBeadArrayOld = (double **)malloc(BeadTotal * sizeof(double *));
for (i = 0; i< BeadTotal; i++)...
I am using the script to run through a series of combinations which will be inserted into files and then run using awk for example. However I have a complicated range of numbers and have listed them in an array which I can loop through. I can think of a better or smarter way to do it, I just...
Hi
I am keen to create an array which stores real numbers which I can then loop through. I have tried using the bash script, but I cant see any literature which states whether I can actually get real numbers into the arrays. The sort of code I have put together is:
#!/bin/bash
KT[1]= 1.0
or...
It might be micro-optimisation, but faced with limited scope for changing the code, it makes sense to try particularly with repeated commands as a small time saving is multiplied.
How do you suggest placing timers into the code to time execution of certain elements?
Is there a quicker alternative that someone knows about?
is it quicker in peoples experience to use ifs?
fmod((xpos + Xbox), Xbox)
ALSO
I am toggling between 0 and 1, I use the following code
(currenttoggle + 1) % 2;
which works fine, however I am looking for speed-up.
Any ideas?
Cheers
Hi
I have some simulation code which passes all arrays by reference to the required function block. I have avoided global variables even though this would be the easiest method and therefore I have functions which are being send maybe 10-15 arrays and the headers are quite cumbersome. However...
Hi
I am repeatedly copying the array elements from old array to new array, performing operations on the new array (changing) in the process and then determining whether or not use the new array values or the old ones. To speed things up what I do is create a new array and using pointers...
Hi I wish to alternately change some of the data in the following way. For example I wish to switch all species from their current value to their binary opposite. I.e. from 1 -> 0 and from 0 -> 1 when the LIPID number is even. Now the data is on the file such that the LIPID number is before the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.