Menu

[r172]: / trunk / test / zhsmatrix / zhsmatrix-io / main.cpp  Maximize  Restore  History

Download this file

48 lines (38 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
/*****************************************************************************/
/* noname */
/*****************************************************************************/
//=============================================================================
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "cpplapack.h"
using namespace std;
//=============================================================================
/*! main */
int main(int argc, char** argv)
{
srand(unsigned(time(NULL)));
int N(5), CAP(4);
CPPL::zhsmatrix A(N,CAP);
A.put(0,0, complex<double>(1.,2.) );
A.put(3,2, complex<double>(3.,4.) );
A.put(1,2, complex<double>(5.,6.) );
A.put(4,1, complex<double>(7.,8.) );
cout << "A =\n" << A << endl;
//A.put(1,2, 4.5);
//A.add(1,2, 0.1);
//A.sub(1,2, 0.1);
//A.mult(1,2, 10.);
//A.div(1,2, 10.);
//A.del(1,2);
A.del(2);
cout << "A =\n" << A << endl;
const CPPL::zhsmatrix B(A);
//// write/read ////
B.write( "tmp.txt" );
CPPL::zhsmatrix 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.