-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
51 lines (26 loc) · 961 Bytes
/
util.h
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
#include <complex.h>
#ifndef UTIL_H
#define UTIL_H
void *safeMalloc(int sz);
void *safeRealloc(void *p, int sz);
int *makeIntArray(int n);
double *makeDoubleArray(int n);
complex double *makeComplexArray(int n);
void destroyArray(void *p);
void printIntArray(int length, int *arr);
void printDoubleArray(int length, double *arr);
int *readSignal(int *len);
double *readSignalDouble(int *len);
void printSignal(int len, int *x);
void printSignalDouble(int len, double *x);
int* doubleToInt(double* arr, int len);
double *intToDouble(int *arr, int len);
complex double *doubleToComplex(double *arr, int len);
complex double *intToComplex(int *arr, int len);
int *complexToInt(complex double *arr, int len);
int dequal(double a, double b, double epsilon);
int powerOfTwo(int n);
complex double *padArray(complex double *arr, int new_len);
double average(double *arr, int len);
double getXBar(double *x, int len_x, int len_h, int d);
#endif