gonum.org/v1/gonum@v0.14.0/internal/asm/f32/ge_noasm.go (about) 1 // Copyright ©2017 The Gonum Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build !amd64 || noasm || gccgo || safe 6 // +build !amd64 noasm gccgo safe 7 8 package f32 9 10 // Ger performs the rank-one operation 11 // 12 // A += alpha * x * yᵀ 13 // 14 // where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar. 15 func Ger(m, n uintptr, alpha float32, x []float32, incX uintptr, y []float32, incY uintptr, a []float32, lda uintptr) { 16 17 if incX == 1 && incY == 1 { 18 x = x[:m] 19 y = y[:n] 20 for i, xv := range x { 21 AxpyUnitary(alpha*xv, y, a[uintptr(i)*lda:uintptr(i)*lda+n]) 22 } 23 return 24 } 25 26 var ky, kx uintptr 27 if int(incY) < 0 { 28 ky = uintptr(-int(n-1) * int(incY)) 29 } 30 if int(incX) < 0 { 31 kx = uintptr(-int(m-1) * int(incX)) 32 } 33 34 ix := kx 35 for i := 0; i < int(m); i++ { 36 AxpyInc(alpha*x[ix], y, a[uintptr(i)*lda:uintptr(i)*lda+n], uintptr(n), uintptr(incY), 1, uintptr(ky), 0) 37 ix += incX 38 } 39 }