int main(void) { complex r; complex x[3], y[3]; long n = 3; long i; printf("ACML example: dot product of two complex vectors using cdotu\n"); printf("------------------------------------------------------------\n"); printf("\n"); x[0] = compose_complex(1.0, 2.0); x[1] = compose_complex(2.0, 1.0); x[2] = compose_complex(1.0, 3.0); y[0] = compose_complex(3.0, 1.0); y[1] = compose_complex(1.0, 4.0); y[2] = compose_complex(1.0, 2.0); printf("Vector x: "); for (i = 0; i < n; i++) printf(" (%7.4f,%7.4f)\n", x[i].real, x[i].imag); printf("Vector y: "); for (i = 0; i < n; i++) printf(" (%7.4f,%7.4f)\n", y[i].real, y[i].imag); r = cdotu(n, x, 1, y, 1); printf("r = x.y = (%12.3f,%12.3f)\n", r.real, r.imag); return 0; }
unsigned long long int acml_time() { clock_gettime(CLOCK_MONOTONIC, &begin); ans1 = cdotu(N,x,incx,y,incy); clock_gettime(CLOCK_MONOTONIC, &end); unsigned long long int time = 1000000000L*(end.tv_sec - begin.tv_sec) + end.tv_nsec - begin.tv_nsec; printf("%16f%16lld",ans1,time); return time; }
void inline cblas_cdotu_sub( int const n, void const* x, int const incx, void const* y, int const incy, void* dotu) { *reinterpret_cast<std::complex<float>*>(dotu) = cdotu(n, x, incx, y, incy); }