-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVout.cpp
executable file
·73 lines (67 loc) · 1.47 KB
/
Vout.cpp
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
72
73
/////////////////////////////////////////////////////////////////////////
// Program : vout.cpp
// Coded by : Prof. Gang-Gyoo Jin, Korea Maritime University
// Coded on : 12/12/2003
#include <stdio.h>
#include "cmatrix.h"
/////////////////////////////////////////////////////////////////////////
// outputs an INTEGER vector v[nl..nh]
void ms_VOut(int v[], long n1, long n2)
{
long nl, nh;
if(n2 == 0)
{
nl=0; nh= n1;
}
else
{
nl= n1; nh= n2+1;
}
for(long i= nl; i < nh; i++)
printf("%d\n", v[i]);
printf("\n");
return;
}
/////////////////////////////////////////////////////////////////////////
// outputs a REAL vector v[nl..nh]
void ms_VOut(REAL v[], long n1, long n2)
{
long nl, nh;
if(n2 == 0)
{
nl=0; nh= n1;
}
else
{
nl= n1; nh= n2+1;
}
for(long i= nl; i < nh; i++)
#ifdef TDFL
printf("%f\n", v[i]);
#else
printf("%lf\n", v[i]);
#endif
printf("\n");
return;
}
/////////////////////////////////////////////////////////////////////////
// outputs a REAL vector v(0..n-1)
void ms_VOut(const RVECTOR &v)
{
for(int i=0; i<v.n; i++)
printf("%f\n",v(i));
printf("\n");
return;
}
/////////////////////////////////////////////////////////////////////////
// outputs a COMPLEX vector v(0..n-1)
void ms_VOut(const CVECTOR &v)
{
for(int i=0; i<v.n; i++)
if(v(i).Im >=0)
printf("%f+j%f\n",v(i).Re,v(i).Im);
else
printf("%f-j%f\n",v(i).Re,-v(i).Im);
printf("\n");
return;
}