Menu

[r48]: / trunk / test / dssmatrix / dssmatrix-io / main.cpp  Maximize  Restore  History

Download this file

51 lines (41 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*****************************************************************************/
/* noname */
/*****************************************************************************/
//====================================================================[include]
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "cpplapack.h"
using namespace std;
//=======================================================================[main]
/*! main */
int main(int argc, char** argv)
{
srand(time(NULL));
int N(5), CAP(4);
CPPL::dssmatrix A(N,CAP);
A(0,0)=1;
A(2,3)=2;
A(1,2)=3;
A(4,1)=4;
A(3,2)+=0.1;
cout << "A =\n" << A << endl;
for(int c=0; c<A.vol; c++){
cout << "A(" << A.indx[c] << "," << A.jndx[c] << ") ="
<< A.array[c] << endl;
}
A.checkup();
//A.put(3,4, 3.4);
//A.fput(4,1, 4.);
//A.del(1,4);
//A.fdel(0);
//cout << "A =\n" << A << endl;
const CPPL::dssmatrix B(A);
//// write/read ////
B.write( "tmp.txt" );
CPPL::dssmatrix C;
C.read( "tmp.txt" );
cout << "C-B =\n" << C-B << "<-Should be zero." << endl;
return 0;
}
/*****************************************************************************/
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.