Commit c34b08c1 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent 76c91495
...@@ -917,8 +917,7 @@ template<bool fwd, typename T> void pass_all(T c[], T0 fct) const ...@@ -917,8 +917,7 @@ template<bool fwd, typename T> void pass_all(T c[], T0 fct) const
for (size_t i=0; i<length; ++i) for (size_t i=0; i<length; ++i)
c[i] = ch[i]*fct; c[i] = ch[i]*fct;
else else
for (size_t i=0; i<length; ++i) memcpy (c,p1,length*sizeof(T));
c[i] = ch[i];
} }
else else
if (fct!=1.) if (fct!=1.)
...@@ -1365,8 +1364,8 @@ template<typename T> void radb2(size_t ido, size_t l1, ...@@ -1365,8 +1364,8 @@ template<typename T> void radb2(size_t ido, size_t l1,
if ((ido&1)==0) if ((ido&1)==0)
for (size_t k=0; k<l1; k++) for (size_t k=0; k<l1; k++)
{ {
CH(ido-1,k,0) = 2*CC(ido-1,0,k); CH(ido-1,k,0) = T0( 2)*CC(ido-1,0,k);
CH(ido-1,k,1) =-2*CC(0 ,1,k); CH(ido-1,k,1) = T0(-2)*CC(0 ,1,k);
} }
if (ido<=2) return; if (ido<=2) return;
for (size_t k=0; k<l1;++k) for (size_t k=0; k<l1;++k)
...@@ -1394,10 +1393,10 @@ template<typename T> void radb3(size_t ido, size_t l1, ...@@ -1394,10 +1393,10 @@ template<typename T> void radb3(size_t ido, size_t l1,
for (size_t k=0; k<l1; k++) for (size_t k=0; k<l1; k++)
{ {
T tr2=2*CC(ido-1,1,k); T tr2=T0(2)*CC(ido-1,1,k);
T cr2=CC(0,0,k)+taur*tr2; T cr2=CC(0,0,k)+taur*tr2;
CH(0,k,0)=CC(0,0,k)+tr2; CH(0,k,0)=CC(0,0,k)+tr2;
T ci3=2*taui*CC(0,2,k); T ci3=T0(2)*taui*CC(0,2,k);
PM (CH(0,k,2),CH(0,k,1),cr2,ci3); PM (CH(0,k,2),CH(0,k,1),cr2,ci3);
} }
if (ido==1) return; if (ido==1) return;
...@@ -1436,8 +1435,8 @@ template<typename T> void radb4(size_t ido, size_t l1, ...@@ -1436,8 +1435,8 @@ template<typename T> void radb4(size_t ido, size_t l1,
{ {
T tr1, tr2; T tr1, tr2;
PM (tr2,tr1,CC(0,0,k),CC(ido-1,3,k)); PM (tr2,tr1,CC(0,0,k),CC(ido-1,3,k));
T tr3=2*CC(ido-1,1,k); T tr3=T0(2)*CC(ido-1,1,k);
T tr4=2*CC(0,2,k); T tr4=T0(2)*CC(0,2,k);
PM (CH(0,k,0),CH(0,k,2),tr2,tr3); PM (CH(0,k,0),CH(0,k,2),tr2,tr3);
PM (CH(0,k,3),CH(0,k,1),tr1,tr4); PM (CH(0,k,3),CH(0,k,1),tr1,tr4);
} }
...@@ -1558,8 +1557,8 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1, ...@@ -1558,8 +1557,8 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1,
size_t j2=2*j-1; size_t j2=2*j-1;
for (size_t k=0; k<l1; ++k) for (size_t k=0; k<l1; ++k)
{ {
CH(0,k,j ) = 2*CC(ido-1,j2,k); CH(0,k,j ) = T0(2)*CC(ido-1,j2,k);
CH(0,k,jc) = 2*CC(0,j2+1,k); CH(0,k,jc) = T0(2)*CC(0,j2+1,k);
} }
} }
...@@ -1674,8 +1673,7 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1, ...@@ -1674,8 +1673,7 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1,
for (size_t i=0; i<n; ++i) for (size_t i=0; i<n; ++i)
c[i] = fct*p1[i]; c[i] = fct*p1[i];
else else
for (size_t i=0; i<n; ++i) memcpy (c,p1,n*sizeof(T));
c[i] = p1[i];
} }
else else
if (fct!=1.) if (fct!=1.)
...@@ -2211,8 +2209,8 @@ template<typename T0> class T_dcst4 ...@@ -2211,8 +2209,8 @@ template<typename T0> class T_dcst4
fft->exec(y.data(), fct, true); fft->exec(y.data(), fct, true);
for(size_t i=0, ic=n2-1; i<n2; ++i, --ic) for(size_t i=0, ic=n2-1; i<n2; ++i, --ic)
{ {
c[2*i ] = 2*(y[i ].r*C2[i ].r-y[i ].i*C2[i ].i); c[2*i ] = T0( 2)*(y[i ].r*C2[i ].r-y[i ].i*C2[i ].i);
c[2*i+1] = -2*(y[ic].i*C2[ic].r+y[ic].r*C2[ic].i); c[2*i+1] = T0(-2)*(y[ic].i*C2[ic].r+y[ic].r*C2[ic].i);
} }
} }
if (!cosine) if (!cosine)
......
...@@ -42,7 +42,7 @@ namespace detail_threading { ...@@ -42,7 +42,7 @@ namespace detail_threading {
static const size_t max_threads_ = std::max<size_t>(1, std::thread::hardware_concurrency()); static const size_t max_threads_ = std::max<size_t>(1, std::thread::hardware_concurrency());
std::atomic<size_t> default_nthreads_=max_threads_; std::atomic<size_t> default_nthreads_(max_threads_);
size_t get_default_nthreads() size_t get_default_nthreads()
{ return default_nthreads_; } { return default_nthreads_; }
...@@ -310,6 +310,13 @@ class MyScheduler: public Scheduler ...@@ -310,6 +310,13 @@ class MyScheduler: public Scheduler
void Distribution::thread_map(std::function<void(Scheduler &)> f) void Distribution::thread_map(std::function<void(Scheduler &)> f)
{ {
if (nthreads_ == 1)
{
MyScheduler sched(*this, 0);
f(sched);
return;
}
auto & pool = get_pool(); auto & pool = get_pool();
latch counter(nthreads_); latch counter(nthreads_);
std::exception_ptr ex; std::exception_ptr ex;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment