Changeset b77a57a in tol
- Timestamp:
- Jan 27, 2009, 10:24:25 AM (18 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- c2dbd4c
- Parents:
- ee5da7f
- Location:
- tol/btol/vmatrix_type
- Files:
-
- 3 edited
-
tol_bvmat.h (modified) (2 diffs)
-
vmat_convert.cpp (modified) (2 diffs)
-
vmatgra.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/vmatrix_type/tol_bvmat.h
ree5da7f rb77a57a 454 454 int SubCols (const BArray<int>& rows, BVMat& aux) const; 455 455 int SubBand (int from, int until, BVMat& aux) const; 456 int SubDiag(int numDiag, BVMat& aux) const; 457 456 458 BVMat Sub (int i, int j, int r, int c ) const; 457 459 BVMat SubCells(const BArray<int>& rows, const BArray<int>& cols) const; … … 459 461 BVMat SubCols (const BArray<int>& cols ) const; 460 462 BVMat SubBand (int from, int until) const; 463 BVMat SubDiag (int numDiag) const; 461 464 462 465 static void cRs_ensure_packed(cholmod_sparse_struct* sp); -
tol/btol/vmatrix_type/vmat_convert.cpp
ree5da7f rb77a57a 1234 1234 break; 1235 1235 default: 1236 err_cannot_apply("SubBand",I2("(Not implemen mted)",1236 err_cannot_apply("SubBand",I2("(Not implemented)", 1237 1237 "(Metodo no implementado)"),*this); 1238 1238 return(-2); } … … 1251 1251 }; 1252 1252 1253 1254 //////////////////////////////////////////////////////////////////////////////// 1255 int BVMat::SubDiag(int numDiag, BVMat& aux) const 1256 //Matrix algebra operator 1257 //Extracts cell (i,j) matching i-j=numDiag 1258 //////////////////////////////////////////////////////////////////////////////// 1259 { 1260 int fail = 0; 1261 int rows = Rows(); 1262 int cols = Columns(); 1263 int dMin = -rows+1; 1264 int dMax = cols-1; 1265 bool outOfRange = (numDiag<dMin)||(numDiag>dMax); 1266 if(!outOfRange) 1267 { 1268 BVMat band; 1269 fail = SubBand(numDiag, numDiag, band); 1270 if(!fail) 1271 { 1272 int i0 = (numDiag>=0)?0:-numDiag; 1273 int j0 = (numDiag<=0)?0:+numDiag; 1274 int len = Minimum(rows-i0,cols-j0); 1275 assert(len>0); 1276 int k; 1277 aux.BlasRDense(1,len); 1278 double* x = (double*)(aux.s_.blasRdense_->x); 1279 for(k=0; k<len; k++) 1280 { 1281 x[k] = band.GetCell(k+numDiag,k); 1282 } 1283 } 1284 } 1285 else 1286 { 1287 err_cannot_apply("SubDiag",I2("(Diagonal number out of range)", 1288 "(Número de diagonal fuera de rango)")+ 1289 "["+dMin+","+dMax+"]",*this); 1290 fail = -3; 1291 } 1292 return(fail); 1293 }; 1294 1295 //////////////////////////////////////////////////////////////////////////////// 1296 BVMat BVMat::SubDiag(int numDiag) const 1297 //Matrix algebra operator 1298 //Extracts cell (i,j) matching i-j=numDiag 1299 //////////////////////////////////////////////////////////////////////////////// 1300 { 1301 BVMat aux; 1302 SubDiag(numDiag, aux); 1303 return(aux); 1304 } -
tol/btol/vmatrix_type/vmatgra.cpp
ree5da7f rb77a57a 996 996 I2("Extracts the selected consecutive diagonals. Main diagonal is " 997 997 "referenced as 0, lower ones are negative numbers and upper ones " 998 "positive. ",998 "positive. Returned matrix has same dimensions than incoming one.", 999 999 "Extrae las diagonales consecutivas seleccionadas. La diagonal " 1000 1000 "principal se referencia como 0, las inferiores como números " 1001 "negativos y las superiores como positivos."), 1001 "negativos y las superiores como positivos. La matriz devuelta " 1002 "tiene las mismas dimensiones que la entrante."), 1002 1003 BOperClassify::MatrixAlgebra_); 1003 1004 //-------------------------------------------------------------------- … … 1013 1014 assert(contens_.Check()); 1014 1015 } 1016 1017 1018 //-------------------------------------------------------------------- 1019 DeclareContensClass(BVMat, BVMatTemporary, BVMatSubDiag); 1020 DefExtOpr(1, BVMatSubDiag, "SubDiag", 1, 1, 1021 "VMatrix Real ", 1022 "(VMatrix m [, Real diagNumber=0])", 1023 I2("Extracts the selected diagonal as a row matrix. Main diagonal is " 1024 "referenced as 0, lower ones are negative numbers and upper ones " 1025 "positive.", 1026 "Extrae la diagonales seleccionada como una matriz fila. La diagonal " 1027 "principal se referencia como 0, las inferiores como números " 1028 "negativos y las superiores como positivos."), 1029 BOperClassify::MatrixAlgebra_); 1030 //-------------------------------------------------------------------- 1031 void BVMatSubDiag::CalcContens() 1032 //-------------------------------------------------------------------- 1033 { 1034 BVMat& M = VMat(Arg(1)); 1035 int diagNum = 0; 1036 if(Arg(2)) { diagNum = (int)Real(Arg(2)); } 1037 M.SubDiag(diagNum,contens_); 1038 assert(contens_.Check()); 1039 } 1040 1015 1041 1016 1042 /*------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.
