floats: use new internal/asm API
MODIFY
floats.go
floats.go
@@ -15,7 +15,7 @@ import (
"math"
"sort"
- "github.com/gonum/internal/asm"
+ "github.com/gonum/internal/asm/f64"
)
// Add adds, element-wise, the elements of s and dst, and stores in dst.
@@ -24,7 +24,7 @@ func Add(dst, s []float64) {
if len(dst) != len(s) {
panic("floats: length of the slices do not match")
}
- asm.DaxpyUnitaryTo(dst, 1, s, dst)
+ f64.AxpyUnitaryTo(dst, 1, s, dst)
}
// AddTo adds, element-wise, the elements of s and t and
@@ -36,7 +36,7 @@ func AddTo(dst, s, t []float64) []float64 {
if len(dst) != len(s) {
panic("floats: length of destination does not match length of adder")
}
- asm.DaxpyUnitaryTo(dst, 1, s, t)
+ f64.AxpyUnitaryTo(dst, 1, s, t)
return dst
}
@@ -53,7 +53,7 @@ func AddScaled(dst []float64, alpha float64, s []float64) {
if len(dst) != len(s) {
panic("floats: length of destination and source to not match")
}
- asm.DaxpyUnitaryTo(dst, alpha, s, dst)
+ f64.AxpyUnitaryTo(dst, alpha, s, dst)
}
// AddScaledTo performs dst = y + alpha * s, where alpha is a scalar,
@@ -65,7 +65,7 @@ func AddScaledTo(dst, y []float64, alpha float64, s []float64) []float64 {
if len(dst) != len(s) || len(dst) != len(y) {
panic("floats: lengths of slices do not match")
}
- asm.DaxpyUnitaryTo(dst, alpha, s, y)
+ f64.AxpyUnitaryTo(dst, alpha, s, y)
return dst
}
@@ -228,7 +228,7 @@ func Dot(s1, s2 []float64) float64 {
if len(s1) != len(s2) {
panic("floats: lengths of the slices do not match")
}
- return asm.DdotUnitary(s1, s2)
+ return f64.DotUnitary(s1, s2)
}
// Equal returns true if the slices have equal lengths and
@@ -699,7 +699,7 @@ func Same(s, t []float64) bool {
// Scale multiplies every element in dst by the scalar c.
func Scale(c float64, dst []float64) {
if len(dst) > 0 {
- asm.DscalUnitary(c, dst)
+ f64.ScalUnitary(c, dst)
}
}
@@ -729,7 +729,7 @@ func Sub(dst, s []float64) {
if len(dst) != len(s) {
panic("floats: length of the slices do not match")
}
- asm.DaxpyUnitaryTo(dst, -1, s, dst)
+ f64.AxpyUnitaryTo(dst, -1, s, dst)
}
// SubTo subtracts, element-wise, the elements of t from s and
@@ -741,7 +741,7 @@ func SubTo(dst, s, t []float64) []float64 {
if len(dst) != len(s) {
panic("floats: length of destination does not match length of subtractor")
}
- asm.DaxpyUnitaryTo(dst, -1, t, s)
+ f64.AxpyUnitaryTo(dst, -1, t, s)
return dst
}

floats: use new internal/asm API