IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 17, 2009, 12:08:50 PM (17 years ago)
Author:
beaumont
Message:

merged with head

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psMinimizeLMM.c

    r13124 r23352  
    9595    {
    9696        psMemId id = psMemGetId();
    97         psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     97        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
    9898        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
    9999        psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
     
    203203    {
    204204        psMemId id = psMemGetId();
    205         psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     205        psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
    206206        psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
    207207        psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psPolyFit1D.c

    r13337 r23352  
    109109    psVector *xTruth = psVectorAlloc(numData, PS_TYPE_F64);
    110110    psVector *fTruth = psVectorAlloc(numData, PS_TYPE_F64);
    111     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using a known seed
     111    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
    112112    for (int i = 0; i < numData; i++) {
    113113        xTruth->data.F64[i] = (flags & TS00_X_NULL) ? i : 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psPolyFit2D.c

    r17567 r23352  
    108108    yTruth->n = numData;
    109109    fTruth->n = numData;
    110     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
     110    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
    111111    for (int i = 0; i < numData; i++) {
    112112        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psPolyFit3D.c

    r17567 r23352  
    108108    zTruth->n = numData;
    109109    fTruth->n = numData;
    110     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
     110    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
    111111    for (int i = 0; i < numData; i++) {
    112112        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psPolyFit4D.c

    r17567 r23352  
    132132    tTruth->n = numData;
    133133    fTruth->n = numData;
    134     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
     134    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
    135135    for (int i = 0; i < numData; i++) {
    136136        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psRandom.c

    r13123 r23352  
    33work properly.
    44 
    5     ensure that psRandom structs are properly allocated by psRandomAlloc().
     5    ensure that psRandom structs are properly allocated by psRandomAllocSpecific().
    66    ensure that psRandomUniform() produces a sequence of numbers with
    77        proper mean and stdev.
     
    4747    plan_tests(34);
    4848
    49     // ensure that psRandom structs are properly allocated by psRandomAlloc()
     49    // ensure that psRandom structs are properly allocated by psRandomAllocSpecific()
    5050    {
    5151        psMemId id = psMemGetId();
    5252        // Valid type allocation
    53         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    54         ok(myRNG != NULL, "psRandom struct was allocated properly");
    55         skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
    56         ok(myRNG->type == PS_RANDOM_TAUS, "psRandomAlloc() set type properly");
     53        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     54        ok(myRNG != NULL, "psRandom struct was allocated properly");
     55        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
     56        ok(myRNG->type == PS_RANDOM_TAUS, "psRandomAllocSpecific() set type properly");
    5757        psFree(myRNG);
    5858        skip_end();
     
    6363    {
    6464        psMemId id = psMemGetId();
    65         psRandom *myRNG = psRandomAlloc(100,SEED);
    66         ok(myRNG == NULL, "psRandomAlloc() refused to generate psRandom with unallowed type");
     65        psRandom *myRNG = psRandomAllocSpecific(100,SEED);
     66        ok(myRNG == NULL, "psRandomAllocSpecific() refused to generate psRandom with unallowed type");
    6767        psFree(myRNG);
    6868        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    7272    {
    7373        psMemId id = psMemGetId();
    74         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS,-5);
    75         ok(myRNG != NULL, "psRandomAlloc() allows negative seed");
     74        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS,-5);
     75        ok(myRNG != NULL, "psRandomAllocSpecific() allows negative seed");
    7676        psFree(myRNG);
    7777        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    8585        rans->n = rans->nalloc;
    8686        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    87         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    88         ok(myRNG != NULL, "psRandom struct was allocated properly");
    89         skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
     87        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     88        ok(myRNG != NULL, "psRandom struct was allocated properly");
     89        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
    9090
    9191        // Initialize vector data with random number
     
    125125        rans->n = rans->nalloc;
    126126        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    127         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    128         ok(myRNG != NULL, "psRandom struct was allocated properly");
    129         skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
     127        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     128        ok(myRNG != NULL, "psRandom struct was allocated properly");
     129        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
    130130
    131131        // Initialize vector with random data
     
    167167        rans->n = rans->nalloc;
    168168        psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    169         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    170         ok(myRNG != NULL, "psRandom struct was allocated properly");
    171         skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAlloc() failed");
     169        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     170        ok(myRNG != NULL, "psRandom struct was allocated properly");
     171        skip_start(myRNG == NULL, 2, "Skipping tests because psRandomAllocSpecific() failed");
    172172
    173173        // Initialize vector with random data
     
    210210        rans02->n = rans02->nalloc;
    211211
    212         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    213         ok(myRNG != NULL, "psRandom struct was allocated properly");
    214         skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
     212        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     213        ok(myRNG != NULL, "psRandom struct was allocated properly");
     214        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
    215215
    216216
     
    252252    if (0) {
    253253        psRandom *myRNG1 = NULL;
    254         myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     254        myRNG1 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    255255        //    psLogSetDestination("dest:stderr");
    256256        psLogSetDestination(0);
     
    275275        rans02->n = rans02->nalloc;
    276276
    277         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    278         ok(myRNG != NULL, "psRandom struct was allocated properly");
    279         skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
     277        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     278        ok(myRNG != NULL, "psRandom struct was allocated properly");
     279        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
    280280
    281281
     
    325325        rans02->n = rans02->nalloc;
    326326
    327         psRandom *myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
    328         ok(myRNG != NULL, "psRandom struct was allocated properly");
    329         skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAlloc() failed");
     327        psRandom *myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
     328        ok(myRNG != NULL, "psRandom struct was allocated properly");
     329        skip_start(myRNG == NULL, 1, "Skipping tests because psRandomAllocSpecific() failed");
    330330
    331331        // Initialize vectors with random data
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psStats07.c

    r12247 r23352  
    5858    PS_ASSERT_INT_NONNEGATIVE(Npts, NULL);
    5959
    60     //    psRandom *r = psRandomAlloc(PS_RANDOM_TAUS, p_psRandomGetSystemSeed());
    61     psRandom *r = psRandomAlloc(PS_RANDOM_TAUS, PS_XXX_GAUSSIAN_SEED);
     60    //    psRandom *r = psRandomAllocSpecific(PS_RANDOM_TAUS, p_psRandomGetSystemSeed());
     61    psRandom *r = psRandomAllocSpecific(PS_RANDOM_TAUS, PS_XXX_GAUSSIAN_SEED);
    6262    psVector* gauss = psVectorAlloc(Npts, PS_TYPE_F32);
    6363    for (unsigned int i = 0; i < Npts; i++) {
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psStats09.c

    r12783 r23352  
    5252    srand(SEED);
    5353
    54     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     54    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
    5555    psVector *truth = psVectorAlloc(numData, PS_TYPE_F64);
    5656    for (long i = 0; i < numData; i++) {
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tap_psStatsTiming.c

    r12513 r23352  
    2020
    2121    // build a gauss-deviate vector (mean = 0.0, sigma = 1.0) for tests
    22     psRandom *seed = psRandomAlloc (PS_RANDOM_TAUS, 0);
     22    psRandom *seed = psRandomAllocSpecific (PS_RANDOM_TAUS, 0);
    2323    psVector *rnd = psVectorAlloc (1000, PS_TYPE_F32);
    2424    for (int i = 0; i < rnd->n; i++) {
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psMinimizeLMM.c

    r11686 r23352  
    6666    psBool testStatus = true;
    6767
    68     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     68    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
    6969    psMinimization *min = psMinimizationAlloc(NUM_ITERATIONS, ERR_TOL);
    7070    psArray *ordinates = psArrayAlloc(NUM_DATA_POINTS);
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psPolyFit1D.c

    r11686 r23352  
    101101    xTruth->n = numData;
    102102    fTruth->n = numData;
    103     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using a known seed
     103    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using a known seed
    104104    for (int i = 0; i < numData; i++) {
    105105        xTruth->data.F64[i] = (flags & TS00_X_NULL) ? i : 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psPolyFit2D.c

    r11686 r23352  
    100100    yTruth->n = numData;
    101101    fTruth->n = numData;
    102     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
     102    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using an RNG with a known seed
    103103    for (int i = 0; i < numData; i++) {
    104104        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psPolyFit3D.c

    r11686 r23352  
    103103    zTruth->n = numData;
    104104    fTruth->n = numData;
    105     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
     105    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
    106106    for (int i = 0; i < numData; i++) {
    107107        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psPolyFit4D.c

    r11686 r23352  
    124124    tTruth->n = numData;
    125125    fTruth->n = numData;
    126     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Using known seed
     126    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Using known seed
    127127    for (int i = 0; i < numData; i++) {
    128128        xTruth->data.F64[i] = 2.0*psRandomUniform(rng) - 1.0;
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psRandom.c

    r6484 r23352  
    33work properly.
    44 
    5     t00(): ensure that psRandom structs are properly allocated by psRandomAlloc().
     5    t00(): ensure that psRandom structs are properly allocated by psRandomAllocSpecific().
    66    t01(): ensure that psRandomUniform() produces a sequence of numbers with
    77    proper mean and stdev.
     
    4545
    4646testDescription tests[] = {
    47                               {testRandomAlloc,000,"psRandomAlloc",0,false},
     47                              {testRandomAlloc,000,"psRandomAllocSpecific",0,false},
    4848                              {testRandomUniform,000,"psRandomUniform",0,false},
    4949                              {testRandomGaussian,000,"psRandomGaussian",0,false},
     
    7070
    7171    // Valid type allocation
    72     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     72    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    7373    if (myRNG == NULL) {
    7474        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    8585    //    psLogSetDestination("file:seed_msglog1.txt");
    8686    psLogSetDestination(fd1);
    87     myRNG = psRandomAlloc(PS_RANDOM_TAUS, 0);
     87    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, 0);
    8888    //    psLogSetDestination("dest:stderr");
    8989    psLogSetDestination(2);
     
    100100    // Invalid type allocation
    101101    psLogMsg(__func__,PS_LOG_INFO,"Invalid type, should generate error message");
    102     myRNG = psRandomAlloc(100,SEED);
     102    myRNG = psRandomAllocSpecific(100,SEED);
    103103    if (myRNG != NULL) {
    104104        psError(PS_ERR_UNKNOWN,true,"Did not return NULL for invalid type");
     
    107107
    108108    // Negative seed value
    109     myRNG = psRandomAlloc(PS_RANDOM_TAUS,-5);
     109    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS,-5);
    110110    if(myRNG == NULL) {
    111111        psError(PS_ERR_UNKNOWN,true,"Did not return allocated psRandom");
     
    125125    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    126126
    127     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     127    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    128128    if (myRNG == NULL) {
    129129        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    171171    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    172172
    173     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     173    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    174174    if (myRNG == NULL) {
    175175        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    219219    psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    220220
    221     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     221    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    222222    if (myRNG == NULL) {
    223223        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    268268    rans02->n = rans02->nalloc;
    269269
    270     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     270    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    271271    if (myRNG == NULL) {
    272272        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    302302
    303303    psRandom *myRNG1 = NULL;
    304     myRNG1 = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     304    myRNG1 = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    305305    //    psLogSetDestination("dest:stderr");
    306306    psLogSetDestination(0);
     
    326326    rans02->n = rans02->nalloc;
    327327
    328     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     328    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    329329    if (myRNG == NULL) {
    330330        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
     
    372372    rans02->n = rans02->nalloc;
    373373
    374     myRNG = psRandomAlloc(PS_RANDOM_TAUS, SEED);
     374    myRNG = psRandomAllocSpecific(PS_RANDOM_TAUS, SEED);
    375375    if (myRNG == NULL) {
    376376        psError(PS_ERR_UNKNOWN,true,"Could not allocate psRandom structure");
  • branches/cnb_branches/cnb_branch_20090301/psLib/test/math/tst_psStats09.c

    r11686 r23352  
    5252    printPositiveTestHeader(stdout, "psMathUtils functions", "psVectorStats Clipped Stats Routine");
    5353
    54     psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
     54    psRandom *rng = psRandomAllocSpecific(PS_RANDOM_TAUS, 1); // Random number generator; using known seed
    5555    psVector *truth = psVectorAlloc(numData, PS_TYPE_F64);
    5656    truth->n = numData;
Note: See TracChangeset for help on using the changeset viewer.