Menu

[r136]: / trunk / test / double / main.cpp  Maximize  Restore  History

Download this file

72 lines (58 with data), 2.1 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*****************************************************************************/
/* noname.cpp */
/*****************************************************************************/
//====================================================================[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 M(4), N(3), KL(2), KU(1);
CPPL::dgematrix A(M,N);
CPPL::dgbmatrix B(M,N,KL,KU);
CPPL::dsymatrix C(N);
CPPL::dcovector cv(M);
CPPL::drovector rv(M);
for(int i=0; i<M; i++){ for(int j=0; j<N; j++){
A(i,j) =double( rand() /(RAND_MAX/10) );
}}
for(int i=0; i<M; i++){ for(int j=0; j<N; j++){
if( !(i-j>B.kl || j-i>B.ku) ){
B(i,j) =double( rand() /(RAND_MAX/10) );
}
}}
for(int i=0; i<N; i++){ for(int j=0; j<=i; j++){
C(i,j) =double( rand() /(RAND_MAX/10) );
}}
for(int i=0; i<M; i++){
cv(i) =double( rand() /(RAND_MAX/10) );
rv(i) =double( rand() /(RAND_MAX/10) );
}
cout << "A =\n" << A << endl;
cout << "10.*A =\n" << 10.*A << endl;
cout << "A*10. =\n" << A*10. << endl;
cout << "A/10. =\n" << A/10. << endl;
cout << "B =\n" << B << endl;
cout << "10.*B =\n" << 10.*B << endl;
cout << "B*10. =\n" << B*10. << endl;
cout << "B/10. =\n" << B/10. << endl;
cout << "C =\n" << C << endl;
cout << "10.*C =\n" << 10.*C << endl;
cout << "C*10. =\n" << C*10. << endl;
cout << "C/10. =\n" << C/10. << endl;
cout << "cv =\n" << cv << endl;
cout << "10.*cv =\n" << 10.*cv << endl;
cout << "cv*10. =\n" << cv*10. << endl;
cout << "cv/10. =\n" << cv/10. << endl;
cout << "rv =\n" << rv << endl;
cout << "10.*rv =\n" << 10.*rv << endl;
cout << "rv*10. =\n" << rv*10. << endl;
cout << "rv/10. =\n" << rv/10. << 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.