gonum.org/v1/gonum@v0.14.0/blas/gonum/level1float32_sdsdot.go (about) 1 // Code generated by "go generate gonum.org/v1/gonum/blas/gonum”; DO NOT EDIT. 2 3 // Copyright ©2015 The Gonum Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 package gonum 8 9 import ( 10 "gonum.org/v1/gonum/internal/asm/f32" 11 ) 12 13 // Sdsdot computes the dot product of the two vectors plus a constant 14 // 15 // alpha + \sum_i x[i]*y[i] 16 // 17 // Float32 implementations are autogenerated and not directly tested. 18 func (Implementation) Sdsdot(n int, alpha float32, x []float32, incX int, y []float32, incY int) float32 { 19 if incX == 0 { 20 panic(zeroIncX) 21 } 22 if incY == 0 { 23 panic(zeroIncY) 24 } 25 if n <= 0 { 26 if n == 0 { 27 return 0 28 } 29 panic(nLT0) 30 } 31 if incX == 1 && incY == 1 { 32 if len(x) < n { 33 panic(shortX) 34 } 35 if len(y) < n { 36 panic(shortY) 37 } 38 return alpha + float32(f32.DdotUnitary(x[:n], y[:n])) 39 } 40 var ix, iy int 41 if incX < 0 { 42 ix = (-n + 1) * incX 43 } 44 if incY < 0 { 45 iy = (-n + 1) * incY 46 } 47 if ix >= len(x) || ix+(n-1)*incX >= len(x) { 48 panic(shortX) 49 } 50 if iy >= len(y) || iy+(n-1)*incY >= len(y) { 51 panic(shortY) 52 } 53 return alpha + float32(f32.DdotInc(x, y, uintptr(n), uintptr(incX), uintptr(incY), uintptr(ix), uintptr(iy))) 54 }