65template <
typename TA,
typename TX,
typename TY>
70 blas::scalar_type<TA, TX, TY> alpha,
71 TA
const *A, int64_t lda,
72 TX
const *x, int64_t incx,
73 blas::scalar_type<TA, TX, TY> beta,
76printf(
"%s: %s\n", __func__, __PRETTY_FUNCTION__ );
77 typedef blas::scalar_type<TA, TX, TY> scalar_t;
79 #define A(i_, j_) A[ (i_) + (j_)*lda ]
82 const scalar_t zero = 0;
83 const scalar_t one = 1;
86 blas_error_if( layout != Layout::ColMajor &&
87 layout != Layout::RowMajor );
88 blas_error_if( uplo != Uplo::Lower &&
89 uplo != Uplo::Upper );
90 blas_error_if( n < 0 );
91 blas_error_if( lda < n );
92 blas_error_if( incx == 0 );
93 blas_error_if( incy == 0 );
96 if (n == 0 || (alpha == zero && beta == one))
100 if (layout == Layout::RowMajor) {
101 uplo = (uplo == Uplo::Lower ? Uplo::Upper : Uplo::Lower);
104 int64_t kx = (incx > 0 ? 0 : (-n + 1)*incx);
105 int64_t ky = (incy > 0 ? 0 : (-n + 1)*incy);
111 for (int64_t i = 0; i < n; ++i) {
116 for (int64_t i = 0; i < n; ++i) {
124 for (int64_t i = 0; i < n; ++i) {
130 for (int64_t i = 0; i < n; ++i) {
140 if (uplo == Uplo::Upper) {
143 if (incx == 1 && incy == 1) {
145 for (int64_t j = 0; j < n; ++j) {
146 scalar_t tmp1 = alpha*x[j];
147 scalar_t tmp2 = zero;
148 for (int64_t i = 0; i < j; ++i) {
149 y[i] += tmp1 * A(i, j);
150 tmp2 += A(i, j) * x[i];
152 y[j] += tmp1 * A(j, j) + alpha * tmp2;
159 for (int64_t j = 0; j < n; ++j) {
160 scalar_t tmp1 = alpha*x[jx];
161 scalar_t tmp2 = zero;
164 for (int64_t i = 0; i < j; ++i) {
165 y[iy] += tmp1 * A(i, j);
166 tmp2 += A(i, j) * x[ix];
170 y[jy] += tmp1 * A(j, j) + alpha * tmp2;
179 if (incx == 1 && incy == 1) {
181 for (int64_t j = 0; j < n; ++j) {
182 scalar_t tmp1 = alpha*x[j];
183 scalar_t tmp2 = zero;
184 for (int64_t i = j+1; i < n; ++i) {
185 y[i] += tmp1 * A(i, j);
186 tmp2 += A(i, j) * x[i];
188 y[j] += tmp1 * A(j, j) + alpha * tmp2;
195 for (int64_t j = 0; j < n; ++j) {
196 scalar_t tmp1 = alpha*x[jx];
197 scalar_t tmp2 = zero;
200 for (int64_t i = j+1; i < n; ++i) {
203 y[iy] += tmp1 * A(i, j);
204 tmp2 += A(i, j) * x[ix];
206 y[jy] += tmp1 * A(j, j) + alpha * tmp2;
void symv(blas::Layout layout, blas::Uplo uplo, int64_t n, blas::scalar_type< TA, TX, TY > alpha, TA const *A, int64_t lda, TX const *x, int64_t incx, blas::scalar_type< TA, TX, TY > beta, TY *y, int64_t incy)
Symmetric matrix-vector multiply:
Definition symv.hh:66