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

Commit

Permalink
s/ParameterMarshaler/ParameterMarshaller
Browse files Browse the repository at this point in the history
The name of the interface was not spelled correctly.
  • Loading branch information
jonlawlor committed Jan 28, 2015
1 parent 87d4dfc commit df8cb40
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist/exponential.go
Expand Up @@ -123,7 +123,7 @@ func (e Exponential) LogProb(x float64) float64 {
return math.Log(e.Rate) - e.Rate*x
}

// MarshalParameters implements the ParameterMarshaler interface
// MarshalParameters implements the ParameterMarshaller interface
func (e Exponential) MarshalParameters(p []Parameter) {
nParam := e.NumParameters()
if len(p) != nParam {
Expand Down Expand Up @@ -229,7 +229,7 @@ func (e Exponential) Survival(x float64) float64 {
return math.Exp(-e.Rate * x)
}

// UnmarshalParameters implements the ParameterMarshaler interface
// UnmarshalParameters implements the ParameterMarshaller interface
func (e *Exponential) UnmarshalParameters(p []Parameter) {
if len(p) != e.NumParameters() {
panic("exponential: incorrect number of parameters to set")
Expand Down
6 changes: 3 additions & 3 deletions dist/general.go
Expand Up @@ -6,9 +6,9 @@ type Parameter struct {
Value float64
}

// A ParameterMarshaler is a type that can marshal itself into a slice of Paramaters
// A ParameterMarshaller is a type that can marshal itself into a slice of Paramaters
// and unmarshal itself from the slice of parameters.
// ParameterMarshaler exists to support algorithms that modify parameters of arbitrary distributions.
// ParameterMarshaller exists to support algorithms that modify parameters of arbitrary distributions.
// Typically, users should modify distributions using the fields of the specifc
// distribution.
// Marshal and Unmarshal are to be used as a pair, users should not attempt to construct
Expand All @@ -19,7 +19,7 @@ type Parameter struct {
// UnmarshalParameters will panic if the names of the parameters do not match.
// UnmarshalParameters tests names in the same order as they were created in
// MarshalParameters.
type ParameterMarshaler interface {
type ParameterMarshaller interface {
MarshalParameters([]Parameter)
UnmarshalParameters([]Parameter)
}
4 changes: 2 additions & 2 deletions dist/laplace.go
Expand Up @@ -134,7 +134,7 @@ func (l Laplace) LogProb(x float64) float64 {
return -math.Ln2 - math.Log(l.Scale) - math.Abs(x-l.Mu)/l.Scale
}

// MarshalParameters implements the ParameterMarshaler interface
// MarshalParameters implements the ParameterMarshaller interface
func (l Laplace) MarshalParameters(p []Parameter) {
if len(p) != l.NumParameters() {
panic("dist: slice length mismatch")
Expand Down Expand Up @@ -215,7 +215,7 @@ func (l Laplace) Survival(x float64) float64 {
return 0.5 * math.Exp(-(x-l.Mu)/l.Scale)
}

// UnmarshalParameters implements the ParameterMarshaler interface
// UnmarshalParameters implements the ParameterMarshaller interface
func (l *Laplace) UnmarshalParameters(p []Parameter) {
if len(p) != l.NumParameters() {
panic("dist: slice length mismatch")
Expand Down
4 changes: 2 additions & 2 deletions dist/norm.go
Expand Up @@ -111,7 +111,7 @@ func (n Normal) LogProb(x float64) float64 {
return negLogRoot2Pi - math.Log(n.Sigma) - (x-n.Mu)*(x-n.Mu)/(2*n.Sigma*n.Sigma)
}

// MarshalParameters implements the ParameterMarshaler interface
// MarshalParameters implements the ParameterMarshaller interface
func (n Normal) MarshalParameters(p []Parameter) {
nParam := n.NumParameters()
if len(p) != nParam {
Expand Down Expand Up @@ -220,7 +220,7 @@ func (n Normal) Survival(x float64) float64 {
return 0.5 * (1 - math.Erf((x-n.Mu)/(n.Sigma*math.Sqrt2)))
}

// UnmarshalParameters implements the ParameterMarshaler interface
// UnmarshalParameters implements the ParameterMarshaller interface
func (n *Normal) UnmarshalParameters(p []Parameter) {
if len(p) != n.NumParameters() {
panic("normal: incorrect number of parameters to set")
Expand Down
4 changes: 2 additions & 2 deletions dist/uniform.go
Expand Up @@ -47,7 +47,7 @@ func (u Uniform) LogProb(x float64) float64 {
return -math.Log(u.Max - u.Min)
}

// MarshalParameters implements the ParameterMarshaler interface
// MarshalParameters implements the ParameterMarshaller interface
func (u Uniform) MarshalParameters(p []Parameter) {
if len(p) != u.NumParameters() {
panic("uniform: improper parameter length")
Expand Down Expand Up @@ -121,7 +121,7 @@ func (u Uniform) Survival(x float64) float64 {
return (u.Max - x) / (u.Max - u.Min)
}

// UnmarshalParameters implements the ParameterMarshaler interface
// UnmarshalParameters implements the ParameterMarshaller interface
func (u *Uniform) UnmarshalParameters(p []Parameter) {
if len(p) != u.NumParameters() {
panic("uniform: incorrect number of parameters to set")
Expand Down
4 changes: 2 additions & 2 deletions dist/weibull.go
Expand Up @@ -122,7 +122,7 @@ func (w Weibull) LogSurvival(x float64) float64 {
}
}

// MarshalParameters implements the ParameterMarshaler interface.
// MarshalParameters implements the ParameterMarshaller interface.
func (w Weibull) MarshalParameters(p []Parameter) {
nParam := w.NumParameters()
if len(p) != nParam {
Expand Down Expand Up @@ -212,7 +212,7 @@ func (w Weibull) Survival(x float64) float64 {
return math.Exp(w.LogSurvival(x))
}

// UnmarshalParameters implements the ParameterMarshaler interface.
// UnmarshalParameters implements the ParameterMarshaller interface.
func (w *Weibull) UnmarshalParameters(p []Parameter) {
if len(p) != w.NumParameters() {
panic("weibull: incorrect number of parameters to set")
Expand Down

0 comments on commit df8cb40

Please sign in to comment.