59template <
typename TA,
typename TX,
typename TY>
63 blas::scalar_type<TA, TX, TY> alpha,
64 TX
const *x, int64_t incx,
65 TY
const *y, int64_t incy,
68 typedef blas::scalar_type<TA, TX, TY> scalar_t;
70 #define A(i_, j_) A[ (i_) + (j_)*lda ]
73 const scalar_t zero = 0;
76 blas_error_if( layout != Layout::ColMajor &&
77 layout != Layout::RowMajor );
78 blas_error_if( m < 0 );
79 blas_error_if( n < 0 );
80 blas_error_if( incx == 0 );
81 blas_error_if( incy == 0 );
83 if (layout == Layout::ColMajor)
84 blas_error_if( lda < m );
86 blas_error_if( lda < n );
89 if (m == 0 || n == 0 || alpha == zero)
92 if (layout == Layout::ColMajor) {
93 if (incx == 1 && incy == 1) {
95 for (int64_t j = 0; j < n; ++j) {
97 scalar_t tmp = alpha * conj( y[j] );
98 for (int64_t i = 0; i < m; ++i) {
99 A(i, j) += x[i] * tmp;
103 else if (incx == 1) {
105 int64_t jy = (incy > 0 ? 0 : (-n + 1)*incy);
106 for (int64_t j = 0; j < n; ++j) {
107 scalar_t tmp = alpha * conj( y[jy] );
108 for (int64_t i = 0; i < m; ++i) {
109 A(i, j) += x[i] * tmp;
116 int64_t kx = (incx > 0 ? 0 : (-m + 1)*incx);
117 int64_t jy = (incy > 0 ? 0 : (-n + 1)*incy);
118 for (int64_t j = 0; j < n; ++j) {
119 scalar_t tmp = alpha * conj( y[jy] );
121 for (int64_t i = 0; i < m; ++i) {
122 A(i, j) += x[ix] * tmp;
131 if (incx == 1 && incy == 1) {
133 for (int64_t i = 0; i < m; ++i) {
135 scalar_t tmp = alpha * x[i];
136 for (int64_t j = 0; j < n; ++j) {
137 A(j, i) += tmp * conj( y[j] );
141 else if (incy == 1) {
143 int64_t ix = (incx > 0 ? 0 : (-m + 1)*incx);
144 for (int64_t i = 0; i < m; ++i) {
145 scalar_t tmp = alpha * x[ix];
146 for (int64_t j = 0; j < n; ++j) {
147 A(j, i) += tmp * conj( y[j] );
154 int64_t ky = (incy > 0 ? 0 : (-n + 1)*incy);
155 int64_t ix = (incx > 0 ? 0 : (-m + 1)*incx);
156 for (int64_t i = 0; i < m; ++i) {
157 scalar_t tmp = alpha * x[ix];
159 for (int64_t j = 0; j < n; ++j) {
160 A(j, i) += tmp * conj( y[jy] );
void ger(blas::Layout layout, int64_t m, int64_t n, blas::scalar_type< TA, TX, TY > alpha, TX const *x, int64_t incx, TY const *y, int64_t incy, TA *A, int64_t lda)
General matrix rank-1 update:
Definition ger.hh:60