static void arm_cmplx_dot_prod_f32_test_render(float32_t *A, float32_t *B, uint32_t blockSize, float32_t *realResult, float32_t *imagResult) { #ifdef AVG_CYCLES int i, avg_cycles, sum = 0; unsigned int cycle_count_asm = 0; for(i=0; i<1000; i++) { /* ---------------------------------------------------------------------- ** Initialize the timer calculation. ** ------------------------------------------------------------------- */ enable_ccnt(); enable_cntens(0x80000001); /* ---------------------------------------------------------------------- ** Call the Complex Dot Product process function ** ------------------------------------------------------------------- */ arm_cmplx_dot_prod_f32(A, B, blockSize, realResult, imagResult); /* ---------------------------------------------------------------------- ** Calculate the execution time ** ------------------------------------------------------------------- */ cycle_count_asm = ccnt(); disable_ccnt(); /* copying cycles of the function called each time */ sum += cycle_count_asm; } avg_cycles = sum/1000; printf("Cmplx_dot_prod_f32 Size = %d Cycles = %d\n", blockSize, avg_cycles); #else /* ---------------------------------------------------------------------- ** Call the Complex Dot Product process function ** ------------------------------------------------------------------- */ arm_cmplx_dot_prod_f32(A, B, blockSize, realResult, imagResult); #endif }
void ComplexFloatArray::complexDotProduct(ComplexFloatArray& operand2, ComplexFloat& result){ #ifdef ARM_CORTEX arm_cmplx_dot_prod_f32 ( (float*)data, (float*)operand2, size, &(result.re), &(result.im) ); #else float *pSrcA=(float*)data; float *pSrcB=(float*)operand2; float realResult=0; float imagResult=0; for(int n=0; n<size; n++) { realResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+0] - pSrcA[(2*n)+1]*pSrcB[(2*n)+1]; imagResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+1] + pSrcA[(2*n)+1]*pSrcB[(2*n)+0]; } result.re=realResult; result.im=imagResult; #endif }