COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
remapper.cpp
Go to the documentation of this file.
1#include <iostream>
2#include <fstream>
3#include <sstream>
4#include <cstring>
5#include <string>
6#include <stdio.h>
7#include <map>
8#include <vector>
9
10using namespace std;
11
12
13// Remaps old vector files to new (triples) format
14int main(int argc, char *argv[] )
15{
16 if(argc < 2)
17 {
18 cout << "Usage: " << argv[0] << " <filename>" << endl;
19 return 0;
20 }
21
22 stringstream outs;
23 outs << argv[1] << ".remapped";
24 ofstream output(outs.str().c_str());
25 ifstream input(argv[1]);
26
27 int numrows, total_nnz;
28 if (input.is_open())
29 {
30 int one = 1;
31 input >> numrows >> total_nnz;
32 output << numrows << "\t" << one << "\t" << total_nnz << endl;
33 int cnz = 0;
34 int tempind;
35 double tempnum;
36 while ( (!input.eof()) && cnz < total_nnz)
37 {
38 input >> tempind >> tempnum;
39 output << tempind << "\t" << one << "\t" << tempnum << endl;
40 }
41 }
42 input.close();
43 output.close();
44
45 return 0;
46}
int main()
Definition Driver.cpp:12
bool output
Definition comms.cpp:56