Changeset 98e52e6 in tol


Ignore:
Timestamp:
Jan 22, 2009, 9:35:23 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
59bbd54
Parents:
7a01db8
Message:

Fixed bug counting non null cells in Eye functions

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

File:
1 edited

Legend:

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

    r7a01db8 r98e52e6  
    741741  }
    742742  bool lower = diag<=0;
    743   int k, n = isCol?v.Rows():v.Columns();
     743  int i, k, n = isCol?v.Rows():v.Columns();
    744744  if(lower)
    745745  {
    … …  
    757757  int*    c_ = (int*)   triplet->j;
    758758  double* x_ = (double*)triplet->x;
    759   for(k=0; k<n; k++)
    760   {
    761     r_[k] = lower?k-diag:k;
    762     c_[k] = lower?k:k+diag;
    763     x_[k] = isCol?v.GetCell(k,0):v.GetCell(0,k);
    764     if(x_[k]!=0.0) { triplet->nnz++; }
     759
     760  for(i=k=0; k<n; k++)
     761  {
     762    r_[i] = lower?k-diag:k;
     763    c_[i] = lower?k:k+diag;
     764    x_[i] = isCol?v.GetCell(k,0):v.GetCell(0,k);
     765    if(x_[i]!=0.0) { triplet->nnz++; i++; }
    765766  }
    766767  code_  = ESC_chlmRsparse;
    … …  
    794795  cholmod_triplet* triplet = cholmod_allocate_triplet
    795796    (nrow,ncol,n,0,CHOLMOD_REAL,common_);
    796   int*    r_ = (int*)   triplet->i;
    797   int*    c_ = (int*)   triplet->j;
    798   double* x_ = (double*)triplet->x;
    799   for(k=0; k<n; k++)
    800   {
    801     r_[k] = lower?k-diag:k;
    802     c_[k] = lower?k:k+diag;
    803     x_[k] = x;
    804     triplet->nnz += (x!=0.0);
     797  if(x!=0.0)
     798  {
     799    int*    r_ = (int*)   triplet->i;
     800    int*    c_ = (int*)   triplet->j;
     801    double* x_ = (double*)triplet->x;
     802    for(k=0; k<n; k++)
     803    {
     804      r_[k] = lower?k-diag:k;
     805      c_[k] = lower?k:k+diag;
     806      x_[k] = x;
     807    }
     808    triplet->nnz = n;
    805809  }
    806810  code_  = ESC_chlmRsparse;
Note: See TracChangeset for help on using the changeset viewer.