Go to the SVN repository for this file.
1 /* $Id: thrdrsmp.c 32839 2007-03-05 20:41:55Z kazimird $ 2 *=========================================================================== 5 * National Center for Biotechnology Information 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government have not placed any restriction on its use or reproduction. 14 * Although all reasonable efforts have been taken to ensure the accuracy 15 * and reliability of the software and data, the NLM and the U.S. 16 * Government do not and cannot warrant the performance or results that 17 * may be obtained by using this software or data. The NLM and the U.S. 18 * Government disclaim all warranties, express or implied, including 19 * warranties of performance, merchantability or fitness for any particular 22 * Please cite the author in any work or product based on this material. 24 * =========================================================================== 26 * File Name: thrdrsmp.c 28 * Author: Stephen Bryant 30 * Initial Version Creation Date: 08/16/2000 34 * File Description: threader 38 #pragma warning(disable:4244) // disable double->float warning in MSVC 41 /* Choose randomly from a multinomial distribution */ 49 /*----------------------------------------------------*/ 50 /* pvl: Number and probabilities of parameter values */ 51 /*----------------------------------------------------*/ 53 int i;
/* The i-th offset parameter value will be the choice */ 54 floatc;
/* Cumulative probabilites across parameter values */ 55 float r;
/* A uniform random number on the interval 0 - 1 */ 58 /* for(i=0;i<pvl->n;i++) printf("%.4f ",pvl->p[i]); printf("pvl->p\n"); */ 60 /* r=drand48(); c=0.; */ 64 /* printf("r: %.4f\n",r); */ 66 for(
i=0;
i<pvl->
n;
i++) {
68 /* printf("c: %.4f\n",c); */ 69 if(c>=
r)
return(
i); }
88 /*---------------------------------------------------------------------------- 89 // Returns a uniform deviate between 0.0 and 1.0. 90 // Set idum to any negative value to initialize or reinitialize the sequence. 92 // This is copied from Numerical Recipes, chapter 7.1, 1988. 93 // (ISBN 0-521-35465-X) 94 //--------------------------------------------------------------------------*/ 95 static longix1,ix2,ix3;
101 if(*idum<0 || iff==0) {
103ix1=(
IC1-*idum) %
M1;
108 for(j=1; j<=97; j++) {
118j=1 + ((97*ix3)/
M3);
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4