IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 9, 2007, 10:05:32 AM (19 years ago)
Author:
Paul Price
Message:

Adding assertion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/math/psRandom.h

    r14452 r15261  
    77 * @author GLG, MHPCC
    88 *
    9  * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    10  * @date $Date: 2007-08-09 01:40:07 $
     9 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     10 * @date $Date: 2007-10-09 20:05:32 $
    1111 *
    1212 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3737 *  Contains information on the psRandom type and GNU Scientific Library random number generator.
    3838 */
    39 typedef struct
    40 {
     39typedef struct {
    4140    psRandomType type;                 ///< The type of RNG
    4241    gsl_rng *gsl;                      ///< The RNG itself
    43 }
    44 psRandom;
     42} psRandom;
    4543
    4644psU64 p_psRandomGetSystemSeed();
    4745
    4846/** Allocates a psRandom struct.
    49  * 
     47 *
    5048 *  @return psRandom*:    A new psRandom structure.
    5149 */
     
    5654
    5755/** Resets an existing psRandom struct.
    58  * 
     56 *
    5957 *  @return void
    6058 */
     
    6664/** Random number generator based on a uniform distribution on [0,1).
    6765 *  Uses gsl_rng_uniform.
    68  * 
     66 *
    6967 *  @return double:     Random number.
    7068 */
     
    7573/** Random number generator based on a Gaussian deviate, N(0,1).
    7674 *  Uses gsl_ran_gaussian.
    77  * 
     75 *
    7876 *  @return double:     Random number.
    7977 */
     
    8482/** Random number generator based on a Gaussian deviate, N(0,1).
    8583 *  Uses gsl_ran_gaussian.
    86  * 
     84 *
    8785 *  XXX: I created this since the above psLib spec for p_psRandomGaussian
    8886 *  had no argument for sigma.  Verify that with IfA.
    89  * 
     87 *
    9088 *  @return double:     Random number.
    9189 */
     
    9795/** Random number generator based on a Poisson distribution with the given mean.
    9896 *  Uses gsl_ran_poisson.
    99  * 
     97 *
    10098 *  @return double:     Random number.
    10199 */
     
    105103);
    106104
     105#define PS_ASSERT_RANDOM_NON_NULL(NAME, RVAL) \
     106if (!(NAME) || !(NAME)->gsl) { \
     107    psError(PS_ERR_UNEXPECTED_NULL, true, "Error: Random number generator %s is NULL", #NAME); \
     108    return RVAL; \
     109}
     110
    107111/// @}
    108112#endif // #ifndef PS_RANDOM_H
Note: See TracChangeset for help on using the changeset viewer.