diff --git a/blas/gonum/gonum.go b/blas/gonum/gonum.go index 602a8f3e..61a8b8b5 100644 --- a/blas/gonum/gonum.go +++ b/blas/gonum/gonum.go @@ -15,7 +15,7 @@ import ( type Implementation struct{} // [SD]gemm behavior constants. These are kept here to keep them out of the -// way during single precision code genration. +// way during single precision code generation. const ( blockSize = 64 // b x b matrix minParBlock = 4 // minimum number of blocks needed to go parallel diff --git a/blas/gonum/level2float32.go b/blas/gonum/level2float32.go index 1dafe599..a05b25e4 100644 --- a/blas/gonum/level2float32.go +++ b/blas/gonum/level2float32.go @@ -1556,7 +1556,7 @@ func (Implementation) Ssbmv(ul blas.Uplo, n, k int, alpha float32, a []float32, return } - // Casses where a has bands below the diagonal. + // Cases where a has bands below the diagonal. if incX == 1 { iy := ky for i := 0; i < n; i++ { diff --git a/blas/gonum/level2float64.go b/blas/gonum/level2float64.go index 488e5ac1..3f3dd368 100644 --- a/blas/gonum/level2float64.go +++ b/blas/gonum/level2float64.go @@ -1534,7 +1534,7 @@ func (Implementation) Dsbmv(ul blas.Uplo, n, k int, alpha float64, a []float64, return } - // Casses where a has bands below the diagonal. + // Cases where a has bands below the diagonal. if incX == 1 { iy := ky for i := 0; i < n; i++ { diff --git a/cmplxs/cmplxs.go b/cmplxs/cmplxs.go index f03c9de7..46f3c05e 100644 --- a/cmplxs/cmplxs.go +++ b/cmplxs/cmplxs.go @@ -255,7 +255,7 @@ func EqualFunc(s1, s2 []complex128, f func(complex128, complex128) bool) bool { } // EqualLengths returns true when all of the slices have equal length, -// and false otherwise. It also eturns true when there are no input slices. +// and false otherwise. It also returns true when there are no input slices. func EqualLengths(slices ...[]complex128) bool { // This length check is needed: http://play.golang.org/p/sdty6YiLhM if len(slices) == 0 { diff --git a/diff/fd/diff.go b/diff/fd/diff.go index 8dfb11b2..c5499aa9 100644 --- a/diff/fd/diff.go +++ b/diff/fd/diff.go @@ -87,7 +87,7 @@ var Central = Formula{ Step: 6e-6, } -// Central2nd represents a secord-order accurate centered approximation +// Central2nd represents a second-order accurate centered approximation // to the second derivative. var Central2nd = Formula{ Stencil: []Point{{Loc: -1, Coeff: 1}, {Loc: 0, Coeff: -2}, {Loc: 1, Coeff: 1}}, diff --git a/graph/coloring/coloring.go b/graph/coloring/coloring.go index 77764dc9..9159ea27 100644 --- a/graph/coloring/coloring.go +++ b/graph/coloring/coloring.go @@ -89,7 +89,7 @@ func DsaturExact(term Terminator, g graph.Undirected) (k int, colors map[int64]i // Brélaz Dsatur coloring, using the result if the recurrence is // cancelled. // We also use the initial maximum clique as a starting point for - // the exact search. If there is more than one maxumum clique, we + // the exact search. If there is more than one maximum clique, we // need to ensure that we pick the one that will lead us down the // easiest branch of the search tree. This will be the maximum // clique with the lowest degree into the remainder of the graph. @@ -174,7 +174,7 @@ func (c dSaturColoring) uncolor(id int64) { c.uncolored.Add(id) } -// dSaturExact recursively searches for an exact mimimum vertex coloring of the +// dSaturExact recursively searches for an exact minimum vertex coloring of the // full graph in cand. If no chromatic number lower than ub is found, colors is // returned as nil. func dSaturExact(term Terminator, selector *saturationDegree, cand dSaturColoring, k, ub int, best map[int64]int) (newK int, colors map[int64]int, err error) { diff --git a/graph/community/k_communities.go b/graph/community/k_communities.go index 7d9e1bc0..46e825f8 100644 --- a/graph/community/k_communities.go +++ b/graph/community/k_communities.go @@ -12,7 +12,7 @@ import ( "gonum.org/v1/gonum/graph/traverse" ) -// KCliqueCommunities returns the k-clique communties of the undirected graph g for +// KCliqueCommunities returns the k-clique communities of the undirected graph g for // k greater than zero. The returned communities are identified by linkage via k-clique // adjacency, where adjacency is defined as having k-1 common nodes. KCliqueCommunities // returns a single component including the full set of nodes of g when k is 1, diff --git a/graph/formats/cytoscapejs/cytoscapejs.go b/graph/formats/cytoscapejs/cytoscapejs.go index 49355ce2..4d8f0c6a 100644 --- a/graph/formats/cytoscapejs/cytoscapejs.go +++ b/graph/formats/cytoscapejs/cytoscapejs.go @@ -44,7 +44,7 @@ const ( ) // Type returns the element type of the receiver. It returns an error if the Element Group -// is invalid or does not match the Element Data, or if the Elelement Data is an incomplete +// is invalid or does not match the Element Data, or if the Element Data is an incomplete // edge. func (e Element) Type() (ElemType, error) { et := InvalidElement diff --git a/graph/multi/weighted_undirected.go b/graph/multi/weighted_undirected.go index f2998b53..46d4bd12 100644 --- a/graph/multi/weighted_undirected.go +++ b/graph/multi/weighted_undirected.go @@ -30,7 +30,7 @@ var ( // WeightedUndirectedGraph implements a generalized undirected graph. type WeightedUndirectedGraph struct { - // EdgeWEightFunc is used to provide + // EdgeWeightFunc is used to provide // the WeightFunc function for WeightedEdge // values returned by the graph. // WeightFunc must accept a nil input. diff --git a/graph/multigraph.go b/graph/multigraph.go index 027e4696..ea2e8e91 100644 --- a/graph/multigraph.go +++ b/graph/multigraph.go @@ -177,7 +177,7 @@ type WeightedMultigraphBuilder interface { WeightedLineAdder } -// UndirectedMultgraphBuilder is an undirected multigraph builder. +// UndirectedMultigraphBuilder is an undirected multigraph builder. type UndirectedMultigraphBuilder interface { UndirectedMultigraph MultigraphBuilder diff --git a/graph/path/dijkstra.go b/graph/path/dijkstra.go index c0ef1537..96faa816 100644 --- a/graph/path/dijkstra.go +++ b/graph/path/dijkstra.go @@ -18,7 +18,7 @@ import ( // If g is a graph.Graph, all nodes of the graph will be stored in the shortest-path // tree, otherwise only nodes reachable from u will be stored. // -// The time complexity of DijkstrFrom is O(|E|.log|V|). +// The time complexity of DijkstraFrom is O(|E|.log|V|). func DijkstraFrom(u graph.Node, g traverse.Graph) Shortest { var path Shortest if h, ok := g.(graph.Graph); ok { @@ -91,7 +91,7 @@ func DijkstraFrom(u graph.Node, g traverse.Graph) Shortest { // If g is a graph.Graph, all nodes of the graph will be stored in the shortest-path // tree, otherwise only nodes reachable from u will be stored. // -// The time complexity of DijkstrAllFrom is O(|E|.log|V|). +// The time complexity of DijkstraAllFrom is O(|E|.log|V|). func DijkstraAllFrom(u graph.Node, g traverse.Graph) ShortestAlts { var path ShortestAlts if h, ok := g.(graph.Graph); ok { @@ -161,7 +161,7 @@ func DijkstraAllFrom(u graph.Node, g traverse.Graph) ShortestAlts { // If the graph does not implement graph.Weighter, UniformCost is used. // DijkstraAllPaths will panic if g has a negative edge weight. // -// The time complexity of DijkstrAllPaths is O(|V|.|E|+|V|^2.log|V|). +// The time complexity of DijkstraAllPaths is O(|V|.|E|+|V|^2.log|V|). func DijkstraAllPaths(g graph.Graph) (paths AllShortest) { paths = newAllShortest(graph.NodesOf(g.Nodes()), false) dijkstraAllPaths(g, paths) diff --git a/graph/path/internal/testgraphs/grid.go b/graph/path/internal/testgraphs/grid.go index 5af7ed56..683f4dfc 100644 --- a/graph/path/internal/testgraphs/grid.go +++ b/graph/path/internal/testgraphs/grid.go @@ -16,8 +16,8 @@ import ( const ( Closed = '*' // Closed is the closed grid node representation. - Open = '.' // Open is the open grid node repesentation. - Unknown = '?' // Unknown is the unknown grid node repesentation. + Open = '.' // Open is the open grid node representation. + Unknown = '?' // Unknown is the unknown grid node representation. ) // Grid is a 2D grid planar undirected graph. diff --git a/graph/testgraph/testgraph.go b/graph/testgraph/testgraph.go index de520846..89b080f4 100644 --- a/graph/testgraph/testgraph.go +++ b/graph/testgraph/testgraph.go @@ -742,7 +742,7 @@ func EdgeExistence(t *testing.T, b Builder, reversedEdge bool) { // LineExistence tests the constructed graph for the ability to correctly // return the existence of lines within the graph. This is a check of the -// Line methods of graph.MultiGraph, the EdgeBetween method of graph.Undirected +// Line methods of graph.Multigraph, the EdgeBetween method of graph.Undirected // and the EdgeFromTo method of graph.Directed. LineExistence also checks // that the nodes and traversed edges exist within the graph, checking the // Node, Edge, EdgeBetween and HasEdgeBetween methods of graph.Graph, the diff --git a/interp/interp.go b/interp/interp.go index 8aae400d..5e75b810 100644 --- a/interp/interp.go +++ b/interp/interp.go @@ -106,7 +106,7 @@ func (pl PiecewiseLinear) Predict(x float64) float64 { return pl.ys[i] + pl.slopes[i]*(x-xI) } -// PiecewiseConstant is a left-continous, piecewise constant +// PiecewiseConstant is a left-continuous, piecewise constant // 1-dimensional interpolator. type PiecewiseConstant struct { // Interpolated X values. diff --git a/lapack/gonum/dgesvd.go b/lapack/gonum/dgesvd.go index f2e98547..fbaef9fb 100644 --- a/lapack/gonum/dgesvd.go +++ b/lapack/gonum/dgesvd.go @@ -473,7 +473,7 @@ func (impl Implementation) Dgesvd(jobU, jobVT lapack.SVDJob, m, n int, a []float work[itauq:], work[iwork:], lwork-iwork) iwork = ie + n - // Perform bidiagonal QR iteration, compuing left singular + // Perform bidiagonal QR iteration, computing left singular // vectors of R in work[ir:]. ok = impl.Dbdsqr(blas.Upper, n, 0, n, 0, s, work[ie:], work, 1, work[ir:], ldworkr, work, 1, work[iwork:]) diff --git a/lapack/gonum/dgtsv.go b/lapack/gonum/dgtsv.go index 36d017dd..e9e8af99 100644 --- a/lapack/gonum/dgtsv.go +++ b/lapack/gonum/dgtsv.go @@ -20,7 +20,7 @@ import "math" // On entry, b contains the n×nrhs right-hand side matrix B. On return, b will // be overwritten. If ok is true, it will be overwritten by the solution matrix X. // -// Dgtsv returns whether the solution X has been successfuly computed. +// Dgtsv returns whether the solution X has been successfully computed. func (impl Implementation) Dgtsv(n, nrhs int, dl, d, du []float64, b []float64, ldb int) (ok bool) { switch { case n < 0: diff --git a/lapack/gonum/dorglq.go b/lapack/gonum/dorglq.go index a6dd980c..d7739fb9 100644 --- a/lapack/gonum/dorglq.go +++ b/lapack/gonum/dorglq.go @@ -62,7 +62,7 @@ func (impl Implementation) Dorglq(m, n, k int, a []float64, lda int, tau, work [ } nbmin := 2 // Minimum block size - var nx int // Crossover size from blocked to unbloked code + var nx int // Crossover size from blocked to unblocked code iws := m // Length of work needed var ldwork int if 1 < nb && nb < k { @@ -90,7 +90,7 @@ func (impl Implementation) Dorglq(m, n, k int, a []float64, lda int, tau, work [ } } if kk < m { - // Perform the operation on colums kk to the end. + // Perform the operation on columns kk to the end. impl.Dorgl2(m-kk, n-kk, k-kk, a[kk*lda+kk:], lda, tau[kk:], work) } if kk > 0 { diff --git a/lapack/gonum/dorgqr.go b/lapack/gonum/dorgqr.go index f07fdaf4..7725cf4c 100644 --- a/lapack/gonum/dorgqr.go +++ b/lapack/gonum/dorgqr.go @@ -73,7 +73,7 @@ func (impl Implementation) Dorgqr(m, n, k int, a []float64, lda int, tau, work [ } nbmin := 2 // Minimum block size - var nx int // Crossover size from blocked to unbloked code + var nx int // Crossover size from blocked to unblocked code iws := n // Length of work needed var ldwork int if 1 < nb && nb < k { @@ -100,7 +100,7 @@ func (impl Implementation) Dorgqr(m, n, k int, a []float64, lda int, tau, work [ } } if kk < n { - // Perform the operation on colums kk to the end. + // Perform the operation on columns kk to the end. impl.Dorg2r(m-kk, n-kk, k-kk, a[kk*lda+kk:], lda, tau[kk:], work) } if kk > 0 { diff --git a/lapack/lapack64/lapack64.go b/lapack/lapack64/lapack64.go index 66bbd9d0..aabad611 100644 --- a/lapack/lapack64/lapack64.go +++ b/lapack/lapack64/lapack64.go @@ -465,7 +465,7 @@ func Ggsvd3(jobU, jobV, jobQ lapack.GSVDJob, a, b blas64.General, alpha, beta [] // On entry, b contains the n×nrhs right-hand side matrix B. On return, it will // be overwritten. If ok is true, it will be overwritten by the solution matrix X. // -// Gtsv returns whether the solution X has been successfuly computed. +// Gtsv returns whether the solution X has been successfully computed. // // Dgtsv is not part of the lapack.Float64 interface and so calls to Gtsv are // always executed by the Gonum implementation. @@ -621,7 +621,7 @@ func Ormqr(side blas.Side, trans blas.Transpose, a blas64.General, tau []float64 } // Pocon estimates the reciprocal of the condition number of a positive-definite -// matrix A given the Cholesky decmposition of A. The condition number computed +// matrix A given the Cholesky decomposition of A. The condition number computed // is based on the 1-norm and the ∞-norm. // // anorm is the 1-norm and the ∞-norm of the original matrix A. diff --git a/lapack/testlapack/dlags2.go b/lapack/testlapack/dlags2.go index 519b1e08..e26f03ba 100644 --- a/lapack/testlapack/dlags2.go +++ b/lapack/testlapack/dlags2.go @@ -36,7 +36,7 @@ func Dlags2Test(t *testing.T, impl Dlags2er) { b2 := rnd.Float64() b3 := rnd.Float64() - // Compute orthogal matrices U, V, Q + // Compute orthogonal matrices U, V, Q // U = [ csu snu ], V = [ csv snv ], Q = [ csq snq ] // [ -snu csu ] [ -snv csv ] [ -snq csq ] // that transform A and B. diff --git a/lapack/testlapack/dlarft.go b/lapack/testlapack/dlarft.go index c6f7b22f..f871e6d6 100644 --- a/lapack/testlapack/dlarft.go +++ b/lapack/testlapack/dlarft.go @@ -80,14 +80,14 @@ func DlarftTest(t *testing.T, impl Dlarfter) { tData := make([]float64, len(tm)) copy(tData, tm) if direct == lapack.Forward { - // Zero out the lower traingular portion. + // Zero out the lower triangular portion. for i := 0; i < k; i++ { for j := 0; j < i; j++ { tData[i*ldt+j] = 0 } } } else { - // Zero out the upper traingular portion. + // Zero out the upper triangular portion. for i := 0; i < k; i++ { for j := i + 1; j < k; j++ { tData[i*ldt+j] = 0 diff --git a/mat/io.go b/mat/io.go index 6f7f4431..9ac04f26 100644 --- a/mat/io.go +++ b/mat/io.go @@ -287,7 +287,7 @@ func (v VecDense) MarshalBinary() ([]byte, error) { // MarshalBinaryTo encodes the receiver into a binary form, writes it to w and // returns the number of bytes written and an error if any. // -// See MarshalBainry for the on-disk format. +// See MarshalBinary for the on-disk format. func (v VecDense) MarshalBinaryTo(w io.Writer) (int, error) { header := storage{ Form: 'G', Packing: 'F', Uplo: 'A', diff --git a/mat/matrix.go b/mat/matrix.go index 8de5d721..5ad22ca5 100644 --- a/mat/matrix.go +++ b/mat/matrix.go @@ -413,7 +413,7 @@ func Cond(a Matrix, norm float64) float64 { return lq.Cond() } -// Det returns the determinant of the quare matrix a. In many expressions using +// Det returns the determinant of the square matrix a. In many expressions using // LogDet will be more numerically stable. // // Det panics with ErrSquare if a is not square and with ErrZeroLength if a has diff --git a/optimize/convex/lp/simplex.go b/optimize/convex/lp/simplex.go index fc5364fb..8b396149 100644 --- a/optimize/convex/lp/simplex.go +++ b/optimize/convex/lp/simplex.go @@ -400,7 +400,7 @@ func verifyInputs(initialBasic []int, c []float64, A mat.Matrix, b []float64) er // Do some sanity checks so that ab does not become singular during the // simplex solution. If the ZeroRow checks are removed then the code for - // finding a set of linearly indepent columns must be improved. + // finding a set of linearly independent columns must be improved. // Check that if a row of A only has zero elements that corresponding // element in b is zero, otherwise the problem is infeasible. diff --git a/stat/distmv/normal.go b/stat/distmv/normal.go index 9cacc97e..98bfb895 100644 --- a/stat/distmv/normal.go +++ b/stat/distmv/normal.go @@ -97,7 +97,7 @@ func NewNormalPrecision(mu []float64, prec *mat.SymDense, src rand.Source) (norm if dim != len(mu) { panic(badSizeMismatch) } - // TODO(btracey): Computing a matrix inverse is generally numerically instable. + // TODO(btracey): Computing a matrix inverse is generally numerically unstable. // This only has to compute the inverse of a positive definite matrix, which // is much better, but this still loses precision. It is worth considering if // instead the precision matrix should be stored explicitly and used instead diff --git a/stat/distuv/beta.go b/stat/distuv/beta.go index 37725b35..8887ae1a 100644 --- a/stat/distuv/beta.go +++ b/stat/distuv/beta.go @@ -89,7 +89,7 @@ func (b Beta) Mean() float64 { // Mode returns the mode of the distribution. // -// Mode returns NaN if both parametera are less than or equal to 1 as a special case, +// Mode returns NaN if both parameters are less than or equal to 1 as a special case, // 0 if only Alpha <= 1 and 1 if only Beta <= 1. func (b Beta) Mode() float64 { if b.Alpha <= 1 { diff --git a/stat/distuv/logistic.go b/stat/distuv/logistic.go index 50aa6f2a..4972122a 100644 --- a/stat/distuv/logistic.go +++ b/stat/distuv/logistic.go @@ -11,7 +11,7 @@ import ( // Logistic implements the Logistic distribution, a two-parameter distribution with support on the real axis. // Its cumulative distribution function is the logistic function. // -// General form of probability density fuction for Logistic distribution is +// General form of probability density function for Logistic distribution is // E(x) / (s * (1 + E(x))^2) // where E(x) = exp(-(x-μ)/s) // diff --git a/stat/distuv/studentst.go b/stat/distuv/studentst.go index 2648599f..89624624 100644 --- a/stat/distuv/studentst.go +++ b/stat/distuv/studentst.go @@ -35,7 +35,7 @@ type StudentsT struct { // standard deviation by std = Sigma * sqrt(Nu/(Nu-2)) Sigma float64 - // Nu is the shape prameter of the distribution, representing the number of + // Nu is the shape parameter of the distribution, representing the number of // degrees of the distribution, and one less than the number of observations // from a Normal distribution. Nu float64 diff --git a/stat/samplemv/metropolishastings.go b/stat/samplemv/metropolishastings.go index 00a4f212..fa11e786 100644 --- a/stat/samplemv/metropolishastings.go +++ b/stat/samplemv/metropolishastings.go @@ -190,7 +190,7 @@ func NewProposalNormal(sigma *mat.SymDense, src rand.Source) (*ProposalNormal, b // ConditionalLogProb panics if the input slices are not the same length or // are not equal to the dimension of the covariance matrix. func (p *ProposalNormal) ConditionalLogProb(x, y []float64) (prob float64) { - // Either SetMean or LogProb will panic if the slice lengths are innaccurate. + // Either SetMean or LogProb will panic if the slice lengths are inaccurate. p.normal.SetMean(y) return p.normal.LogProb(x) } diff --git a/stat/samplemv/samplemv.go b/stat/samplemv/samplemv.go index e0a38d27..be85de90 100644 --- a/stat/samplemv/samplemv.go +++ b/stat/samplemv/samplemv.go @@ -166,10 +166,10 @@ var ErrRejection = errors.New("rejection: acceptance ratio above 1") // // The number of proposed locations during sampling can be found with a call to // Proposed. If there was an error during sampling, all elements of samples are -// set to NaN and the error can be accesssed with the Err method. If src != nil, +// set to NaN and the error can be accessed with the Err method. If src != nil, // it will be used to generate random numbers, otherwise rand.Float64 will be used. // -// Target may return the true (log of) the probablity of the location, or it may return +// Target may return the true (log of) the probability of the location, or it may return // a value that is proportional to the probability (logprob + constant). This is // useful for cases where the probability distribution is only known up to a normalization // constant. diff --git a/stat/sampleuv/sample.go b/stat/sampleuv/sample.go index 724a4063..36e84223 100644 --- a/stat/sampleuv/sample.go +++ b/stat/sampleuv/sample.go @@ -155,10 +155,10 @@ var ErrRejection = errors.New("rejection: acceptance ratio above 1") // // The number of proposed locations during sampling can be found with a call to // Proposed. If there was an error during sampling, all elements of samples are -// set to NaN and the error can be accesssed with the Err method. If src != nil, +// set to NaN and the error can be accessed with the Err method. If src != nil, // it will be used to generate random numbers, otherwise rand.Float64 will be used. // -// Target may return the true (log of) the probablity of the location, or it may return +// Target may return the true (log of) the probability of the location, or it may return // a value that is proportional to the probability (logprob + constant). This is // useful for cases where the probability distribution is only known up to a normalization // constant. diff --git a/stat/stat.go b/stat/stat.go index f17d317a..6649e0a6 100644 --- a/stat/stat.go +++ b/stat/stat.go @@ -562,7 +562,7 @@ func Histogram(count, dividers, x, weights []float64) []float64 { // p and q. The Jensen-Shannon divergence is defined as // m = 0.5 * (p + q) // JS(p, q) = 0.5 ( KL(p, m) + KL(q, m) ) -// Unlike Kullback-Liebler, the Jensen-Shannon distance is symmetric. The value +// Unlike Kullback-Leibler, the Jensen-Shannon distance is symmetric. The value // is between 0 and ln(2). func JensenShannon(p, q []float64) float64 { if len(p) != len(q) {