Refactor vectorized functions into dsp module

also added some convenience macros