Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Commit

Permalink
Merge pull request #37 from gonum/improvedger
Browse files Browse the repository at this point in the history
Improved Dger implementation.
  • Loading branch information
btracey committed Dec 12, 2014
2 parents 6b4b681 + 642f61b commit 1f56c5d
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions goblas/level2double.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,34 @@ func (Blas) Dger(m, n int, alpha float64, x []float64, incX int, y []float64, in
kx = -(m - 1) * incX
}

if incX == 1 && incY == 1 {
x = x[:m]
y = y[:n]
for i, xv := range x {
tmp := alpha * xv
if tmp != 0 {
atmp := a[i*lda:]
for j, yv := range y {
atmp[j] += yv * tmp
}
}
}
return
}

ix := kx
for i := 0; i < m; i++ {
if x[ix] == 0 {
ix += incX
continue
}
tmp := alpha * x[ix]
jy := ky
for j := 0; j < n; j++ {
a[i*lda+j] += y[jy] * tmp
jy += incY
if x[ix] != 0 {
tmp := alpha * x[ix]
jy := ky
atmp := a[i*lda:]
for j := 0; j < n; j++ {
atmp[j] += y[jy] * tmp
jy += incY
}
}
ix += incX
}

}

// Dgbmv performs y = alpha*A*x + beta*y where a is an mxn band matrix with
Expand Down

0 comments on commit 1f56c5d

Please sign in to comment.