1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
// Copyright ©2015 The Gonum Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !noasm && !gccgo && !safe
// +build !noasm,!gccgo,!safe
package f64
// L1Norm is
//
// for _, v := range x {
// sum += math.Abs(v)
// }
// return sum
func L1Norm(x []float64) (sum float64)
// L1NormInc is
//
// for i := 0; i < n*incX; i += incX {
// sum += math.Abs(x[i])
// }
// return sum
func L1NormInc(x []float64, n, incX int) (sum float64)
// AddConst is
//
// for i := range x {
// x[i] += alpha
// }
func AddConst(alpha float64, x []float64)
// Add is
//
// for i, v := range s {
// dst[i] += v
// }
func Add(dst, s []float64)
// AxpyUnitary is
//
// for i, v := range x {
// y[i] += alpha * v
// }
func AxpyUnitary(alpha float64, x, y []float64)
// AxpyUnitaryTo is
//
// for i, v := range x {
// dst[i] = alpha*v + y[i]
// }
func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64)
// AxpyInc is
//
// for i := 0; i < int(n); i++ {
// y[iy] += alpha * x[ix]
// ix += incX
// iy += incY
// }
func AxpyInc(alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)
// AxpyIncTo is
//
// for i := 0; i < int(n); i++ {
// dst[idst] = alpha*x[ix] + y[iy]
// ix += incX
// iy += incY
// idst += incDst
// }
func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)
// CumSum is
//
// if len(s) == 0 {
// return dst
// }
// dst[0] = s[0]
// for i, v := range s[1:] {
// dst[i+1] = dst[i] + v
// }
// return dst
func CumSum(dst, s []float64) []float64
// CumProd is
//
// if len(s) == 0 {
// return dst
// }
// dst[0] = s[0]
// for i, v := range s[1:] {
// dst[i+1] = dst[i] * v
// }
// return dst
func CumProd(dst, s []float64) []float64
// Div is
//
// for i, v := range s {
// dst[i] /= v
// }
func Div(dst, s []float64)
// DivTo is
//
// for i, v := range s {
// dst[i] = v / t[i]
// }
// return dst
func DivTo(dst, x, y []float64) []float64
// DotUnitary is
//
// for i, v := range x {
// sum += y[i] * v
// }
// return sum
func DotUnitary(x, y []float64) (sum float64)
// DotInc is
//
// for i := 0; i < int(n); i++ {
// sum += y[iy] * x[ix]
// ix += incX
// iy += incY
// }
// return sum
func DotInc(x, y []float64, n, incX, incY, ix, iy uintptr) (sum float64)
// L1Dist is
//
// var norm float64
// for i, v := range s {
// norm += math.Abs(t[i] - v)
// }
// return norm
func L1Dist(s, t []float64) float64
// LinfDist is
//
// var norm float64
// if len(s) == 0 {
// return 0
// }
// norm = math.Abs(t[0] - s[0])
// for i, v := range s[1:] {
// absDiff := math.Abs(t[i+1] - v)
// if absDiff > norm || math.IsNaN(norm) {
// norm = absDiff
// }
// }
// return norm
func LinfDist(s, t []float64) float64
// ScalUnitary is
//
// for i := range x {
// x[i] *= alpha
// }
func ScalUnitary(alpha float64, x []float64)
// ScalUnitaryTo is
//
// for i, v := range x {
// dst[i] = alpha * v
// }
func ScalUnitaryTo(dst []float64, alpha float64, x []float64)
// ScalInc is
//
// var ix uintptr
// for i := 0; i < int(n); i++ {
// x[ix] *= alpha
// ix += incX
// }
func ScalInc(alpha float64, x []float64, n, incX uintptr)
// ScalIncTo is
//
// var idst, ix uintptr
// for i := 0; i < int(n); i++ {
// dst[idst] = alpha * x[ix]
// ix += incX
// idst += incDst
// }
func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr)
// Sum is
//
// var sum float64
// for i := range x {
// sum += x[i]
// }
func Sum(x []float64) float64
// L2NormUnitary returns the L2-norm of x.
//
// var scale float64
// sumSquares := 1.0
// for _, v := range x {
// if v == 0 {
// continue
// }
// absxi := math.Abs(v)
// if math.IsNaN(absxi) {
// return math.NaN()
// }
// if scale < absxi {
// s := scale / absxi
// sumSquares = 1 + sumSquares*s*s
// scale = absxi
// } else {
// s := absxi / scale
// sumSquares += s * s
// }
// if math.IsInf(scale, 1) {
// return math.Inf(1)
// }
// }
// return scale * math.Sqrt(sumSquares)
func L2NormUnitary(x []float64) (norm float64)
// L2NormInc returns the L2-norm of x.
//
// var scale float64
// sumSquares := 1.0
// for ix := uintptr(0); ix < n*incX; ix += incX {
// val := x[ix]
// if val == 0 {
// continue
// }
// absxi := math.Abs(val)
// if math.IsNaN(absxi) {
// return math.NaN()
// }
// if scale < absxi {
// s := scale / absxi
// sumSquares = 1 + sumSquares*s*s
// scale = absxi
// } else {
// s := absxi / scale
// sumSquares += s * s
// }
// }
// if math.IsInf(scale, 1) {
// return math.Inf(1)
// }
// return scale * math.Sqrt(sumSquares)
func L2NormInc(x []float64, n, incX uintptr) (norm float64)
// L2DistanceUnitary returns the L2-norm of x-y.
//
// var scale float64
// sumSquares := 1.0
// for i, v := range x {
// v -= y[i]
// if v == 0 {
// continue
// }
// absxi := math.Abs(v)
// if math.IsNaN(absxi) {
// return math.NaN()
// }
// if scale < absxi {
// s := scale / absxi
// sumSquares = 1 + sumSquares*s*s
// scale = absxi
// } else {
// s := absxi / scale
// sumSquares += s * s
// }
// }
// if math.IsInf(scale, 1) {
// return math.Inf(1)
// }
// return scale * math.Sqrt(sumSquares)
func L2DistanceUnitary(x, y []float64) (norm float64)
|