Changeset 912bd1b in tol
- Timestamp:
- Nov 3, 2008, 8:05:53 AM (18 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 8b98f904
- Parents:
- 47cbb8f
- Location:
- tol/btol/vmatrix_type
- Files:
-
- 3 edited
-
Jamfile (modified) (1 diff)
-
tol_bvmat.h (modified) (1 diff)
-
vmat_io.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/vmatrix_type/Jamfile
r47cbb8f r912bd1b 4 4 : vmat.cpp vmat_convert.cpp vmat_stats.cpp vmat_arith.cpp vmat_logic.cpp 5 5 vmat_chol.cpp vmat_subtypes.cpp vmat_io.cpp vmat_bsr.cpp 6 vmat_iterator.cpp vmatgra.cpp 6 vmat_iterator.cpp vmatgra.cpp mmio.c 7 7 : <include>$(TOP)/bmath/gsl_ext 8 8 -
tol/btol/vmatrix_type/tol_bvmat.h
r47cbb8f r912bd1b 324 324 void Print(FILE* file, const char* name, int level) const; 325 325 void Scan (FILE* file); 326 void WriteMatrixMarket(FILE* file); 326 327 size_t Bytes() const; 327 328 bool Write(BOisCreator& ois, BStream* name) const; -
tol/btol/vmatrix_type/vmat_io.cpp
r47cbb8f r912bd1b 28 28 #include <stdarg.h> 29 29 30 30 //#define _USE_MM_IO_ 31 #ifdef _USE_MM_IO_ 32 #include "mmio.h" 33 #endif 31 34 32 35 //////////////////////////////////////////////////////////////////////////////// … … 190 193 I2("virtual matrix","")+" "+CodeName(a.code_)+ 191 194 "("+a.Rows()+"x"+a.Columns()+")"+" "); 195 FILE *f = fopen("/tmp/fail_chol.mtx", "w"); 196 ((BVMat&)a).WriteMatrixMarket(f); 197 fclose(f); 192 198 } 193 199 … … 300 306 s_.chlmRtriplet_ = cholmod_read_triplet(file,common_); 301 307 }; 308 309 #ifdef _USE_MM_IO_ 310 //////////////////////////////////////////////////////////////////////////////// 311 void BVMat::WriteMatrixMarket(FILE* file) 312 //Exporting method 313 //////////////////////////////////////////////////////////////////////////////// 314 { 315 cholmod_triplet *ptr_triplet = NULL; 316 bool should_free = false; 317 MM_typecode matcode; 302 318 319 if (code_==ESC_chlmRsparse) { 320 ptr_triplet = cholmod_sparse_to_triplet(s_.chlmRsparse_, common_); 321 should_free = true; 322 } else if (code_==ESC_chlmRtriplet) { 323 ptr_triplet = s_.chlmRtriplet_; 324 } 325 if (ptr_triplet) { 326 mm_initialize_typecode(&matcode); 327 mm_set_matrix(&matcode); 328 mm_set_coordinate(&matcode); 329 mm_set_real(&matcode); 330 331 mm_write_banner(file, matcode); 332 mm_write_mtx_crd_size(file, 333 ptr_triplet->nrow, 334 ptr_triplet->ncol, 335 ptr_triplet->nnz); 336 337 /* NOTE: matrix market files use 1-based indices, i.e. first element 338 of a vector has index 1, not 0. */ 339 340 int *Ti = (int*)ptr_triplet->i; 341 int *Tj = (int*)ptr_triplet->j; 342 double *Val = (double*)ptr_triplet->x; 343 for (int i=0; i<ptr_triplet->nnz; i++) 344 fprintf(file, 345 "%d %d %10.7g\n", Ti[i]+1, Tj[i]+1, Val[i]); 346 347 if (should_free) { 348 cholmod_free_triplet(&ptr_triplet, common_); 349 } 350 } 351 }; 352 #else 353 void BVMat::WriteMatrixMarket(FILE* file) 354 { 355 } 356 #endif 357 303 358 //////////////////////////////////////////////////////////////////////////////// 304 359 size_t BVMat::bytes_blasRdense() const
Note: See TracChangeset
for help on using the changeset viewer.
