Skip to content

Commit cb0819c

Browse files
committed
0.1b version
2 parents f545c43 + 21c587a commit cb0819c

File tree

12 files changed

+4813
-44
lines changed

12 files changed

+4813
-44
lines changed

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@
2222

2323
*.nfs*
2424

25+
# Text files
26+
*.txt
27+
2528
# Image Files
26-
*.ppm
29+
*.ppm
30+
31+
# From Visual Studio
32+
Debug/*
33+
Release/*
34+
*.vcxproj*

common.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,20 @@
77

88
typedef unsigned int uint;
99

10+
#ifdef WIN32
11+
typedef double interval;
12+
typedef double real;
13+
14+
inline interval Sup(interval i)
15+
{
16+
return i;
17+
}
18+
19+
inline interval Inf(interval i)
20+
{
21+
return i;
22+
}
23+
24+
#endif
25+
1026
#endif /* COMMON_H */

int-haar.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "int-haar.h"
22

3-
void VinisNormalization(double *vec, uint n)
3+
void VinisNormalization(double *vec, uint n, bool invert)
44
{
55
uint levels = log2(n);
66

@@ -13,12 +13,16 @@ void VinisNormalization(double *vec, uint n)
1313

1414
uint fim = (uint)pow(2.0, (double)(level + 1));
1515

16+
if (invert)
17+
for (uint i = inicio; i < fim; i++)
18+
vec[i] /= pow(2.0, - (double)level / 2.0);
19+
else
1620
for (uint i = inicio; i < fim; i++)
1721
vec[i] *= pow(2.0, - (double)level / 2.0);
1822
}
1923
}
2024

21-
void INT_VinisNormalization(interval *vec, uint n)
25+
void INT_VinisNormalization(interval *vec, uint n, bool invert)
2226
{
2327
uint levels = (uint)log2((double)(n));
2428
interval div;
@@ -41,8 +45,10 @@ void INT_VinisNormalization(interval *vec, uint n)
4145
}
4246
else div = interval((int)(level));
4347

44-
if (div != interval(0))
45-
vec[i] /= div;
48+
if (div == interval(0)) continue;
49+
50+
if (invert) vec[i] *= div;
51+
else vec[i] /= div;
4652
}
4753
}
4854
}
@@ -149,12 +155,17 @@ void VinisNonStandardMatrixNormalization(double **matrix, uint n, bool invert)
149155
start = (uint)div;
150156
limit = (uint)pow(2.0, (double)i + 1);
151157

152-
for (uint l = 0; l < limit / 2; l++)
158+
if (invert)
159+
{
160+
for (uint l = 0; l < limit / 2; l++)
161+
for (uint c = start; c < limit; c++)
162+
matrix[l][c] *= div;
163+
}
164+
else
153165
{
166+
for (uint l = 0; l < limit / 2; l++)
154167
for (uint c = start; c < limit; c++)
155-
{
156168
matrix[l][c] /= div;
157-
}
158169
}
159170

160171
if (invert)
@@ -188,12 +199,17 @@ void INT_VinisNonStandardMatrixNormalization(interval **matrix, uint n, bool inv
188199
start = (uint)pow(2.0, (double)i);
189200
limit = (uint)pow(2.0, (double)i + 1);
190201

191-
for (uint l = 0; l < limit / 2; l++)
202+
if (invert)
203+
{
204+
for (uint l = 0; l < limit / 2; l++)
205+
for (uint c = start; c < limit; c++)
206+
matrix[l][c] *= div;
207+
}
208+
else
192209
{
210+
for (uint l = 0; l < limit / 2; l++)
193211
for (uint c = start; c < limit; c++)
194-
{
195212
matrix[l][c] /= div;
196-
}
197213
}
198214

199215
if (invert)

0 commit comments

Comments
 (0)