From bd727a9e14834c5644ec756a54da92ebc7854959 Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Sun, 16 Jul 2023 08:47:29 +0800 Subject: [PATCH] all: fix typos --- graph/formats/gexf12/gexf.go | 2 +- graph/formats/rdf/equi_canonical_test.go | 2 +- graph/formats/rdf/nquads.rl | 2 +- graph/path/dynamic/dumper_test.go | 2 +- graph/path/spanning_tree_test.go | 6 +++--- graph/topo/paton_cycles_test.go | 2 +- graph/topo/topo_test.go | 2 +- lapack/lapack64/lapack64.go | 4 ++-- lapack/testlapack/drscl.go | 2 +- lapack/testlapack/dsytrd.go | 2 +- mat/dense_test.go | 8 ++++---- optimize/convex/lp/simplex.go | 2 +- stat/distuv/binomial.go | 2 +- stat/distuv/norm.go | 2 +- stat/spatial/spatial_areal_example_test.go | 2 +- stat/stat_test.go | 4 ++-- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/graph/formats/gexf12/gexf.go b/graph/formats/gexf12/gexf.go index e35a1553..353e426c 100644 --- a/graph/formats/gexf12/gexf.go +++ b/graph/formats/gexf12/gexf.go @@ -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"` } diff --git a/graph/formats/rdf/equi_canonical_test.go b/graph/formats/rdf/equi_canonical_test.go index c7b7b59e..40bc71b7 100644 --- a/graph/formats/rdf/equi_canonical_test.go +++ b/graph/formats/rdf/equi_canonical_test.go @@ -504,7 +504,7 @@ func TestJoin(t *testing.T) { want []map[string]string }{ { - name: "Indentity", + name: "Identity", q: `_:a _:b .`, statements: ` _:a _:b . diff --git a/graph/formats/rdf/nquads.rl b/graph/formats/rdf/nquads.rl index e687d6ab..876b5819 100644 --- a/graph/formats/rdf/nquads.rl +++ b/graph/formats/rdf/nquads.rl @@ -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; diff --git a/graph/path/dynamic/dumper_test.go b/graph/path/dynamic/dumper_test.go index 05646954..25781291 100644 --- a/graph/path/dynamic/dumper_test.go +++ b/graph/path/dynamic/dumper_test.go @@ -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 { diff --git a/graph/path/spanning_tree_test.go b/graph/path/spanning_tree_test.go index 21258b8a..28ae2a1d 100644 --- a/graph/path/spanning_tree_test.go +++ b/graph/path/spanning_tree_test.go @@ -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) } diff --git a/graph/topo/paton_cycles_test.go b/graph/topo/paton_cycles_test.go index d6e4ba05..a9c8a54a 100644 --- a/graph/topo/paton_cycles_test.go +++ b/graph/topo/paton_cycles_test.go @@ -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 { diff --git a/graph/topo/topo_test.go b/graph/topo/topo_test.go index e4fada98..05ab0ba2 100644 --- a/graph/topo/topo_test.go +++ b/graph/topo/topo_test.go @@ -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) { diff --git a/lapack/lapack64/lapack64.go b/lapack/lapack64/lapack64.go index acb62da4..0cf94bfc 100644 --- a/lapack/lapack64/lapack64.go +++ b/lapack/lapack64/lapack64.go @@ -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. diff --git a/lapack/testlapack/drscl.go b/lapack/testlapack/drscl.go index 41e1fc74..bdc7a565 100644 --- a/lapack/testlapack/drscl.go +++ b/lapack/testlapack/drscl.go @@ -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) { diff --git a/lapack/testlapack/dsytrd.go b/lapack/testlapack/dsytrd.go index d7155910..2b85ff3d 100644 --- a/lapack/testlapack/dsytrd.go +++ b/lapack/testlapack/dsytrd.go @@ -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] diff --git a/mat/dense_test.go b/mat/dense_test.go index 35530694..fbe4c03f 100644 --- a/mat/dense_test.go +++ b/mat/dense_test.go @@ -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) diff --git a/optimize/convex/lp/simplex.go b/optimize/convex/lp/simplex.go index 930fd6b8..5fd0dd86 100644 --- a/optimize/convex/lp/simplex.go +++ b/optimize/convex/lp/simplex.go @@ -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() diff --git a/stat/distuv/binomial.go b/stat/distuv/binomial.go index 9a480140..a7e67377 100644 --- a/stat/distuv/binomial.go +++ b/stat/distuv/binomial.go @@ -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) diff --git a/stat/distuv/norm.go b/stat/distuv/norm.go index 67614660..dd709582 100644 --- a/stat/distuv/norm.go +++ b/stat/distuv/norm.go @@ -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 diff --git a/stat/spatial/spatial_areal_example_test.go b/stat/spatial/spatial_areal_example_test.go index 6190dce6..e07afb38 100644 --- a/stat/spatial/spatial_areal_example_test.go +++ b/stat/spatial/spatial_areal_example_test.go @@ -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 } diff --git a/stat/stat_test.go b/stat/stat_test.go index 9a29e3b8..0a0cbf67 100644 --- a/stat/stat_test.go +++ b/stat/stat_test.go @@ -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)) }) {