loop over a very long container (millions elements) { each element compute 8 integers: k1,k2,k3,...,k8 call function func(k1,k2,k3,...,k8) } container is a std::vector, element is a long integer each k can only take {0,1,2,..5} six values. func is a simple expression of complex number calculation, involves std::conj and std::exp
To speed things up, I cache all the possible results of the func function into an array and instead call func_array [k1] [k2] [k3] .... But if you just define func_array as: std :: complex func_array [6] [6] [ 6] ..., the program dies when the stack overflows.
Any better solutions to speed up?
source share