Changeset 516e91c in tol


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

New methods Pack and Drop

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

File:
1 edited

Legend:

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

    r2b448e9 r516e91c  
    202202  if(Arg(2)) { chop=Real(Arg(2)); }
    203203  contens_=VMat(Arg(1)).NonNullCells(chop);
     204}
     205
     206//--------------------------------------------------------------------
     207DeclareContensClass(BDat, BDatTemporary, BDatStoredCells);
     208DefExtOpr(1, BDatStoredCells, "VStoredCells", 1, 1,
     209  "VMatrix",
     210  "(VMatrix V)",
     211  I2("Returns the number of stored cells of a virtual matrix.",
     212     "Devuelve el numero de celdas almacenadas de una matriz virtual."),
     213    BOperClassify::MatrixAlgebra_);
     214//--------------------------------------------------------------------
     215void BDatStoredCells::CalcContens()
     216//--------------------------------------------------------------------
     217{
     218  const double *x;
     219  int nzmax;
     220  VMat(Arg(1)).StoredData(x,nzmax);
     221  contens_=nzmax;
    204222}
    205223
    … …  
    447465  assert(contens_.Check());
    448466}
     467
     468//--------------------------------------------------------------------
     469DeclareContensClass(BVMat, BVMatTemporary, BVMatPack);
     470DefExtOpr(1, BVMatPack, "Pack", 1, 1,
     471  "VMatrix",
     472  "(VMatrix data)",
     473  I2("Packs an sparse matrix to be stored in the minimum posible size."
     474     "It has no effect over non sparse matrices.",
     475     "Empaqueta una matriz sparse para que ocupe el mínimo espacio posible."
     476     "No tiene ningún efecto sobre matrices no sparse."),
     477BOperClassify::MatrixAlgebra_);
     478//--------------------------------------------------------------------
     479void BVMatPack::CalcContens()
     480//--------------------------------------------------------------------
     481{
     482  contens_.Copy(VMat(Arg(1)));
     483  contens_.Pack();
     484  assert(contens_.Check());
     485}
     486
    449487
    450488//--------------------------------------------------------------------
    … …  
    11171155//--------------------------------------------------------------------
    11181156{
    1119   BVMat::Drop(VMat(Arg(1)),Real(Arg(2)),contens_);
    1120   assert(contens_.Check());
    1121 }
    1122 
     1157  contens_.Copy(VMat(Arg(1)));
     1158  double drop = 0;
     1159  if(Arg(2)) { drop = Real(Arg(2)); }
     1160  contens_.Drop(drop);
     1161  assert(contens_.Check());
     1162}
    11231163
    11241164#define DecMonaryF00(FUN,ENGLISH,SPANISH)                                      \
Note: See TracChangeset for help on using the changeset viewer.