mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 23:52:47 +08:00
all: fix typos
This commit is contained in:
@@ -182,7 +182,7 @@ type Edge struct {
|
||||
Weight float64 `xml:"weight,attr,omitempty"`
|
||||
}
|
||||
|
||||
// AttVlues holds a collection of attribute values.
|
||||
// AttValues holds a collection of attribute values.
|
||||
type AttValues struct {
|
||||
AttValues []AttValue `xml:"attvalue,omitempty"`
|
||||
}
|
||||
|
@@ -504,7 +504,7 @@ func TestJoin(t *testing.T) {
|
||||
want []map[string]string
|
||||
}{
|
||||
{
|
||||
name: "Indentity",
|
||||
name: "Identity",
|
||||
q: `_:a <ex:p> _:b .`,
|
||||
statements: `
|
||||
_:a <ex:p> _:b .
|
||||
|
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Ragel gramar definition derived from http://www.w3.org/TR/n-quads/#sec-grammar.
|
||||
// Ragel grammar definition derived from http://www.w3.org/TR/n-quads/#sec-grammar.
|
||||
|
||||
%%{
|
||||
machine nquads;
|
||||
|
@@ -124,7 +124,7 @@ func (d *dumper) dump(withpath bool) {
|
||||
}
|
||||
|
||||
// printEdges pretty prints the given edges to the dumper's io.Writer using the provided
|
||||
// format string. The edges are first formated to a string, so the format string must use
|
||||
// format string. The edges are first formatted to a string, so the format string must use
|
||||
// the %s verb to indicate where the edges are to be printed.
|
||||
func (d *dumper) printEdges(format string, edges []simple.WeightedEdge) {
|
||||
if d == nil {
|
||||
|
@@ -240,7 +240,7 @@ var spanningTreeTests = []struct {
|
||||
},
|
||||
}
|
||||
|
||||
func testMinumumSpanning(mst func(dst WeightedBuilder, g spanningGraph) float64, t *testing.T) {
|
||||
func testMinimumSpanning(mst func(dst WeightedBuilder, g spanningGraph) float64, t *testing.T) {
|
||||
for _, test := range spanningTreeTests {
|
||||
g := test.graph()
|
||||
for _, e := range test.edges {
|
||||
@@ -283,14 +283,14 @@ func testMinumumSpanning(mst func(dst WeightedBuilder, g spanningGraph) float64,
|
||||
|
||||
func TestKruskal(t *testing.T) {
|
||||
t.Parallel()
|
||||
testMinumumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
|
||||
testMinimumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
|
||||
return Kruskal(dst, g)
|
||||
}, t)
|
||||
}
|
||||
|
||||
func TestPrim(t *testing.T) {
|
||||
t.Parallel()
|
||||
testMinumumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
|
||||
testMinimumSpanning(func(dst WeightedBuilder, g spanningGraph) float64 {
|
||||
return Prim(dst, g)
|
||||
}, t)
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@ func TestUndirectedCyclesIn(t *testing.T) {
|
||||
// the first element has the lowest ID and then conditionally
|
||||
// reversed so that the second element has the lowest possible
|
||||
// neighbouring ID.
|
||||
// c lists each node only onces - the final node must not be a
|
||||
// c lists each node only once - the final node must not be a
|
||||
// reiteration of the first node.
|
||||
func canonicalise(c []graph.Node) []graph.Node {
|
||||
if len(c) < 2 {
|
||||
|
@@ -20,7 +20,7 @@ func TestIsPath(t *testing.T) {
|
||||
}
|
||||
p := []graph.Node{simple.Node(0)}
|
||||
if IsPathIn(dg, p) {
|
||||
t.Error("IsPath returns true on nonexistant node")
|
||||
t.Error("IsPath returns true on nonexistent node")
|
||||
}
|
||||
dg.AddNode(p[0])
|
||||
if !IsPathIn(dg, p) {
|
||||
|
@@ -238,7 +238,7 @@ func Gels(trans blas.Transpose, a blas64.General, b blas64.General, work []float
|
||||
//
|
||||
// and computing H_i = I - tau[i] * v * vᵀ.
|
||||
//
|
||||
// The orthonormal matrix Q can be constucted from a product of these elementary
|
||||
// The orthonormal matrix Q can be constructed from a product of these elementary
|
||||
// reflectors, Q = H_0 * H_1 * ... * H_{k-1}, where k = min(m,n).
|
||||
//
|
||||
// Work is temporary storage, and lwork specifies the usable memory length.
|
||||
@@ -804,7 +804,7 @@ func Trtrs(trans blas.Transpose, a blas64.Triangular, b blas64.General) (ok bool
|
||||
// larger. On return, optimal value of lwork will be stored in work[0].
|
||||
//
|
||||
// If lwork == -1, instead of performing Geev, the function only calculates the
|
||||
// optimal vaule of lwork and stores it into work[0].
|
||||
// optimal value of lwork and stores it into work[0].
|
||||
//
|
||||
// On return, first will be the index of the first valid eigenvalue.
|
||||
// If first == 0, all eigenvalues and eigenvectors have been computed.
|
||||
|
@@ -38,7 +38,7 @@ func DrsclTest(t *testing.T, impl Drscler) {
|
||||
|
||||
// Cannot test the scaling directly because of floating point scaling issues
|
||||
// (the purpose of Drscl). Instead, check that scaling and scaling back
|
||||
// yeilds approximately x. If overflow or underflow occurs then the scaling
|
||||
// yields approximately x. If overflow or underflow occurs then the scaling
|
||||
// won't match.
|
||||
impl.Drscl(len(test.x), test.a, xcopy, 1)
|
||||
if floats.Equal(xcopy, test.x) {
|
||||
|
@@ -130,7 +130,7 @@ func DsytrdTest(t *testing.T, impl Dsytrder) {
|
||||
t.Errorf("%v: Q is not orthogonal; resid=%v, want<=%v", prefix, resid, tol*float64(n))
|
||||
}
|
||||
|
||||
// Contruct symmetric tridiagonal T from d and e.
|
||||
// Construct symmetric tridiagonal T from d and e.
|
||||
tMat := zeros(n, n, n)
|
||||
for i := 0; i < n; i++ {
|
||||
tMat.Data[i*tMat.Stride+i] = d[i]
|
||||
|
@@ -520,7 +520,7 @@ func TestDenseAdd(t *testing.T) {
|
||||
temp.mat.Data = nil
|
||||
panicked, message := panics(func() { temp.Add(a, b) })
|
||||
if !panicked || !strings.HasPrefix(message, "runtime error: index out of range") {
|
||||
t.Error("exected runtime panic for nil data slice")
|
||||
t.Error("expected runtime panic for nil data slice")
|
||||
}
|
||||
|
||||
a.Add(a, b)
|
||||
@@ -608,7 +608,7 @@ func TestDenseSub(t *testing.T) {
|
||||
temp.mat.Data = nil
|
||||
panicked, message := panics(func() { temp.Sub(a, b) })
|
||||
if !panicked || !strings.HasPrefix(message, "runtime error: index out of range") {
|
||||
t.Error("exected runtime panic for nil data slice")
|
||||
t.Error("expected runtime panic for nil data slice")
|
||||
}
|
||||
|
||||
a.Sub(a, b)
|
||||
@@ -696,7 +696,7 @@ func TestDenseMulElem(t *testing.T) {
|
||||
temp.mat.Data = nil
|
||||
panicked, message := panics(func() { temp.MulElem(a, b) })
|
||||
if !panicked || !strings.HasPrefix(message, "runtime error: index out of range") {
|
||||
t.Error("exected runtime panic for nil data slice")
|
||||
t.Error("expected runtime panic for nil data slice")
|
||||
}
|
||||
|
||||
a.MulElem(a, b)
|
||||
@@ -800,7 +800,7 @@ func TestDenseDivElem(t *testing.T) {
|
||||
temp.mat.Data = nil
|
||||
panicked, message := panics(func() { temp.DivElem(a, b) })
|
||||
if !panicked || !strings.HasPrefix(message, "runtime error: index out of range") {
|
||||
t.Error("exected runtime panic for nil data slice")
|
||||
t.Error("expected runtime panic for nil data slice")
|
||||
}
|
||||
|
||||
a.DivElem(a, b)
|
||||
|
@@ -612,7 +612,7 @@ func findInitialBasic(A mat.Matrix, b []float64) ([]int, *mat.Dense, []float64,
|
||||
return nil, nil, nil, ErrInfeasible
|
||||
}
|
||||
|
||||
// findLinearlyIndependnt finds a set of linearly independent columns of A, and
|
||||
// findLinearlyIndependent finds a set of linearly independent columns of A, and
|
||||
// returns the column indexes of the linearly independent columns.
|
||||
func findLinearlyIndependent(A mat.Matrix) []int {
|
||||
m, n := A.Dims()
|
||||
|
@@ -140,7 +140,7 @@ func (b Binomial) Rand() float64 {
|
||||
// appropriate expected value. However, the Poisson approximation is
|
||||
// asymptotic such that the absolute deviation in probability is O(1/n).
|
||||
// Rejection sampling produces exact variates with at worst less than 3%
|
||||
// rejection with miminal additional computation.
|
||||
// rejection with minimal additional computation.
|
||||
|
||||
// Use rejection method with Cauchy proposal.
|
||||
g, _ := math.Lgamma(b.N + 1)
|
||||
|
@@ -17,7 +17,7 @@ import (
|
||||
// UnitNormal is an instantiation of the normal distribution with Mu = 0 and Sigma = 1.
|
||||
var UnitNormal = Normal{Mu: 0, Sigma: 1}
|
||||
|
||||
// Normal respresents a normal (Gaussian) distribution (https://en.wikipedia.org/wiki/Normal_distribution).
|
||||
// Normal represents a normal (Gaussian) distribution (https://en.wikipedia.org/wiki/Normal_distribution).
|
||||
type Normal struct {
|
||||
Mu float64 // Mean of the normal distribution
|
||||
Sigma float64 // Standard deviation of the normal distribution
|
||||
|
@@ -13,7 +13,7 @@ import (
|
||||
"gonum.org/v1/gonum/stat/spatial"
|
||||
)
|
||||
|
||||
// Euclid is a mat.Matrix whose elements refects the Euclidean
|
||||
// Euclid is a mat.Matrix whose elements reflects the Euclidean
|
||||
// distance between a series of unit-separated points strided
|
||||
// to be arranged in an x by y grid.
|
||||
type Euclid struct{ x, y int }
|
||||
|
@@ -1116,7 +1116,7 @@ func TestBhattacharyya(t *testing.T) {
|
||||
t.Errorf("Bhattacharyya distance mismatch in case %d. Expected %v, Found %v", i, test.res, resultpq)
|
||||
}
|
||||
if math.Abs(resultpq-resultqp) > 1e-10 {
|
||||
t.Errorf("Bhattacharyya distance is assymmetric in case %d.", i)
|
||||
t.Errorf("Bhattacharyya distance is asymmetric in case %d.", i)
|
||||
}
|
||||
}
|
||||
// Bhattacharyya should panic if the inputs have different length
|
||||
@@ -1154,7 +1154,7 @@ func TestHellinger(t *testing.T) {
|
||||
t.Errorf("Hellinger distance mismatch in case %d. Expected %v, Found %v", i, test.res, resultpq)
|
||||
}
|
||||
if math.Abs(resultpq-resultqp) > 1e-10 {
|
||||
t.Errorf("Hellinger distance is assymmetric in case %d.", i)
|
||||
t.Errorf("Hellinger distance is asymmetric in case %d.", i)
|
||||
}
|
||||
}
|
||||
if !panics(func() { Hellinger(make([]float64, 2), make([]float64, 3)) }) {
|
||||
|
Reference in New Issue
Block a user