W
wakun
Hi there,
I am working a project in numerical computation in which iterative
method is applied for solving equation. The problem is so big and slow.
Few days ago, I found a paper on metaprogramming , it seems that such
technique has good performance for some case. For ordinary case, my
code for implementing iterative method like
for (int i=1; i<N; i++)
{
x = f(x, x[i-1]);
}
where f(_, _) represents a function of iterative expression
I try to write a metaprogramming verion like
template <int size>
inline void meta_iter(double *x)
{
*x = f(*x, *(x-1));
metaThomas<size-1>(x+1);
}
template<> inline void meta_iter(double *x) {}
However, the performance of the metaprogramming version is not better
than ordinary version. In contrast, the former is slower than the
later!!!
I am working a project in numerical computation in which iterative
method is applied for solving equation. The problem is so big and slow.
Few days ago, I found a paper on metaprogramming , it seems that such
technique has good performance for some case. For ordinary case, my
code for implementing iterative method like
for (int i=1; i<N; i++)
{
x = f(x, x[i-1]);
}
where f(_, _) represents a function of iterative expression
I try to write a metaprogramming verion like
template <int size>
inline void meta_iter(double *x)
{
*x = f(*x, *(x-1));
metaThomas<size-1>(x+1);
}
template<> inline void meta_iter(double *x) {}
However, the performance of the metaprogramming version is not better
than ordinary version. In contrast, the former is slower than the
later!!!