![]() |
| | #1 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Fastest Sigmoid Function 1. The input is a 0.0f terminated array of double's between negative and positive infinity inclusive. 2. The output is a 0.0f terminated array of doubles between -1.0 and +1.0 and must exhibit the classic properties of a sigmoid. Specifically it must have an S shaped curve and approach +- 1.0 as the input approaches +- infinity. 3. You can use C, C++ or ASM. You can use any combination of those three. 4. The result must be deterministic, i.e. it must produce the same output for the same input every time. 5. For the purposes of testing all code must compile under VC++ 6.0 6. Points will be given for the fastest (most iterations per unit of time). Score will be equal to the number of iterations per second. 7. ASM only solutions will also recieve bonus points for smallest total bytes. 8. For testing the specific processor is - Intel Xeon 3.20GHz Family F Model 4 Stepping 3 Revision N0 MMX SSE SSE2 SSE3 EM64T Irwindale Socket 604 mPGA 90 nm technology @ 2.048v 9. No weasel code. This means you Rashakil. The test itself will be multiple runs testing 1 billion iterations of the routine with random inputs. If the top two or more entries have run times closer than 5% in duration, an extended test will be run on those entries only.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-10-2007 at 01:24 PM. |
| abachler is offline | |
| | #2 |
| aoeuhtns Join Date: Jul 2005
Posts: 581
| Could you be mathematically precise as to what you mean by "the classic properties of a sigmoid"? Be sure to keep in mind floating point precision (e.g. what exactly are the properties of an "inflection point" in a floating point context.) Also, you should be precise as to what the probability distribution of inputs will be as far as "random inputs" are concerned. Otherwise, victory could end up being luck-based. Edit: This should satisfy the rules you have given so far. It approximates the sigmoid function arctan(x)/((((((((100!)!)!)!)!)!)!)!) to the limits of double precision. Code: double sigmoid(double x) { return 0.0; }
__________________ There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary. Last edited by Rashakil Fol; 07-09-2007 at 06:20 PM. |
| Rashakil Fol is offline | |
| | #4 | ||||
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| GPU is an 8800 GTX with 768MB. I suppose if we are going to have GPU entries I will have to provide the entire data set to make it fair. So, I will modify the rules to read - 1. The input is a 0.0f terminated array of double's between negative and positive infinity inclusive. 2. The output is a 0.0f terminated array of doubles between -1.0 and +1.0 and must exhibit the classic properties of a sigmoid. Specifically it must have an S shaped curve and approach +- 1.0 as the input approaches +- infinity. 7. ASM only solutions will also recieve bonus points for smallest total bytes. 9. No weasel code. Quote:
Quote:
Quote:
Quote:
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-10-2007 at 09:15 AM. | ||||
| abachler is offline | |
| | #5 |
| Amazingly beautiful user. Join Date: Jul 2005 Location: If you knew I'd have to kill you
Posts: 251
| I'd like to compete, using some ASM, but I do not have an available copy of Windows. Can you extend compilers to allowing something GCC based (also pertains to the latest standard, as opposed to VC++ 6.0)?
__________________ Programming Your Mom. http://www.dandongs.com/ |
| CrazyNorman is offline | |
| | #6 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,381
| Quote:
| |
| brewbuck is offline | |
| | #7 | |
| aoeuhtns Join Date: Jul 2005
Posts: 581
| My function approximates one with a single inflection point just fine. Anyway, here's an implementation that accurately represents the function 2arctan(x/(((((((100!)!)!)!)!)!)!)!))/pi, a sigmoid with one inflection point which has asymptotes -1 and 1: Code: double sigmoid(double x) { return 0.0; }
Quote:
Code: double sigmoid(double x) { return atan(x); }
Also, where do you think its inflection point is? And where's the inflection point of the following function: Code: double sigmoid(double x) {
if (fabs(x) < -3.357e-10) {
return x;
}
else {
return atan(x);
}
}
__________________ There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary. Last edited by Rashakil Fol; 07-10-2007 at 12:32 PM. | |
| Rashakil Fol is offline | |
| | #8 | |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Quote:
As for rashikil's lame attempts to prove his intelligence, Id say he has succeeded, although not in the way he probably intended. defines a line with slope 0.0 and zero inflection points. Since an input of infinity into your equation produces erronious results, it is hence disqualified.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-10-2007 at 01:14 PM. | |
| abachler is offline | |
| | #9 |
| Amazingly beautiful user. Join Date: Jul 2005 Location: If you knew I'd have to kill you
Posts: 251
| I was planning on using inline ASM. As not being part of the standard language, GCC and VC++ use a different syntax for inline ASM, plus GCC uses AT&T style ASM (src dst), while VC++ uses Intel style (dst src).
__________________ Programming Your Mom. http://www.dandongs.com/ |
| CrazyNorman is offline | |
| | #10 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| as long as you let me know that, and the code isnt too long, I think I can manage to touch it up for testing.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #11 | |
| aoeuhtns Join Date: Jul 2005
Posts: 581
| Quote:
But, if you insist... Code: double sigmoid(double x) { return (x > 0) - (x < 0); }
Edit: Of course, this would have to be modified if the input is an array of numbers now.
__________________ There are 10 types of people in this world, those who cringed when reading the beginning of this sentence and those who salivated to how superior they are for understanding something as simple as binary. | |
| Rashakil Fol is offline | |
| | #12 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| Well, im tired of you claiming this as an entry, so heres the deal. Return 0.0 does not compute a sigmoid. return (x > 0) - (x < 0) returns type bool or an integer depending on your compiler, so it violates rule #2 even as originally defined. Even if you recast it as a double, it would fail based on the requirement that the output exhibit 'the classical properties of a sigmoid'. i.e. a non-zero slope at all points. entry disqualified. Before you try to provide some other entry, please go read what a sigmoid function actually is. Its a very specific type of function that none of your entries even approximate as you claim.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-10-2007 at 03:01 PM. |
| abachler is offline | |
| | #13 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| You can specify if you want the function to be called sequentially, or to be passed the array. The array is to make it fair for GPU entries, since they generally process several data points at once.
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet |
| abachler is offline | |
| | #14 | |
| Registered User Join Date: Apr 2006 Location: United States
Posts: 3,202
| omg optimized sigmoids I still find it confusing frankly. I can't help but feel that you are ignoring what Rakashil Fol is really attempting to say. Quote:
If the goal of the contest were to plot a sigmoid, then the fastest entry would not actually draw a sigmoid at all, but instead calculate where to plot. Nevermind whether doubles are appropriate for this purpose. Do you intend to write code that would draw a sigmoid curve based on the output, or will those kinds be disqualified also? Would that be weasel code? | |
| whiteflags is offline | |
| | #15 |
| Rampaging 35 Stone Welsh Join Date: Apr 2007
Posts: 2,929
| No, I use sigmoids all the time. Rashakil is trying to use 'return 0;' style weasel code and then claim it computes a sigmoid. It performs no calculation whatsoever, sigmoid or otherwise. The requirement only to exhibit the features of a sigmoid was intentionally left vague to allow for creative entries, not to act as a loophole for rules lawyers. Yes I understand that a floating point number cant quantize infinite granularity. However the data set returned by ALL his entries fail on multiple points, and yet he refuses to accept that they are not valid entries. I changed the rules, not because they were flawed, but just to spell it out in really small words that even a retarded gorilla can understand that entries must actually compute a sigmoid, not just return a fixed value. Hey im sorry I didnt put in the rule about no weasel code up front. I honestly expected people to submit realistic entries, not to try to claim that since some specific subset of a function cannot be computed within the limits of the hardware, that therefor all attempts at computing any function of that type in hardware can be represetned by a single fixed value. so for those of you that want ot exploit the limitations of the hardware to avoid actual computation, here is a specific requirement of the function. For all sets of 3 points a , b , and c where a < b < c and all 3 points are in either the positive or negative domain ,the following three conditions must be met: 1. f(a) < f(b) < f(c) 2. the slopes of the function of a , b , c (sa , sb , sc) must exhibit the quality of sa > sb > sc for sets of positive numbers 3. the slopes of the function of a , b , c (sa , sb , sc) must exhibit the quality of sa < sb < sc for sets of negative numbers
__________________ He is free, you say. Ah! That is his misfortune… These men… [have] the most terrible, the most imperious of masters, that is, need. … They must therefore find someone to hire them, or die of hunger. Is that to be free? - Simon Linguet Last edited by abachler; 07-10-2007 at 03:53 PM. |
| abachler is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Compiling sample DarkGDK Program | Phyxashun | Game Programming | 6 | 01-27-2009 03:07 AM |
| Seg Fault in Compare Function | tytelizgal | C Programming | 1 | 10-25-2008 03:06 PM |
| Another syntax error | caldeira | C Programming | 31 | 09-05-2008 01:01 AM |
| How to fix misaligned assignment statements in the source code? | biggyK | C++ Programming | 28 | 07-16-2006 11:35 PM |
| const at the end of a sub routine? | Kleid-0 | C++ Programming | 14 | 10-23-2005 06:44 PM |