kiss.c File Reference

#include <math.h>
#include "machine.h"
#include "sciprint.h"

Include dependency graph for kiss.c:

Go to the source code of this file.

Defines

#define znew   (z=36969*(z&65535)+(z>>16))
#define wnew   (w=18000*(w&65535)+(w>>16))
#define MWC   ((znew<<16)+wnew )
#define CONG   (jcong=69069*jcong+1234567)
#define SHR3   (jsr^=(jsr<<17), jsr^=(jsr>>13), jsr^=(jsr<<5))
#define KISS   ((MWC^CONG)+SHR3)

Functions

unsigned long kiss ()
void sciprint __PARAMS ((char *fmt,...))
int set_state_kiss (double g1, double g2, double g3, double g4)
void get_state_kiss (double g[])

Variables

static unsigned long z = 362436069
static unsigned long w = 521288629
static unsigned long jsr = 123456789
static unsigned long jcong = 380116160


Define Documentation

#define CONG   (jcong=69069*jcong+1234567)

Definition at line 35 of file kiss.c.

#define KISS   ((MWC^CONG)+SHR3)

Definition at line 37 of file kiss.c.

Referenced by kiss(), and RandI().

#define MWC   ((znew<<16)+wnew )

Definition at line 34 of file kiss.c.

#define SHR3   (jsr^=(jsr<<17), jsr^=(jsr>>13), jsr^=(jsr<<5))

Definition at line 36 of file kiss.c.

#define wnew   (w=18000*(w&65535)+(w>>16))

Definition at line 33 of file kiss.c.

#define znew   (z=36969*(z&65535)+(z>>16))

Definition at line 32 of file kiss.c.


Function Documentation

void sciprint __PARAMS ( (char *fmt,...)   ) 

void get_state_kiss ( double  g[]  ) 

Definition at line 71 of file kiss.c.

References jcong, jsr, w, and z.

Referenced by RandI().

00072 {
00073   g[0] = (double) z;
00074   g[1] = (double) w;
00075   g[2] = (double) jsr;
00076   g[3] = (double) jcong;
00077 }

Here is the caller graph for this function:

unsigned long kiss (  ) 

Definition at line 42 of file kiss.c.

References KISS.

00043 {
00044   return ( KISS );
00045 }

int set_state_kiss ( double  g1,
double  g2,
double  g3,
double  g4 
)

Definition at line 49 of file kiss.c.

References jcong, jsr, long, sciprint(), w, and z.

Referenced by RandI().

00050 {
00051   if (g1 == floor(g1) && g2 == floor(g2) && 
00052       g3 == floor(g3) && g4 == floor(g4) &&  
00053       0.0 <= g1 && g1 <= 4294967295.0 &&
00054       0.0 <= g2 && g2 <= 4294967295.0 &&
00055       0.0 <= g3 && g3 <= 4294967295.0 &&
00056       0.0 <= g4 && g4 <= 4294967295.0 )
00057     {
00058           z = (unsigned long) g1;
00059           w = (unsigned long) g2;
00060         jsr = (unsigned long) g3;
00061       jcong = (unsigned long) g4;
00062       return ( 1 );
00063     }
00064   else
00065     {
00066       sciprint("\n\r bad seeds for kiss, must be integers in [0,2^32-1]\n\r");
00067       return ( 0 );
00068     }
00069 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

unsigned long jcong = 380116160 [static]

Definition at line 40 of file kiss.c.

Referenced by get_state_kiss(), and set_state_kiss().

unsigned long jsr = 123456789 [static]

Definition at line 40 of file kiss.c.

Referenced by get_state_kiss(), and set_state_kiss().

unsigned long w = 521288629 [static]

Definition at line 40 of file kiss.c.

unsigned long z = 362436069 [static]

Definition at line 40 of file kiss.c.

Referenced by c_abs(), c_cos(), c_exp(), c_log(), c_sin(), c_sqrt(), callf(), cds(), clcg2(), createblklist(), d_cnjg(), d_imag(), d_mod(), delay4(), dmtree(), drawGrayplotEntity(), DrawMerge3d(), dsort(), dsslti4(), edgetrig(), f_back(), fcoldg(), Fibo_sim(), get_state_kiss(), intsplin3d(), l_write(), lbit_cshift(), mkbitcon(), Objmove(), plot3dn(), qbit_cshift(), r_cnjg(), r_imag(), r_mod(), sci_beta(), sciblk4(), set_state_kiss(), therm_sim(), wr_equiv_init(), XmuAreaAnd(), XmuAreaCopy(), XmuAreaNot(), XmuAreaOrXor(), XmuDestroyScanlineList(), XmuDestroySegmentList(), XmuOptimizeScanline(), XmuScanlineAnd(), XmuScanlineAndSegment(), XmuScanlineCopy(), XmuScanlineEqu(), XmuScanlineNot(), XmuScanlineOr(), XmuScanlineOrSegment(), XmuScanlineXor(), XmuScanlineXorSegment(), XmuValidScanline(), z_abs(), z_cos(), z_exp(), z_log(), z_sin(), z_sqrt(), and zoom_box().


Generated on Sun Mar 4 16:11:28 2007 for Scilab [trunk] by  doxygen 1.5.1