Skip to content

Commit e9af352

Browse files
gqian-coderJieyangChen7
authored andcommitted
change the quantizer size calculated in Hierarchy.hpp to be level-wise uniform
1 parent cc4af50 commit e9af352

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

include/mgard-x/Hierarchy/Hierarchy.hpp

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,10 @@ void Hierarchy<D, T, DeviceType>::calc_volume(SIZE dof, T *dist, T *volume,
171171
}
172172
MemoryManager<DeviceType>::Copy1D(h_dist, dist, dof, 0);
173173
DeviceRuntime<DeviceType>::SyncQueue(0);
174-
if (dof == 2) {
175-
h_volume[0] = h_dist[0] / 2;
176-
h_volume[1] = h_dist[0] / 2;
177-
} else {
178-
int node_coeff_div = dof / 2 + 1;
179-
h_volume[0] = h_dist[0] / 2;
180-
for (int i = 1; i < dof - 1; i++) {
181-
if (i % 2 == 0) { // node
182-
h_volume[i / 2] = (h_dist[i - 1] + h_dist[i]) / 2;
183-
} else { // coeff
184-
h_volume[node_coeff_div + i / 2] = (h_dist[i - 1] + h_dist[i]) / 2;
185-
}
186-
}
187-
if (dof % 2 != 0) {
188-
h_volume[node_coeff_div - 1] = h_dist[dof - 2] / 2;
189-
} else {
190-
h_volume[node_coeff_div - 1] = h_dist[dof - 1] / 2;
174+
// level-wise uniform quantizer
175+
if (dof > 1) {
176+
for (int i = 0; i < dof; i++) {
177+
h_volume[i] = 1.0/ (T)(dof-1);
191178
}
192179
}
193180

0 commit comments

Comments
 (0)