Changeset f4016fe in tol


Ignore:
Timestamp:
Feb 4, 2009, 7:56:20 PM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
f4a032f
Parents:
3993889
Message:

Checking allocated memory in bRd_rand and cRt_rand

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@591 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/vmatrix_type/vmat_stats.cpp

    r3993889 rf4016fe  
    378378  ( nrow, ncol, nrow, CHOLMOD_REAL, common_);
    379379  int k;
    380   double* x = (double*)dense->x;
    381   for(k=0; k<dense->nzmax; k++)
    382   {
    383     x[k] = xu.Random().Value();
     380  if(dense)
     381  {
     382    double* x = (double*)dense->x;
     383    for(k=0; k<dense->nzmax; k++)
     384    {
     385      x[k] = xu.Random().Value();
     386    }
    384387  }
    385388  return(dense);
    … …  
    398401  cholmod_triplet* triplet = cholmod_allocate_triplet
    399402  ( nrow, ncol, nzmax, 0, CHOLMOD_REAL, common_);
    400   int k;
    401   int* i = (int*)triplet->i;
    402   int* j = (int*)triplet->j;
    403   double* x = (double*)triplet->x;
    404   for(k=0; k<nzmax; k++)
    405   {
    406     p.r_ = (int)::Round(iu.Random()).Value();
    407     p.c_ = (int)::Round(ju.Random()).Value();
    408   //BHashPairs::const_iterator fc = hashPairs.find(p);
    409   //if(fc==hashPairs.end())
    410     {
    411       i[k] = p.r_;
    412       j[k] = p.c_;
    413       x[k] = dist.Random().Value();
    414       if(x[k]!=0.0)
    415       {
    416         triplet->nnz++;
    417       //hashPairs[p] = x[k];
     403  if(triplet)
     404  {
     405    int k;
     406    int* i = (int*)triplet->i;
     407    int* j = (int*)triplet->j;
     408    double* x = (double*)triplet->x;
     409    for(k=0; k<nzmax; k++)
     410    {
     411      p.r_ = (int)::Round(iu.Random()).Value();
     412      p.c_ = (int)::Round(ju.Random()).Value();
     413    //BHashPairs::const_iterator fc = hashPairs.find(p);
     414    //if(fc==hashPairs.end())
     415      {
     416        i[k] = p.r_;
     417        j[k] = p.c_;
     418        x[k] = dist.Random().Value();
     419        if(x[k]!=0.0)
     420        {
     421          triplet->nnz++;
     422        //hashPairs[p] = x[k];
     423        }
    418424      }
    419425    }
Note: See TracChangeset for help on using the changeset viewer.