#include "cblas.h" void c_sdot(enum blas_conjugate conj, int n, float alpha, const float* x, int incx, float beta, const float* y, int incy, float* r) { int i, ix = 0, iy = 0; float *r_i = r; const float *x_i = x; const float *y_i = y; float alpha_i = alpha; float beta_i = beta; float x_ii; float y_ii; float r_v; float prod; float sum; float tmp1; float tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } /* end c_sdot */ void c_ddot(enum blas_conjugate conj, int n, double alpha, const double* x, int incx, double beta, const double* y, int incy, double* r) { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } /* end c_ddot */ void c_cdot(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii[2]; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_cdot */ void c_zdot(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot */ void c_ddot_s_s(enum blas_conjugate conj, int n, double alpha, const float* x, int incx, double beta, const float* y, int incy, double* r) { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = (double) x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } /* end c_ddot_s_s */ void c_ddot_s_d(enum blas_conjugate conj, int n, double alpha, const float* x, int incx, double beta, const double* y, int incy, double* r) { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } /* end c_ddot_s_d */ void c_ddot_d_s(enum blas_conjugate conj, int n, double alpha, const double* x, int incx, double beta, const float* y, int incy, double* r) { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } /* end c_ddot_d_s */ void c_zdot_c_c(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_c_c */ void c_zdot_c_z(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_c_z */ void c_zdot_z_c(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_z_c */ void c_cdot_s_s(enum blas_conjugate conj, int n, void* alpha, const float* x, int incx, void* beta, const float* y, int incy, void* r) { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii; float r_v[2]; float prod; float sum; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_cdot_s_s */ void c_cdot_s_c(enum blas_conjugate conj, int n, void* alpha, const float* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii[2]; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_cdot_s_c */ void c_cdot_c_s(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const float* y, int incy, void* r) { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_cdot_c_s */ void c_zdot_d_d(enum blas_conjugate conj, int n, void* alpha, const double* x, int incx, void* beta, const double* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii; double r_v[2]; double prod; double sum; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_d_d */ void c_zdot_z_d(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const double* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_z_d */ void c_zdot_d_z(enum blas_conjugate conj, int n, void* alpha, const double* x, int incx, void* beta, const void* y, int incy, void* r) { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } /* end c_zdot_d_z */ void c_sdot_x(enum blas_conjugate conj, int n, float alpha, const float* x, int incx, float beta, const float* y, int incy, float* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; float *r_i = r; const float *x_i = x; const float *y_i = y; float alpha_i = alpha; float beta_i = beta; float x_ii; float y_ii; float r_v; float prod; float sum; float tmp1; float tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; float *r_i = r; const float *x_i = x; const float *y_i = y; float alpha_i = alpha; float beta_i = beta; float x_ii; float y_ii; float r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = (double) x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = (double) r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; float *r_i = r; const float *x_i = x; const float *y_i = y; float alpha_i = alpha; float beta_i = beta; float x_ii; float y_ii; float r_v; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l, tmp1_t; double tmp2_l, tmp2_t; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod_l = x_ii * y_ii; prod_t = 0.0; /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { double dt = (double) alpha_i; { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = dt * split; b1 = con - dt; b1 = con - b1; b2 = dt - b1; c11 = sum_l * dt; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * dt; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } } /* tmp1 = sum*alpha */ tmp2_l = r_v * beta_i; tmp2_t = 0.0; /* tmp2 = r*beta */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = tmp1_l + tmp2_l; e = t1 - tmp1_l; t2 = ((tmp2_l - e) + (tmp1_l - (t1 - e))) + tmp1_t + tmp2_t; /* The result is t1 + t2, after normalization. */ tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = tmp1+tmp2 */ *r = tmp1_l; /* r = tmp1 */ } break; } } /* end c_sdot_x */ void c_ddot_x(enum blas_conjugate conj, int n, double alpha, const double* x, int incx, double beta, const double* y, int incy, double* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; double y_ii; double r_v; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l, tmp1_t; double tmp2_l, tmp2_t; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii * split; a1 = con - x_ii; a1 = con - a1; a2 = x_ii - a1; con = y_ii * split; b1 = con - y_ii; b1 = con - b1; b2 = y_ii - b1; prod_l = x_ii * y_ii; prod_t = (((a1 * b1 - prod_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i * split; b1 = con - alpha_i; b1 = con - b1; b2 = alpha_i - b1; c11 = sum_l * alpha_i; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = sum*alpha */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v * split; a1 = con - r_v; a1 = con - a1; a2 = r_v - a1; con = beta_i * split; b1 = con - beta_i; b1 = con - b1; b2 = beta_i - b1; tmp2_l = r_v * beta_i; tmp2_t = (((a1 * b1 - tmp2_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* tmp2 = r*beta */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = tmp1_l + tmp2_l; e = t1 - tmp1_l; t2 = ((tmp2_l - e) + (tmp1_l - (t1 - e))) + tmp1_t + tmp2_t; /* The result is t1 + t2, after normalization. */ tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = tmp1+tmp2 */ *r = tmp1_l; /* r = tmp1 */ } break; } } /* end c_ddot_x */ void c_cdot_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii[2]; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii[2]; float r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii[2]; float r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = x_ii[0] * y_ii[0]; d2 = -x_ii[1] * y_ii[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } prod_l[0] = e1_l; prod_t[0] = e1_t; /* imaginary part */ d1 = x_ii[0] * y_ii[1]; d2 = x_ii[1] * y_ii[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } prod_l[1] = e1_l; prod_t[1] = e1_t; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { double cd[2]; cd[0] = (double) alpha_i[0]; cd[1] = (double) alpha_i[1]; { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a0_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a1_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a1_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a0_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } } /* tmp1 = sum*alpha */ { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = r_v[0] * beta_i[0]; d2 = -r_v[1] * beta_i[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[0] = e1_l; tmp2_t[0] = e1_t; /* imaginary part */ d1 = r_v[0] * beta_i[1]; d2 = r_v[1] * beta_i[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[1] = e1_l; tmp2_t[1] = e1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_cdot_x */ void c_zdot_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii[2]; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[0] * split; a1 = con - x_ii[0]; a1 = con - a1; a2 = x_ii[0] - a1; con = y_ii[0] * split; b1 = con - y_ii[0]; b1 = con - b1; b2 = y_ii[0] - b1; t1_l = x_ii[0] * y_ii[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[1] * split; a1 = con - x_ii[1]; a1 = con - a1; a2 = x_ii[1] - a1; con = y_ii[1] * split; b1 = con - y_ii[1]; b1 = con - b1; b2 = y_ii[1] - b1; t2_l = x_ii[1] * y_ii[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[0] = t1_l; prod_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[1] * split; a1 = con - x_ii[1]; a1 = con - a1; a2 = x_ii[1] - a1; con = y_ii[0] * split; b1 = con - y_ii[0]; b1 = con - b1; b2 = y_ii[0] - b1; t1_l = x_ii[1] * y_ii[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[0] * split; a1 = con - x_ii[0]; a1 = con - a1; a2 = x_ii[0] - a1; con = y_ii[1] * split; b1 = con - y_ii[1]; b1 = con - b1; b2 = y_ii[1] - b1; t2_l = x_ii[0] * y_ii[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[1] = t1_l; prod_t[1] = t1_t; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_x */ void c_ddot_s_s_x(enum blas_conjugate conj, int n, double alpha, const float* x, int incx, double beta, const float* y, int incy, double* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = (double) x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = (double) x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; float y_ii; double r_v; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l, tmp1_t; double tmp2_l, tmp2_t; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod_l = x_ii * y_ii; prod_t = 0.0; /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i * split; b1 = con - alpha_i; b1 = con - b1; b2 = alpha_i - b1; c11 = sum_l * alpha_i; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = sum*alpha */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v * split; a1 = con - r_v; a1 = con - a1; a2 = r_v - a1; con = beta_i * split; b1 = con - beta_i; b1 = con - b1; b2 = beta_i - b1; tmp2_l = r_v * beta_i; tmp2_t = (((a1 * b1 - tmp2_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* tmp2 = r*beta */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = tmp1_l + tmp2_l; e = t1 - tmp1_l; t2 = ((tmp2_l - e) + (tmp1_l - (t1 - e))) + tmp1_t + tmp2_t; /* The result is t1 + t2, after normalization. */ tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = tmp1+tmp2 */ *r = tmp1_l; /* r = tmp1 */ } break; } } /* end c_ddot_s_s_x */ void c_ddot_s_d_x(enum blas_conjugate conj, int n, double alpha, const float* x, int incx, double beta, const double* y, int incy, double* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; double y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = r; const float *x_i = x; const double *y_i = y; double alpha_i = alpha; double beta_i = beta; float x_ii; double y_ii; double r_v; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l, tmp1_t; double tmp2_l, tmp2_t; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; { double dt = (double) x_ii; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = dt * split; a1 = con - dt; a1 = con - a1; a2 = dt - a1; con = y_ii * split; b1 = con - y_ii; b1 = con - b1; b2 = y_ii - b1; prod_l = dt * y_ii; prod_t = (((a1 * b1 - prod_l) + a1 * b2) + a2 * b1) + a2 * b2; } } /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i * split; b1 = con - alpha_i; b1 = con - b1; b2 = alpha_i - b1; c11 = sum_l * alpha_i; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = sum*alpha */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v * split; a1 = con - r_v; a1 = con - a1; a2 = r_v - a1; con = beta_i * split; b1 = con - beta_i; b1 = con - b1; b2 = beta_i - b1; tmp2_l = r_v * beta_i; tmp2_t = (((a1 * b1 - tmp2_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* tmp2 = r*beta */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = tmp1_l + tmp2_l; e = t1 - tmp1_l; t2 = ((tmp2_l - e) + (tmp1_l - (t1 - e))) + tmp1_t + tmp2_t; /* The result is t1 + t2, after normalization. */ tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = tmp1+tmp2 */ *r = tmp1_l; /* r = tmp1 */ } break; } } /* end c_ddot_s_d_x */ void c_ddot_d_s_x(enum blas_conjugate conj, int n, double alpha, const double* x, int incx, double beta, const float* y, int incy, double* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; float y_ii; double r_v; double prod; double sum; double tmp1; double tmp2; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ tmp1 = sum * alpha_i; /* tmp1 = sum*alpha */ tmp2 = r_v * beta_i; /* tmp2 = r*beta */ tmp1 = tmp1 + tmp2; /* tmp1 = tmp1+tmp2 */ *r = tmp1; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = r; const double *x_i = x; const float *y_i = y; double alpha_i = alpha; double beta_i = beta; double x_ii; float y_ii; double r_v; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l, tmp1_t; double tmp2_l, tmp2_t; if ( n <= 0 ) { *r_i = 0.0; return; } r_v = r_i[0]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; { double dt = (double) y_ii; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii * split; a1 = con - x_ii; a1 = con - a1; a2 = x_ii - a1; con = dt * split; b1 = con - dt; b1 = con - b1; b2 = dt - b1; prod_l = x_ii * dt; prod_t = (((a1 * b1 - prod_l) + a1 * b2) + a2 * b1) + a2 * b2; } } /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i * split; b1 = con - alpha_i; b1 = con - b1; b2 = alpha_i - b1; c11 = sum_l * alpha_i; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = sum*alpha */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v * split; a1 = con - r_v; a1 = con - a1; a2 = r_v - a1; con = beta_i * split; b1 = con - beta_i; b1 = con - b1; b2 = beta_i - b1; tmp2_l = r_v * beta_i; tmp2_t = (((a1 * b1 - tmp2_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* tmp2 = r*beta */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = tmp1_l + tmp2_l; e = t1 - tmp1_l; t2 = ((tmp2_l - e) + (tmp1_l - (t1 - e))) + tmp1_t + tmp2_t; /* The result is t1 + t2, after normalization. */ tmp1_l = t1 + t2; tmp1_t = t2 - (tmp1_l - t1); } /* tmp1 = tmp1+tmp2 */ *r = tmp1_l; /* r = tmp1 */ } break; } } /* end c_ddot_d_s_x */ void c_zdot_c_c_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; float y_ii[2]; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = x_ii[0] * y_ii[0]; d2 = -x_ii[1] * y_ii[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } prod_l[0] = e1_l; prod_t[0] = e1_t; /* imaginary part */ d1 = x_ii[0] * y_ii[1]; d2 = x_ii[1] * y_ii[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } prod_l[1] = e1_l; prod_t[1] = e1_t; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_c_c_x */ void c_zdot_c_z_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const float *x_i = (float*) x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; float x_ii[2]; double y_ii[2]; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { double cd[2]; cd[0] = (double) x_ii[0]; cd[1] = (double) x_ii[1]; { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii[0] * split; a1 = con - y_ii[0]; a1 = con - a1; a2 = y_ii[0] - a1; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; t1_l = y_ii[0] * cd[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii[1] * split; a1 = con - y_ii[1]; a1 = con - a1; a2 = y_ii[1] - a1; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; t2_l = y_ii[1] * cd[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[0] = t1_l; prod_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii[1] * split; a1 = con - y_ii[1]; a1 = con - a1; a2 = y_ii[1] - a1; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; t1_l = y_ii[1] * cd[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii[0] * split; a1 = con - y_ii[0]; a1 = con - a1; a2 = y_ii[0] - a1; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; t2_l = y_ii[0] * cd[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[1] = t1_l; prod_t[1] = t1_t; } } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_c_z_x */ void c_zdot_z_c_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; float y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = x_ii[0] * y_ii[0] - x_ii[1] * y_ii[1]; prod[1] = x_ii[0] * y_ii[1] + x_ii[1] * y_ii[0]; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const float *y_i = (float*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; float y_ii[2]; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { double cd[2]; cd[0] = (double) y_ii[0]; cd[1] = (double) y_ii[1]; { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[0] * split; a1 = con - x_ii[0]; a1 = con - a1; a2 = x_ii[0] - a1; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; t1_l = x_ii[0] * cd[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[1] * split; a1 = con - x_ii[1]; a1 = con - a1; a2 = x_ii[1] - a1; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; t2_l = x_ii[1] * cd[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[0] = t1_l; prod_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[1] * split; a1 = con - x_ii[1]; a1 = con - a1; a2 = x_ii[1] - a1; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; t1_l = x_ii[1] * cd[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii[0] * split; a1 = con - x_ii[0]; a1 = con - a1; a2 = x_ii[0] - a1; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; t2_l = x_ii[0] * cd[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } prod_l[1] = t1_l; prod_t[1] = t1_t; } } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_z_c_x */ void c_cdot_s_s_x(enum blas_conjugate conj, int n, void* alpha, const float* x, int incx, void* beta, const float* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii; float r_v[2]; float prod; float sum; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii; float r_v[2]; double prod; double sum; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = (double) x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii; float r_v[2]; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod_l = x_ii * y_ii; prod_t = 0.0; /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { double e1_l, e1_t; double dt; dt = (double) alpha_i[0]; { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = dt * split; b1 = con - dt; b1 = con - b1; b2 = dt - b1; c11 = sum_l * dt; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * dt; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp1_l[0] = e1_l; tmp1_t[0] = e1_t; dt = (double) alpha_i[1]; { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = dt * split; b1 = con - dt; b1 = con - b1; b2 = dt - b1; c11 = sum_l * dt; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * dt; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp1_l[1] = e1_l; tmp1_t[1] = e1_t; } /* tmp1 = sum*alpha */ { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = r_v[0] * beta_i[0]; d2 = -r_v[1] * beta_i[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[0] = e1_l; tmp2_t[0] = e1_t; /* imaginary part */ d1 = r_v[0] * beta_i[1]; d2 = r_v[1] * beta_i[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[1] = e1_l; tmp2_t[1] = e1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_cdot_s_s_x */ void c_cdot_s_c_x(enum blas_conjugate conj, int n, void* alpha, const float* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii[2]; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii[2]; float r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = x; const float *y_i = (float*) y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii; float y_ii[2]; float r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod_l[0] = y_ii[0] * x_ii; prod_t[0] = 0.0; prod_l[1] = y_ii[1] * x_ii; prod_t[1] = 0.0; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { double cd[2]; cd[0] = (double) alpha_i[0]; cd[1] = (double) alpha_i[1]; { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a0_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a1_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a1_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a0_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } } /* tmp1 = sum*alpha */ { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = r_v[0] * beta_i[0]; d2 = -r_v[1] * beta_i[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[0] = e1_l; tmp2_t[0] = e1_t; /* imaginary part */ d1 = r_v[0] * beta_i[1]; d2 = r_v[1] * beta_i[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[1] = e1_l; tmp2_t[1] = e1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_cdot_s_c_x */ void c_cdot_c_s_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const float* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii; float r_v[2]; float prod[2]; float sum[2]; float tmp1[2]; float tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((float*)r)[0] = tmp1[0]; ((float*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii; float r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; float *r_i = (float*) r; const float *x_i = (float*) x; const float *y_i = y; float *alpha_i = (float*) alpha; float *beta_i = (float*) beta; float x_ii[2]; float y_ii; float r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod_l[0] = x_ii[0] * y_ii; prod_t[0] = 0.0; prod_l[1] = x_ii[1] * y_ii; prod_t[1] = 0.0; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { double cd[2]; cd[0] = (double) alpha_i[0]; cd[1] = (double) alpha_i[1]; { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a0_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a1_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = cd[0] * split; b1 = con - cd[0]; b1 = con - b1; b2 = cd[0] - b1; c11 = a1_l * cd[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * cd[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = cd[1] * split; b1 = con - cd[1]; b1 = con - b1; b2 = cd[1] - b1; c11 = a0_l * cd[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * cd[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } } /* tmp1 = sum*alpha */ { double e1_l, e1_t; double d1; double d2; /* Real part */ d1 = r_v[0] * beta_i[0]; d2 = -r_v[1] * beta_i[1]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[0] = e1_l; tmp2_t[0] = e1_t; /* imaginary part */ d1 = r_v[0] * beta_i[1]; d2 = r_v[1] * beta_i[0]; { /* Compute double-double = double + double. */ double e, t1, t2; /* Knuth trick. */ t1 = d1 + d2; e = t1 - d1; t2 = ((d2 - e) + (d1 - (t1 - e))); /* The result is t1 + t2, after normalization. */ e1_l = t1 + t2; e1_t = t2 - (e1_l - t1); } tmp2_l[1] = e1_l; tmp2_t[1] = e1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_cdot_c_s_x */ void c_zdot_d_d_x(enum blas_conjugate conj, int n, void* alpha, const double* x, int incx, void* beta, const double* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii; double r_v[2]; double prod; double sum; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii; double r_v[2]; double prod; double sum; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; prod = x_ii * y_ii; /* prod = x[i]*y[i] */ sum = sum + prod; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = alpha_i[0] * sum; tmp1[1] = alpha_i[1] * sum; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii; double r_v[2]; double prod_l, prod_t; double sum_l, sum_t; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l = sum_t = 0.0; /* sum = 0 */ if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii = y_i[iy]; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii * split; a1 = con - x_ii; a1 = con - a1; a2 = x_ii - a1; con = y_ii * split; b1 = con - y_ii; b1 = con - b1; b2 = y_ii - b1; prod_l = x_ii * y_ii; prod_t = (((a1 * b1 - prod_l) + a1 * b2) + a2 * b1) + a2 * b2; } /* prod = x[i]*y[i] */ { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = sum_l + prod_l; e = t1 - sum_l; t2 = ((prod_l - e) + (sum_l - (t1 - e))) + sum_t + prod_t; /* The result is t1 + t2, after normalization. */ sum_l = t1 + t2; sum_t = t2 - (sum_l - t1); } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-double * real. */ double t_l, t_t; { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = sum_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = sum_l * split; a11 = con - sum_l; a11 = con - a11; a21 = sum_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = sum_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = sum_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_d_d_x */ void c_zdot_d_z_x(enum blas_conjugate conj, int n, void* alpha, const double* x, int incx, void* beta, const void* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii[2]; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { prod[0] = y_ii[0] * x_ii; prod[1] = y_ii[1] * x_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = x; const double *y_i = (double*) y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii; double y_ii[2]; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incy *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii = x_i[ix]; y_ii[0] = y_i[iy]; y_ii[1] = y_i[iy+1]; { /* Compute complex-extra = complex-double * real. */ double t_l, t_t; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii * split; a1 = con - x_ii; a1 = con - a1; a2 = x_ii - a1; con = y_ii[0] * split; b1 = con - y_ii[0]; b1 = con - b1; b2 = y_ii[0] - b1; t_l = x_ii * y_ii[0]; t_t = (((a1 * b1 - t_l) + a1 * b2) + a2 * b1) + a2 * b2; } prod_l[0] = t_l; prod_t[0] = t_t; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = x_ii * split; a1 = con - x_ii; a1 = con - a1; a2 = x_ii - a1; con = y_ii[1] * split; b1 = con - y_ii[1]; b1 = con - b1; b2 = y_ii[1] - b1; t_l = x_ii * y_ii[1]; t_t = (((a1 * b1 - t_l) + a1 * b2) + a2 * b1) + a2 * b2; } prod_l[1] = t_l; prod_t[1] = t_t; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_d_z_x */ void c_zdot_z_d_x(enum blas_conjugate conj, int n, void* alpha, const void* x, int incx, void* beta, const double* y, int incy, void* r, enum blas_prec_type prec) { switch ( prec ) { case blas_prec_single: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_double: case blas_prec_indigenous: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii; double r_v[2]; double prod[2]; double sum[2]; double tmp1[2]; double tmp2[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum[0] = sum[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { prod[0] = x_ii[0] * y_ii; prod[1] = x_ii[1] * y_ii; } /* prod = x[i]*y[i] */ sum[0] = sum[0] + prod[0]; sum[1] = sum[1] + prod[1]; /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { tmp1[0] = sum[0] * alpha_i[0] - sum[1] * alpha_i[1]; tmp1[1] = sum[0] * alpha_i[1] + sum[1] * alpha_i[0]; } /* tmp1 = sum*alpha */ { tmp2[0] = r_v[0] * beta_i[0] - r_v[1] * beta_i[1]; tmp2[1] = r_v[0] * beta_i[1] + r_v[1] * beta_i[0]; } /* tmp2 = r*beta */ tmp1[0] = tmp1[0] + tmp2[0]; tmp1[1] = tmp1[1] + tmp2[1]; /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1[0]; ((double*)r)[1] = tmp1[1]; /* r = tmp1 */ } break; case blas_prec_extra: { int i, ix = 0, iy = 0; double *r_i = (double*) r; const double *x_i = (double*) x; const double *y_i = y; double *alpha_i = (double*) alpha; double *beta_i = (double*) beta; double x_ii[2]; double y_ii; double r_v[2]; double prod_l[2], prod_t[2]; double sum_l[2], sum_t[2]; double tmp1_l[2], tmp1_t[2]; double tmp2_l[2], tmp2_t[2]; if ( n <= 0 ) { r_i[0] = r_i[1] = 0.0; return; } r_v[0] = r_i[0]; r_v[1] = r_i[0+1]; sum_l[0] = sum_l[1] = sum_t[0] = sum_t[1] = 0.0; /* sum = 0 */ incx *= 2; if ( incx < 0 ) ix = (-n+1)*incx; if ( incy < 0 ) iy = (-n+1)*incx; for (i = 0; i < n; ++i) { x_ii[0] = x_i[ix]; x_ii[1] = x_i[ix+1]; y_ii = y_i[iy]; { /* Compute complex-extra = complex-double * real. */ double t_l, t_t; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii * split; a1 = con - y_ii; a1 = con - a1; a2 = y_ii - a1; con = x_ii[0] * split; b1 = con - x_ii[0]; b1 = con - b1; b2 = x_ii[0] - b1; t_l = y_ii * x_ii[0]; t_t = (((a1 * b1 - t_l) + a1 * b2) + a2 * b1) + a2 * b2; } prod_l[0] = t_l; prod_t[0] = t_t; { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = y_ii * split; a1 = con - y_ii; a1 = con - a1; a2 = y_ii - a1; con = x_ii[1] * split; b1 = con - x_ii[1]; b1 = con - b1; b2 = x_ii[1] - b1; t_l = y_ii * x_ii[1]; t_t = (((a1 * b1 - t_l) + a1 * b2) + a2 * b1) + a2 * b2; } prod_l[1] = t_l; prod_t[1] = t_t; } /* prod = x[i]*y[i] */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = sum_l[0]; a_t = sum_t[0]; b_l = prod_l[0]; b_t = prod_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[0] = t_l; sum_t[0] = t_t; /* Imaginary part */ a_l = sum_l[1]; a_t = sum_t[1]; b_l = prod_l[1]; b_t = prod_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } sum_l[1] = t_l; sum_t[1] = t_t; } /* sum = sum+prod */ ix += incx; iy += incy; } /* endfor */ { /* Compute complex-extra = complex-extra * complex-double. */ double a0_l, a0_t; double a1_l, a1_t; double t1_l, t1_t; double t2_l, t2_t; a0_l = sum_l[0]; a0_t = sum_t[0]; a1_l = sum_l[1]; a1_t = sum_t[1]; /* Real part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a0_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a1_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[0] = t1_l; tmp1_t[0] = t1_t; /* Imaginary part */ { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a1_l * split; a11 = con - a1_l; a11 = con - a11; a21 = a1_l - a11; con = alpha_i[0] * split; b1 = con - alpha_i[0]; b1 = con - b1; b2 = alpha_i[0] - b1; c11 = a1_l * alpha_i[0]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a1_t * alpha_i[0]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } { /* Compute double-double = double-double * double. */ double a11, a21, b1, b2, c11, c21, c2, con, e, t1, t2; con = a0_l * split; a11 = con - a0_l; a11 = con - a11; a21 = a0_l - a11; con = alpha_i[1] * split; b1 = con - alpha_i[1]; b1 = con - b1; b2 = alpha_i[1] - b1; c11 = a0_l * alpha_i[1]; c21 = (((a11 * b1 - c11) + a11 * b2) + a21 * b1) + a21 * b2; c2 = a0_t * alpha_i[1]; t1 = c11 + c2; e = t1 - c11; t2 = ((c2 - e) + (c11 - (t1 - e))) + c21; t2_l = t1 + t2; t2_t = t2 - (t2_l - t1); } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp1_l[1] = t1_l; tmp1_t[1] = t1_t; } /* tmp1 = sum*alpha */ { /* Compute complex-extra = complex-double * complex-double. */ double t1_l, t1_t; double t2_l, t2_t; /* Real part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[0] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[1] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } t2_l = -t2_l; t2_t = -t2_t; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[0] = t1_l; tmp2_t[0] = t1_t; /* Imaginary part */ { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[1] * split; a1 = con - r_v[1]; a1 = con - a1; a2 = r_v[1] - a1; con = beta_i[0] * split; b1 = con - beta_i[0]; b1 = con - b1; b2 = beta_i[0] - b1; t1_l = r_v[1] * beta_i[0]; t1_t = (((a1 * b1 - t1_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double_double = double * double. */ double a1, a2, b1, b2, con; con = r_v[0] * split; a1 = con - r_v[0]; a1 = con - a1; a2 = r_v[0] - a1; con = beta_i[1] * split; b1 = con - beta_i[1]; b1 = con - b1; b2 = beta_i[1] - b1; t2_l = r_v[0] * beta_i[1]; t2_t = (((a1 * b1 - t2_l) + a1 * b2) + a2 * b1) + a2 * b2; } { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = t1_l + t2_l; e = t1 - t1_l; t2 = ((t2_l - e) + (t1_l - (t1 - e))) + t1_t + t2_t; /* The result is t1 + t2, after normalization. */ t1_l = t1 + t2; t1_t = t2 - (t1_l - t1); } tmp2_l[1] = t1_l; tmp2_t[1] = t1_t; } /* tmp2 = r*beta */ { double t_l, t_t; double a_l, a_t; double b_l, b_t; /* Real part */ a_l = tmp1_l[0]; a_t = tmp1_t[0]; b_l = tmp2_l[0]; b_t = tmp2_t[0]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[0] = t_l; tmp1_t[0] = t_t; /* Imaginary part */ a_l = tmp1_l[1]; a_t = tmp1_t[1]; b_l = tmp2_l[1]; b_t = tmp2_t[1]; { /* Compute double-double = double-double + double-double. */ double e, t1, t2; /* Knuth trick. */ t1 = a_l + b_l; e = t1 - a_l; t2 = ((b_l - e) + (a_l - (t1 - e))) + a_t + b_t; /* The result is t1 + t2, after normalization. */ t_l = t1 + t2; t_t = t2 - (t_l - t1); } tmp1_l[1] = t_l; tmp1_t[1] = t_t; } /* tmp1 = tmp1+tmp2 */ ((double*)r)[0] = tmp1_l[0]; ((double*)r)[1] = tmp1_l[1]; /* r = tmp1 */ } break; } } /* end c_zdot_z_d_x */