Changeset 2b448e9 in tol


Ignore:
Timestamp:
Mar 9, 2009, 8:57:02 AM (18 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
516e91c
Parents:
d11b5b0
Message:

New method Drop

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

File:
1 edited

Legend:

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

    rd11b5b0 r2b448e9  
    6767DefineMonary (ACosH,      fRR_acosh, false, "ACosH");
    6868DefineMonary (ATanH,      fRR_atanh, true,  "ATanH");
    69 DefineBinaryR(Drop,       fR2R_drop, true,  "Drop");
    7069DefineBinaryR(Sum,        fR2R_sum,  true,  "+ Real");
    7170DefineBinaryR(Rest,       fR2R_rest, true,  "- Real");
    … …  
    137136};
    138137
     138
     139////////////////////////////////////////////////////////////////////////////////
     140  int BVMat::Drop(double drop)
     141//Importing method
     142////////////////////////////////////////////////////////////////////////////////
     143{
     144  int r, c, k, result=0;
     145  double* x;
     146  switch(code_) {
     147  case(ESC_blasRdense  ) :
     148  {
     149    r = s_.blasRdense_->nrow;
     150    c = s_.blasRdense_->ncol;
     151    x = (double*)(s_.blasRdense_->x);
     152    for (k=0; k<r*c; k++)
     153    {
     154      if(fabs(*x)<=drop) { *x = 0.0; }
     155    }   
     156    break;
     157  }
     158  case(ESC_chlmRsparse ) :
     159  {
     160    cholmod_drop(drop,s_.chlmRsparse_, common_);
     161    cholmod_sort(s_.chlmRsparse_,   common_);
     162    break;
     163  }
     164  case(ESC_chlmRtriplet) :
     165  {
     166    BVMat sprs;
     167    cRt2cRs(*this,sprs);
     168    cholmod_drop(drop,sprs.s_.chlmRsparse_, common_);
     169    cholmod_sort(sprs.s_.chlmRsparse_,   common_);
     170    cRs2cRt(sprs,*this);
     171    break;
     172  }
     173  default:
     174    err_invalid_subtype("Drop",*this);
     175    result = -1; }
     176  return(result);
     177};
     178
     179////////////////////////////////////////////////////////////////////////////////
     180  BVMat BVMat::Drop(const BVMat& A, double drop)
     181////////////////////////////////////////////////////////////////////////////////
     182{
     183  BVMat v;
     184  v.Copy(A);
     185  v.Drop(drop);
     186  return(v);
     187}
    139188
    140189////////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.