Menu

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

Download this file

47 lines (37 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
/*****************************************************************************/
/* noname */
/*****************************************************************************/
//=============================================================================
#include <ctime>
#include "cpplapack.h"
//=============================================================================
/*! main */
int main(int argc, char** argv)
{
srand(unsigned(time(NULL)));
int N(5);
CPPL::dssmatrix A(N);
A(0,0)=1;
A(2,3)=2;
A(1,2)=3;
A(4,1)=4;
//A(3,2)+=0.1;
std::cout << "A =\n" << A << std::endl;
std::cout << "A(1,1)=" << A(1,1) << std::endl;
for(std::vector<CPPL::dcomponent>::const_iterator it=A.data.begin(); it!=A.data.end(); it++){
std::cout << "A(" << it->i << "," << it->j << ") =" << it->v << std::endl;
}
A.checkup();
A.put(3,4, 3.4);
A.del(1,4);
A.del(0);
std::cout << "A =\n" << A << std::endl;
const CPPL::dssmatrix B(A);
//// write/read ////
B.write( "tmp.txt" );
CPPL::dssmatrix C;
C.read( "tmp.txt" );
std::cout << "C-B =\n" << C-B << "<-Should be zero." << std::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.