-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommon.cpp
50 lines (44 loc) · 1.03 KB
/
common.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
#include "math.h"
#include "stdlib.h"
#include "common.h"
double* ones(int i1, int i2)
{
double* x = new double[sizeof(double)*i2];//(double*)malloc(sizeof(double)*i2);
for(int i=i1; i < i2; i++)
x[i] = 1;
return x;
}
double* zeroes(int i1, int i2)
{
double* x = new double[sizeof(double)*i2];
for(int i=i1; i < i2; i++)
x[i] = 0;
return x;
}
std::vector<double> zeroesV(int i1, int i2)
{
std::vector<double> x;
x.resize(i2);
for(int i=i1; i < i2; i++)
x[i] = 0;
return x;
}
complex_double** Make2DArray(int arraySizeX, int arraySizeY)
{
complex_double** theArray;
theArray = new complex_double*[(arraySizeX*sizeof(complex_double*))];
int i,j;
for (i = 0; i < arraySizeX; i++)
{
theArray[i] = new complex_double[(arraySizeY*sizeof(complex_double))];
for(j=0; j < arraySizeY; j++)
{
theArray[i][j] = std::complex<double>(0,0);
}
}
return theArray;
}
double rem(double x, double y)
{
return x - floor(x/y)*y;
}