constexpr typename std::enable_if<N==N_2*2,recarr<T,N>>::type fft_helper(recarr<T,N> v, recarr<T,N_2> rofu) { return cat(zipWith(sum<T>,fft_helper(condense(v), condense(rofu)), zipWith(product<T>,fft_helper(condense(cshift1(v)), condense(rofu)), rofu)), zipWith(sub<T>,fft_helper(condense(v), condense(rofu)), zipWith(product<T>,fft_helper(condense(cshift1(v)), condense(rofu)), rofu))); }
constexpr typename enable_if<sizeof...(Ts)==(2*sizeof...(Us)),tuple<Ts...>>::type fft_helper(tuple<Ts...> v, tuple<Us...> rofu) { typedef typename pack_head<Ts...>::type T; // T is usually cx<double> return cat(zipWith(sum<T>,fft_helper(condense(v), condense(rofu)), zipWith(product<T>,fft_helper(condense(cshift1(v)), condense(rofu)), rofu)), zipWith(sub<T>,fft_helper(condense(v), condense(rofu)), zipWith(product<T>,fft_helper(condense(cshift1(v)), condense(rofu)), rofu))); }
Stream<int> testZip() { List<int> lst1 = { 1, 3, 5, 7 }; Stream<int> s1 = mkStream<int>(lst1); List<int> lst2 = { 10, 20, 30 }; Stream<int> s2 = mkStream<int>(lst2); return zipWith(std::plus<int>{}, s1, s2); }
std::forward_list<std::tuple<A,B>> zip (const std::forward_list<A>& L, const std::forward_list<B>& M) { return zipWith([] (const A& a, const B& b) {return std::make_tuple(a,b);}, L, M); }