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

Commit

Permalink
Remove redundant slice types from function signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Feb 10, 2015
1 parent d75fe53 commit 5ff4679
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/norm.go
Expand Up @@ -100,7 +100,7 @@ func (Normal) ExKurtosis() float64 {
// Fit sets the parameters of the probability distribution from the
// data samples x with relative weights w. If weights is nil, then all the weights
// are 1. If weights is not nil, then the len(weights) must equal len(samples).
func (n *Normal) Fit(samples []float64, weights []float64) {
func (n *Normal) Fit(samples, weights []float64) {
suffStat := make([]float64, 1)
nSamples := n.SuffStat(samples, weights, suffStat)
n.ConjugateUpdate(suffStat, nSamples, []float64{0, 0})
Expand Down
6 changes: 3 additions & 3 deletions stat.go
Expand Up @@ -672,7 +672,7 @@ func Mean(x, weights []float64) float64 {
// Mode returns the most common value in the dataset specified by x and the
// given weights. Strict float64 equality is used when comparing values, so users
// should take caution. If several values are the mode, any of them may be returned.
func Mode(x []float64, weights []float64) (val float64, count float64) {
func Mode(x, weights []float64) (val float64, count float64) {
if weights != nil && len(x) != len(weights) {
panic("stat: slice length mismatch")
}
Expand Down Expand Up @@ -877,13 +877,13 @@ func (w weightSorter) Len() int {
}

// StdDev returns the sample standard deviation.
func StdDev(x []float64, weights []float64) float64 {
func StdDev(x, weights []float64) float64 {
_, std := MeanStdDev(x, weights)
return std
}

// MeanStdDev returns the sample mean and standard deviation
func MeanStdDev(x []float64, weights []float64) (mean, std float64) {
func MeanStdDev(x, weights []float64) (mean, std float64) {
mean, variance := MeanVariance(x, weights)
return mean, math.Sqrt(variance)
}
Expand Down

0 comments on commit 5ff4679

Please sign in to comment.