void Multiply<std::complex<float> >::work( const InputItems &ins, const OutputItems &outs ){ const size_t n_nums = std::min(ins.min(), outs.min()); std::complex<float> *out = outs[0].cast<std::complex<float> *>(); const std::complex<float> *in0 = ins[0].cast<const std::complex<float> *>(); for (size_t n = 1; n < ins.size(); n++) { const std::complex<float> *in = ins[n].cast<const std::complex<float> *>(); volk_32fc_x2_multiply_32fc(out, in0, in, n_nums * _vlen); in0 = out; //for next input, we do output *= input } this->consume(n_nums); this->produce(n_nums); }
void Add<float>::work( const InputItems &ins, const OutputItems &outs ){ const size_t n_nums = std::min(ins.min(), outs.min()); float *out = outs[0].cast<float *>(); const float *in0 = ins[0].cast<const float *>(); for (size_t n = 1; n < ins.size(); n++) { const float *in = ins[n].cast<const float *>(); volk_32f_x2_add_32f(out, in0, in, n_nums * _vlen); in0 = out; //for next input, we do output += input } this->consume(n_nums); this->produce(n_nums); }
void Multiply<type>::work( const InputItems &ins, const OutputItems &outs ){ const size_t n_nums = std::min(ins.min(), outs.min()); type *out = outs[0].cast<type *>(); const type *in0 = ins[0].cast<const type *>(); for (size_t n = 1; n < ins.size(); n++) { const type *in = ins[n].cast<const type *>(); for (size_t i = 0; i < n_nums * _vlen; i++) { out[i] = in0[i] * in[i]; } in0 = out; //for next input, we do output *= input } this->consume(n_nums); this->produce(n_nums); }