Changeset 0fcdd1d in tol


Ignore:
Timestamp:
Aug 26, 2009, 9:51:32 AM (17 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
2706f1e
Parents:
5b13774
Message:

New API for convertIfNeeded* functions

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

File:
1 edited

Legend:

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

    r5b13774 r0fcdd1d  
    108108 
    109109////////////////////////////////////////////////////////////////////////////////
    110   int BVMat::CholeskiFactor(const BVMat& X_, BVMat& L_,
     110  int BVMat::CholeskiFactor(const BVMat& X_, BVMat& L,
    111111                            ECholFacOri ori, 
    112112                            bool checkSymmetric,
    … …  
    114114////////////////////////////////////////////////////////////////////////////////
    115115{
    116   if(!X_.CheckDefined("CholeskiFactor")) { return(-1); }
     116  const char* fName = "CholeskiFactor";
     117  if(!X_.CheckDefined(fName)) { return(-1); }
    117118  bool old_force = force_natural_order(forceNaturalOrder);
    118   BVMat* X__, *L__;
    119   convertIfNeeded_cRt2cRs(X_,L_,X__,L__,"CholeskiFactor");
    120   BVMat &X = *X__,  &L = *L__;
     119  BVMat* X__;
     120  convertIfNeeded_cRt2cRs(X_,X__,fName);
     121  BVMat &X = *X__;
    121122  int r = X.Rows();
    122123  int c = X.Columns();
    … …  
    124125  if((ori==ECFO_X)&&(r!=c))
    125126  {
    126     err_cannot_apply("CholeskiFactor",I2("non square","no cuadrada"),X);
     127    err_cannot_apply(fName,I2("non square","no cuadrada"),X);
    127128    result = -1;
    128129  }
    129130  else if((ori==ECFO_XtX)&&(r<c))
    130131  {
    131     err_cannot_apply("CholeskiFactor",
     132    err_cannot_apply(fName,
    132133      I2("row deficient to build",
    133134         "no tiene bastantes filas para construir")+ " S = X' X",X);
    … …  
    136137  else if((ori==ECFO_XXt)&&(r>c))
    137138  {
    138     err_cannot_apply("CholeskiFactor",
     139    err_cannot_apply(fName,
    139140      I2("column deficient to build",
    140141         "no tiene bastantes columnas para construir")+" S = X X'",X);
    … …  
    149150    if(isNotSymm)
    150151    {
    151       err_cannot_apply("CholeskiFactor",
    152         I2("non symmetric","no simetrica"),X);
     152      err_cannot_apply(fName, I2("non symmetric","no simetrica"),X);
    153153      result = -4;
    154154    }
    … …  
    163163      else
    164164      {
    165         err_invalid_subtype("CholeskiFactor",X);
     165        err_invalid_subtype(fName,X);
    166166        isOk = false;
    167167      }
    … …  
    170170        if(isNotPosDef)
    171171        {
    172           err_cannot_apply("CholeskiFactor",
    173                            I2("non positive definite",
    174                               "no definida positiva"),X);
     172          err_cannot_apply(fName, 
     173           I2("non positive definite", "no definida positiva"),X);
    175174          L.Delete();
    176175          result = -5;
    … …  
    194193////////////////////////////////////////////////////////////////////////////////
    195194{
     195  const char* fName = "CholeskiFactor";
    196196  ECholFacOri ori = FindCFacName(oriName);
    197197  if(ori==ECFO_none)
    198198  {
    199     err_cannot_apply("CholeskiFactor",
     199    err_cannot_apply(fName,
    200200    I2("Invalid origen identifier",
    201201       "Identificador de origen inválido")+" "+oriName+" "+
    … …  
    609609
    610610////////////////////////////////////////////////////////////////////////////////
    611   int BVMat::CholeskiSolve (const BVMat& L_, const BVMat& B_,
     611  int BVMat::CholeskiSolve (const BVMat& L, const BVMat& B_,
    612612                            BVMat& X, ECholSolSys sys)
    613613////////////////////////////////////////////////////////////////////////////////
    614614{
    615   if(!L_.CheckDefined("CholeskiSolve")) { return(-1); }
     615  if(!L .CheckDefined("CholeskiSolve")) { return(-1); }
    616616  if(!B_.CheckDefined("CholeskiSolve")) { return(-1); }
    617   BVMat* L__, *B__;
    618   if(L_.code_==ESC_blasRdense)
    619   {
    620     convertIfNeeded2bRd(L_,B_,L__,B__,"CholeskiSolve");
     617  int result = 0;
     618  BVMat *B__=NULL;
     619  if(L.code_==ESC_blasRdense)
     620  {
     621    convertIfNeeded_all2bRd(B_,B__,"CholeskiSolve");
     622  }
     623  else if(L.code_==ESC_chlmRfactor)
     624  {
     625    convertIfNeeded_all2cRs(B_,B__,"CholeskiSolve");
    621626  }
    622627  else
    623628  {
    624     convertIfNeeded_cRt2cRs(L_,B_,L__,B__,"CholeskiSolve");
    625   }
    626   BVMat &L = *L__,  &B = *B__;
    627   int result = 0;
     629    err_invalid_subtype("CholeskiSolve",L);
     630    result = -2;
     631    return(result);
     632  }
     633  BVMat &B = *B__;
    628634  const StrCholSol* cholSol = FindCholSol(L.code_, B.code_, sys);
    629635  if(cholSol)
    … …  
    645651    result = -2;
    646652  }
    647   if(L__!=&L_) { delete L__; }
    648653  if(B__!=&B_) { delete B__; }
    649654  return(result);
Note: See TracChangeset for help on using the changeset viewer.