From bdc0e550448f04c7c8f030b7421209bae37e651d Mon Sep 17 00:00:00 2001 From: Dongdong Li Date: Fri, 22 Nov 2013 11:32:14 -0800 Subject: Add .svn file so other people can keep update with changes from Stanford Code Review: Issue 103001 [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 17411] --- ...5d8312fc0bb109518f6bfc62cbbf814c7d587c.svn-base | 112 +++++++++++++++++++++ ...e96ce60fa5bdc9726f48b5186ae562fcd4bbeb.svn-base | 53 ++++++++++ 2 files changed, 165 insertions(+) create mode 100644 src/intersim2/.svn/pristine/13/135d8312fc0bb109518f6bfc62cbbf814c7d587c.svn-base create mode 100644 src/intersim2/.svn/pristine/13/13e96ce60fa5bdc9726f48b5186ae562fcd4bbeb.svn-base (limited to 'src/intersim2/.svn/pristine/13') diff --git a/src/intersim2/.svn/pristine/13/135d8312fc0bb109518f6bfc62cbbf814c7d587c.svn-base b/src/intersim2/.svn/pristine/13/135d8312fc0bb109518f6bfc62cbbf814c7d587c.svn-base new file mode 100644 index 0000000..27428d9 --- /dev/null +++ b/src/intersim2/.svn/pristine/13/135d8312fc0bb109518f6bfc62cbbf814c7d587c.svn-base @@ -0,0 +1,112 @@ +/* This program by D E Knuth is in the public domain and freely copyable. + * It is explained in Seminumerical Algorithms, 3rd edition, Section 3.6 + * (or in the errata to the 2nd edition --- see + * http://www-cs-faculty.stanford.edu/~knuth/taocp.html + * in the changes to Volume 2 on pages 171 and following). */ + +/* N.B. The MODIFICATIONS introduced in the 9th printing (2002) are + included here; there's no backwards compatibility with the original. */ + +/* This version also adopts Brendan McKay's suggestion to + accommodate naive users who forget to call ranf_start(seed). */ + +/* If you find any bugs, please report them immediately to + * taocp@cs.stanford.edu + * (and you will be rewarded if the bug is genuine). Thanks! */ + +/************ see the book for explanations and caveats! *******************/ +/************ in particular, you need two's complement arithmetic **********/ + +#define KK 100 /* the long lag */ +#define LL 37 /* the short lag */ +#define mod_sum(x,y) (((x)+(y))-(int)((x)+(y))) /* (x+y) mod 1.0 */ + +double ran_u[KK]; /* the generator state */ + +#ifdef __STDC__ +void ranf_array(double aa[], int n) +#else +void ranf_array(aa,n) /* put n new random fractions in aa */ + double *aa; /* destination */ + int n; /* array length (must be at least KK) */ +#endif +{ + register int i,j; + for (j=0;j=1.0) ss-=1.0-2*ulp; /* cyclic shift of 51 bits */ + } + u[1]+=ulp; /* make u[1] (and only u[1]) "odd" */ + for (s=seed&0x3fffffff,t=TT-1; t; ) { + for (j=KK-1;j>0;j--) + u[j+j]=u[j],u[j+j-1]=0.0; /* "square" */ + for (j=KK+KK-2;j>=KK;j--) { + u[j-(KK-LL)]=mod_sum(u[j-(KK-LL)],u[j]); + u[j-KK]=mod_sum(u[j-KK],u[j]); + } + if (is_odd(s)) { /* "multiply by z" */ + for (j=KK;j>0;j--) u[j]=u[j-1]; + u[0]=u[KK]; /* shift the buffer cyclically */ + u[LL]=mod_sum(u[LL],u[KK]); + } + if (s) s>>=1; else t--; + } + for (j=0;j=0? *ranf_arr_ptr++: ranf_arr_cycle()) +double ranf_arr_cycle() +{ + if (ranf_arr_ptr==&ranf_arr_dummy) + ranf_start(314159L); /* the user forgot to initialize */ + ranf_array(ranf_arr_buf,QUALITY); + ranf_arr_buf[KK]=-1; + ranf_arr_ptr=ranf_arr_buf+1; + return ranf_arr_buf[0]; +} + +#include +int main() +{ + register int m; double a[2009]; /* a rudimentary test */ + ranf_start(310952); + for (m=0;m<2009;m++) ranf_array(a,1009); + printf("%.20f\n", ran_u[0]); /* 0.36410514377569680455 */ + /* beware of buggy printf routines that do not give full accuracy here! */ + ranf_start(310952); + for (m=0;m<1009;m++) ranf_array(a,2009); + printf("%.20f\n", ran_u[0]); /* 0.36410514377569680455 */ + return 0; +} diff --git a/src/intersim2/.svn/pristine/13/13e96ce60fa5bdc9726f48b5186ae562fcd4bbeb.svn-base b/src/intersim2/.svn/pristine/13/13e96ce60fa5bdc9726f48b5186ae562fcd4bbeb.svn-base new file mode 100644 index 0000000..42bee23 --- /dev/null +++ b/src/intersim2/.svn/pristine/13/13e96ce60fa5bdc9726f48b5186ae562fcd4bbeb.svn-base @@ -0,0 +1,53 @@ +// $Id$ + +/* + Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef _BOOKSIM_CONFIG_HPP_ +#define _BOOKSIM_CONFIG_HPP_ + +#include "config_utils.hpp" + +class BookSimConfig : public Configuration { +protected: + +public: + BookSimConfig( ); +}; + +#endif + +#ifndef _POWER_CONFIG_HPP_ +#define _POWER_CONFIG_HPP_ + +#include "config_utils.hpp" + +class PowerConfig : public Configuration { +public: + PowerConfig( ); + +}; + +#endif -- cgit v1.3