14 #include <itpp/itbase.h>
20 int M=G.rows(),N=G.cols(),nt=M*N;
24 nt=floor(1+nt*(G.density()+0.001) );
27 I = (
int *) malloc(nt *
sizeof(
int));
28 J = (
int *) malloc(nt *
sizeof(
int));
30 val = (
double *) malloc(nt *
sizeof(
double));
57 fout=fopen(file_name,
"w");
65 for (
int i=0; i<nz; i++)
66 fprintf(fout,
"%d %d %10.3g\n", I[i]+1, J[i]+1, val[i]);
69 if ( debug ) std::cout<<
"wrote the matrix (density:"<<G.density()<<
") into file "<<file_name<<std::endl;
77 int M=G.rows(),N=G.cols(),nt=M*N;
104 fout=fopen(filename,
"w");
112 for (
int i=0; i<nz; i++){
113 fprintf(fout,
"%d %d %g\n", I[i]+1, J[i]+1, val[i]);
117 std::cout<<
"wrote the matrix into file "<<filename<<std::endl;
124 char temp[file_name.length()+1];
125 strcpy(temp, file_name.c_str());
131 char temp[file_name.length()+1];
132 strcpy(temp, file_name.c_str());