|
@ -36,7 +36,7 @@ namespace wvlt { |
|
|
unsigned int n, b, m, Cm, small_steps, big_steps, remainder; |
|
|
unsigned int n, b, m, Cm, small_steps, big_steps, remainder; |
|
|
|
|
|
|
|
|
plan_1D(unsigned int n_, unsigned int b_, unsigned int m_) |
|
|
plan_1D(unsigned int n_, unsigned int b_, unsigned int m_) |
|
|
: n(n_), b(b_), m(m_), Cm(pow_two(m+1) - 2), small_steps(two_log(b) - 1), big_steps(small_steps/m), remainder(small_steps - m*big_steps) |
|
|
: n(n_), b(b_), m(m_), Cm(pow_two(m+1) - 2), small_steps(two_log(b)), big_steps((small_steps-1)/m), remainder(small_steps - m*big_steps) |
|
|
{} |
|
|
{} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -81,20 +81,19 @@ namespace wvlt { |
|
|
// First do the local part
|
|
|
// First do the local part
|
|
|
base(d, plan, x, next, plan.b); |
|
|
base(d, plan, x, next, plan.b); |
|
|
|
|
|
|
|
|
|
|
|
// we only have to finish centralized if p >= 4
|
|
|
|
|
|
if(d.p <= 2) return; |
|
|
|
|
|
|
|
|
// Then do a fan in (i.e. 2 elements to proc zero)
|
|
|
// Then do a fan in (i.e. 2 elements to proc zero)
|
|
|
for(unsigned int i = 0; i < 2; ++i){ |
|
|
bsp::put(0, x, proczero, d.s); |
|
|
bsp::put(0, &x[i * plan.b/2], proczero, d.s * 2 + i); |
|
|
|
|
|
} |
|
|
|
|
|
bsp::sync(); |
|
|
bsp::sync(); |
|
|
|
|
|
|
|
|
// proc zero has the privilige/duty to finish the job
|
|
|
// proc zero has the privilige/duty to finish the job
|
|
|
if(d.s == 0) { |
|
|
if(d.s == 0) { |
|
|
wvlt::wavelet(proczero, 2*d.p, 1); |
|
|
wvlt::wavelet(proczero, d.p, 1); |
|
|
// and to send it back to everyone
|
|
|
// and to send it back to everyone
|
|
|
for(unsigned int t = 0; t < d.p; ++t){ |
|
|
for(unsigned int t = 0; t < d.p; ++t){ |
|
|
for(unsigned int i = 0; i < 2; ++i){ |
|
|
bsp::put(t, &proczero[t], x); |
|
|
bsp::put(t, &proczero[t*2 + i], x, i * plan.b/2); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|