-
Notifications
You must be signed in to change notification settings - Fork 0
/
aux_print.c
62 lines (56 loc) · 1.37 KB
/
aux_print.c
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
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include "config.h"
#include "types.h"
void print_vector(const double * vector, size_t len){
size_t k;
for (k = 0; k<len; k++){
printf("%.2f\t",vector[k]);
if (k%10 == 9)
printf("\n");
}
printf("\n");
return;
}
void print_matrix(myArray_t M, size_t mla, size_t mlb){
size_t a,b;
for (a = 0; a < mla; a++){
for (b = 0; b < mlb; b++){
printf("%.2f\t", M[a][b]);
}
printf("\n");
}
printf("\n");
return;
}
void print_vector_c(const _Dcomplex * vector, size_t len){
size_t k;
for (k = 0; k<len; k++){
printf("%.4f%+.4fi\n", creal(vector[k]), cimag(vector[k]));
// if (k%10 == 9) printf("\n");
}
printf("\n");
return;
}
void print_matrix_c(myZArray_t M, size_t mla, size_t mlb){
size_t a,b;
for (a = 0; a < mla; a++){
for (b = 0; b < mlb; b++){
printf("%.3f%+.3fi\t", creal(M[a][b]), cimag(M[a][b]));
}
printf("\n");
}
printf("\n");
return;
}
void print_alpha_freq(const _Dcomplex * z, size_t len){
size_t k;
double alpha, freq;
for (k=0; k<len; k++){
alpha = log(cabs(z[k]))/Ts;
freq = atan(cimag(z[k])/creal(z[k]))/(2*M_PI*Ts);
printf("[%lld]: alpha = %.3f, freq = %.3f\n", k, alpha, freq);
}
return;
}