Changeset aedae2f in tol


Ignore:
Timestamp:
Dec 15, 2009, 9:33:54 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
e213da6
Parents:
ca98181
Message:

Fixes #815

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

Location:
tol/btol
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • tol/btol/matrix_type/matgra.cpp

    rca98181 raedae2f  
    9292{
    9393    BTraceInit("BGraContens<BMat>::InitInstances");
    94     BArray<BDat> cell(BDat::Unknown(), 1);
    95     BArray< BArray<BDat> > mat(cell, 1);
     94    BMatrix<BDat> mat;
    9695   
    9796    BSystemMat* unknown_ = new BSystemMat
    98   (
     97    (
    9998      "UnknownMatrix",
    100       BMat(1, 1, mat),
     99      mat,
    101100      I2("The unknown matrix.", "La matriz desconocida.")
    102       );
     101    );
    103102    OwnGrammar()->PutDefect(unknown_);
    104103}
    … …  
    25652564
    25662565 
     2566//--------------------------------------------------------------------
     2567DeclareContensClass(BMat, BMatTemporary, BMatZeros);
     2568DefExtOpr(1, BMatZeros, "Zeros",  1, 2,
     2569  "Real Real",
     2570  "(Real nrow [, Real ncol=nrow])",
     2571  I2("Creates a matrix with all elements equal to zero.",
     2572     "Devuelve una matriz cuyas celdas son todas cero."),
     2573    BOperClassify::MatrixAlgebra_);
     2574//--------------------------------------------------------------------
     2575void BMatZeros::CalcContens()
     2576//--------------------------------------------------------------------
     2577{
     2578  int r = (BInt)Real(Arg(1));
     2579  int c = r;
     2580  if(Arg(2)) { c = (BInt)Real(Arg(2)); }
     2581  contens_.Alloc(r,c);
     2582  int k, s= contens_.Data().Size();
     2583  double* x=(double*)contens_.GetData().GetBuffer();
     2584  for(k=0; k<s; k++,x++)
     2585  {
     2586    *x = 0;
     2587  }
     2588}
     2589
     2590//--------------------------------------------------------------------
     2591DeclareContensClass(BMat, BMatTemporary, BMatConstant);
     2592DefExtOpr(1, BMatConstant, "Constant",  3, 3,
     2593  "Real Real Real",
     2594  "(Real nrow, Real ncol, Real value])",
     2595  I2("Creates a matrix with all elements equal to given value.",
     2596     "Devuelve una matriz cuyas celdas son todas iguales al valor "
     2597     "especificado."),
     2598    BOperClassify::MatrixAlgebra_);
     2599//--------------------------------------------------------------------
     2600void BMatConstant::CalcContens()
     2601//--------------------------------------------------------------------
     2602{
     2603  int r = (BInt)Real(Arg(1));
     2604  int c = (BInt)Real(Arg(2));
     2605  double v = Real(Arg(3));
     2606  contens_.Alloc(r,c);
     2607  int k, s= contens_.Data().Size();
     2608  double* x=(double*)contens_.GetData().GetBuffer();
     2609  for(k=0; k<s; k++, x++)
     2610  {
     2611    *x = v;
     2612  }
     2613}
    25672614
    25682615//--------------------------------------------------------------------
    … …  
    34593506  register bool ok = true;
    34603507 
     3508  contens_.Alloc(r,c);
    34613509  if(r*c<=0) { return; }
    3462   contens_.Alloc(r,c);
    34633510  if(contens_.Rows()!=r) { return; }
    34643511  register const double* x0 = M.Data().Buffer();
    … …  
    35113558  register bool ok = true;
    35123559 
     3560  contens_.Alloc(r,c);
    35133561  if(r*c<=0) { return; }
    3514   contens_.Alloc(r,c);
    35153562  register const double* x0 = M.Data().Buffer();
    35163563  register const double* x;
    … …  
    35713618  BBool ok = BTRUE;
    35723619 
     3620  contens_.Alloc(r,c);
    35733621  if(r*c<=0) { return; }
    3574   contens_.Alloc(r,c);
    35753622  if(contens_.Rows()!=r) { return; }
    35763623  for(j=0; ok && j<c; j++)
  • tol/btol/vmatrix_type/tol_bvmat.h

    rca98181 raedae2f  
    272272  void Copy        (const BVMat& v);
    273273  void BlasRDense  (int nrow, int ncol);
     274  void BlasRDense  (int nrow, int ncol, double value);
    274275  void ChlmRSparse (int nrow, int ncol, int nzmax);
    275276  void ChlmRTriplet(int nrow, int ncol, int nzmax);
  • tol/btol/vmatrix_type/vmat.cpp

    rca98181 raedae2f  
    471471} 
    472472 
     473////////////////////////////////////////////////////////////////////////////////
     474  void BVMat::BlasRDense(int nrow, int ncol, double value)
     475////////////////////////////////////////////////////////////////////////////////
     476{
     477  BlasRDense(nrow, ncol);
     478  double* x = (double*)s_.blasRdense_->x;
     479  if(x)
     480  {
     481    int s = nrow*ncol;
     482    int k;
     483    for(k=0; k<s; k++, x++)
     484    {
     485     *x = value;
     486    }
     487  }
     488} 
     489
    473490////////////////////////////////////////////////////////////////////////////////
    474491  void BVMat::ChlmRSparse(int nrow, int ncol, int nzmax)
  • tol/btol/vmatrix_type/vmatgra.cpp

    rca98181 raedae2f  
    717717}
    718718
     719//--------------------------------------------------------------------
     720DeclareContensClass(BVMat, BVMatTemporary, BVMatConstant);
     721DefExtOpr(1, BVMatConstant, "Constant",  3, 3,
     722  "Real Real Real",
     723  "(Real nrow, Real ncol, Real value])",
     724  I2("Creates a dense matrix with all elements equal to given value.",
     725     "Devuelve una matriz densa cuyas celdas son todas iguales al "
     726     "valor especificado."),
     727    BOperClassify::MatrixAlgebra_);
     728//--------------------------------------------------------------------
     729void BVMatConstant::CalcContens()
     730//--------------------------------------------------------------------
     731{
     732  int r = (BInt)Real(Arg(1));
     733  int c = (BInt)Real(Arg(2));
     734  double v = Real(Arg(3));
     735  contens_.BlasRDense(r,c, v);
     736}
    719737
    720738//--------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.