Changeset 0fcdd1d in tol
- Timestamp:
- Aug 26, 2009, 9:51:32 AM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 2706f1e
- Parents:
- 5b13774
- File:
-
- 1 edited
-
tol/btol/vmatrix_type/vmat_chol.cpp (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/vmatrix_type/vmat_chol.cpp
r5b13774 r0fcdd1d 108 108 109 109 //////////////////////////////////////////////////////////////////////////////// 110 int BVMat::CholeskiFactor(const BVMat& X_, BVMat& L _,110 int BVMat::CholeskiFactor(const BVMat& X_, BVMat& L, 111 111 ECholFacOri ori, 112 112 bool checkSymmetric, … … 114 114 //////////////////////////////////////////////////////////////////////////////// 115 115 { 116 if(!X_.CheckDefined("CholeskiFactor")) { return(-1); } 116 const char* fName = "CholeskiFactor"; 117 if(!X_.CheckDefined(fName)) { return(-1); } 117 118 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__; 121 122 int r = X.Rows(); 122 123 int c = X.Columns(); … … 124 125 if((ori==ECFO_X)&&(r!=c)) 125 126 { 126 err_cannot_apply( "CholeskiFactor",I2("non square","no cuadrada"),X);127 err_cannot_apply(fName,I2("non square","no cuadrada"),X); 127 128 result = -1; 128 129 } 129 130 else if((ori==ECFO_XtX)&&(r<c)) 130 131 { 131 err_cannot_apply( "CholeskiFactor",132 err_cannot_apply(fName, 132 133 I2("row deficient to build", 133 134 "no tiene bastantes filas para construir")+ " S = X' X",X); … … 136 137 else if((ori==ECFO_XXt)&&(r>c)) 137 138 { 138 err_cannot_apply( "CholeskiFactor",139 err_cannot_apply(fName, 139 140 I2("column deficient to build", 140 141 "no tiene bastantes columnas para construir")+" S = X X'",X); … … 149 150 if(isNotSymm) 150 151 { 151 err_cannot_apply("CholeskiFactor", 152 I2("non symmetric","no simetrica"),X); 152 err_cannot_apply(fName, I2("non symmetric","no simetrica"),X); 153 153 result = -4; 154 154 } … … 163 163 else 164 164 { 165 err_invalid_subtype( "CholeskiFactor",X);165 err_invalid_subtype(fName,X); 166 166 isOk = false; 167 167 } … … 170 170 if(isNotPosDef) 171 171 { 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); 175 174 L.Delete(); 176 175 result = -5; … … 194 193 //////////////////////////////////////////////////////////////////////////////// 195 194 { 195 const char* fName = "CholeskiFactor"; 196 196 ECholFacOri ori = FindCFacName(oriName); 197 197 if(ori==ECFO_none) 198 198 { 199 err_cannot_apply( "CholeskiFactor",199 err_cannot_apply(fName, 200 200 I2("Invalid origen identifier", 201 201 "Identificador de origen inválido")+" "+oriName+" "+ … … 609 609 610 610 //////////////////////////////////////////////////////////////////////////////// 611 int BVMat::CholeskiSolve (const BVMat& L _, const BVMat& B_,611 int BVMat::CholeskiSolve (const BVMat& L, const BVMat& B_, 612 612 BVMat& X, ECholSolSys sys) 613 613 //////////////////////////////////////////////////////////////////////////////// 614 614 { 615 if(!L _.CheckDefined("CholeskiSolve")) { return(-1); }615 if(!L .CheckDefined("CholeskiSolve")) { return(-1); } 616 616 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"); 621 626 } 622 627 else 623 628 { 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__; 628 634 const StrCholSol* cholSol = FindCholSol(L.code_, B.code_, sys); 629 635 if(cholSol) … … 645 651 result = -2; 646 652 } 647 if(L__!=&L_) { delete L__; }648 653 if(B__!=&B_) { delete B__; } 649 654 return(result);
Note: See TracChangeset
for help on using the changeset viewer.
