all: fix spelling errors

This commit is contained in:
kortschak
2017-06-17 19:58:08 +09:30
committed by Dan Kortschak
parent 6557c5dc64
commit a1347c0243
23 changed files with 60 additions and 60 deletions

View File

@@ -11,7 +11,7 @@ var (
_ blas.Complex128 = Implementation{}
)
// TOOD(btracey): Replace this as complex routines are added, and instead
// TODO(btracey): Replace this as complex routines are added, and instead
// automatically generate the complex64 routines from the complex128 ones.
var noComplex = "native: implementation does not implement this routine, see the cgo wrapper in gonum.org/v1/netlib/blas"

View File

@@ -121,7 +121,7 @@ func dgemmParallel(aTrans, bTrans bool, m, n, k int, a []float64, lda int, b []f
go func() {
defer wg.Done()
// Make local copies of otherwise global variables to reduce shared memory.
// This has a noticable effect on benchmarks in some cases.
// This has a noticeable effect on benchmarks in some cases.
alpha := alpha
aTrans := aTrans
bTrans := bTrans

View File

@@ -62,7 +62,7 @@ func min(a, b int) int {
return a
}
// blocks returns the number of divisons of the dimension length with the given
// blocks returns the number of divisions of the dimension length with the given
// block size.
func blocks(dim, bsize int) int {
return (dim + bsize - 1) / bsize

View File

@@ -186,7 +186,7 @@ func TestCumProd(t *testing.T) {
emptyReceiver := make([]float64, 0)
truth = []float64{}
CumProd(emptyReceiver, emptyReceiver)
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumprod returned with emtpy receiver")
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumprod returned with empty receiver")
}
@@ -209,7 +209,7 @@ func TestCumSum(t *testing.T) {
emptyReceiver := make([]float64, 0)
truth = []float64{}
CumSum(emptyReceiver, emptyReceiver)
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumsum returned with emtpy receiver")
AreSlicesEqual(t, truth, emptyReceiver, "Wrong cumsum returned with empty receiver")
}

View File

@@ -553,7 +553,7 @@ func (l *directedLocalMover) deltaQ(n graph.Node) (deltaQ float64, dst int, src
m := l.m
gamma := l.resolution
// Find communites connected to n.
// Find communities connected to n.
connected := make(set.Ints)
// The following for loop is equivalent to:
//

View File

@@ -500,7 +500,7 @@ func (l *undirectedLocalMover) deltaQ(n graph.Node) (deltaQ float64, dst int, sr
m2 := l.m2
gamma := l.resolution
// Find communites connected to n.
// Find communities connected to n.
connected := make(set.Ints)
// The following for loop is equivalent to:
//

View File

@@ -73,7 +73,7 @@ func Duplication(dst UndirectedMutator, n int, delta, alpha, sigma float64, src
// Loop until we have connectivity
// into the rest of the graph.
for {
// Add edges to parent's neigbours.
// Add edges to parent's neighbours.
to := dst.From(u)
sort.Sort(ordered.ByID(to))
for _, v := range to {

View File

@@ -72,7 +72,7 @@ var aStarTests = []struct {
g: func() graph.Graph {
tg := internal.NewGrid(10, 10, true)
// Create a partial "wall" accross the middle
// Create a partial "wall" across the middle
// row with a gap at the left-hand end.
tg.Set(4, 1, false)
tg.Set(4, 2, false)
@@ -94,7 +94,7 @@ var aStarTests = []struct {
g: func() graph.Graph {
tg := internal.NewGrid(10, 10, true)
// Create a partial "wall" accross the middle
// Create a partial "wall" across the middle
// row with a gap at the left-hand end.
tg.Set(4, 1, false)
tg.Set(4, 2, false)

View File

@@ -85,7 +85,7 @@ func TestPathExistsInUndirected(t *testing.T) {
got := PathExistsIn(g, simple.Node(test.from), simple.Node(test.to))
if got != test.want {
t.Errorf("unexpected result for path existance in test %d: got:%t want %t", i, got, test.want)
t.Errorf("unexpected result for path existence in test %d: got:%t want %t", i, got, test.want)
}
}
}
@@ -124,7 +124,7 @@ func TestPathExistsInDirected(t *testing.T) {
got := PathExistsIn(g, simple.Node(test.from), simple.Node(test.to))
if got != test.want {
t.Errorf("unexpected result for path existance in test %d: got:%t want %t", i, got, test.want)
t.Errorf("unexpected result for path existence in test %d: got:%t want %t", i, got, test.want)
}
}
}

View File

@@ -583,7 +583,7 @@ func constructQK(kind string, m, n, k int, a []float64, lda int, tau []float64)
}
blas64.Ger(-tau[i], vVec, vVec, h)
copy(qCopy.Data, q.Data)
// Mulitply q by the new h
// Multiply q by the new h.
switch kind {
case "QR", "RQ":
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, qCopy, h, 0, q)
@@ -608,7 +608,7 @@ func checkBidiagonal(t *testing.T, m, n, nb int, a []float64, lda int, d, e, tau
qMat := constructQPBidiagonal(lapack.ApplyQ, m, n, nb, a, lda, tauQ)
pMat := constructQPBidiagonal(lapack.ApplyP, m, n, nb, a, lda, tauP)
// Compute Q^T * A * P
// Compute Q^T * A * P.
aMat := blas64.General{
Rows: m,
Cols: n,

View File

@@ -287,7 +287,7 @@ func (s *SymDense) InverseCholesky(chol *Cholesky) error {
}
// SymRankOne performs a rank-1 update of the original matrix A and refactorizes
// its Cholesky factorization, storing the result into the reciever. That is, if
// its Cholesky factorization, storing the result into the receiver. That is, if
// in the original Cholesky factorization
// U^T * U = A,
// in the updated factorization

View File

@@ -46,7 +46,7 @@ func gammaIncInv(a, y float64) float64 {
// Also, after we generate a small interval by bisection above, false
// position will do a large step from an interval of width ~1e-4 to ~1e-14
// in one step (a=10, x=0.05, but similiar for other values).
// in one step (a=10, x=0.05, but similar for other values).
result, bestX, _, errEst := falsePosition(lo, hi, flo, fhi, 2*machEp, 2*machEp, 1e-2*a, gammaInc, params)
if result == fSolveMaxIterations && errEst > allowedATol+allowedRTol*math.Abs(bestX) {
bestX = math.NaN()

View File

@@ -235,7 +235,7 @@ func Zairy(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
}
AA = AZ * AZ
if AA < TOL/AZ {
goto Fourty
goto Forty
}
TRM1R = CONER
TRM1I = CONEI
@@ -272,12 +272,12 @@ func Zairy(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
D2 = D2 + BK
AD = math.Min(D1, D2)
if ATRM < TOL*AD {
goto Fourty
goto Forty
}
AK = AK + 18.0E0
BK = BK + 18.0E0
}
Fourty:
Forty:
if ID == 1 {
goto Fifty
}
@@ -539,7 +539,7 @@ func Zbknu(ZR, ZI, FNU float64, KODE, N int, YR, YI []float64, NZ int, TOL, ELIM
* CYI(2)
*/
// TOOD(btracey): Find which of these are inputs/outputs/both and clean up
// TODO(btracey): Find which of these are inputs/outputs/both and clean up
// the function call.
// YR and YI have length n (but n+1 with better indexing)
var AA, AK, ASCLE, A1, A2, BB, BK, CAZ,
@@ -641,7 +641,7 @@ Ten:
T2 = math.Exp(-dgamln(A2, IDUM))
T1 = 1.0E0 / (T2 * FC)
if math.Abs(DNU) > 0.1E0 {
goto Fourty
goto Forty
}
// SERIES FOR F0 TO RESOLVE INDETERMINACY FOR SMALL ABS(DNU).
@@ -658,7 +658,7 @@ Ten:
Thirty:
G1 = -S
goto Fifty
Fourty:
Forty:
G1 = (T1 - T2) / (DNU + DNU)
Fifty:
G2 = (T1 + T2) * 0.5E0
@@ -1352,7 +1352,7 @@ Twenty:
YI[I] = CSI
NZ = NZ - 1
if IC == KK-1 {
goto Fourty
goto Forty
}
IC = KK
continue
@@ -1371,7 +1371,7 @@ Twenty:
NZ = N - 1
}
goto FourtyFive
Fourty:
Forty:
NZ = KK - 2
FourtyFive:
for I = 1; I <= NZ; I++ {
@@ -1452,7 +1452,7 @@ Ten:
YR[i] = real(v)
YI[i] = imag(v)
}
goto Fourty
goto Forty
Twenty:
if AZ < RL {
goto Thirty
@@ -1462,14 +1462,14 @@ Twenty:
if NW < 0 {
goto Eighty
}
goto Fourty
goto Forty
Thirty:
// MILLER ALGORITHM NORMALIZED BY THE SERIES FOR THE I FUNCTION
ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL = Zmlri(ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL)
if NW < 0 {
goto Eighty
}
Fourty:
Forty:
// ANALYTIC CONTINUATION TO THE LEFT HALF PLANE FOR THE K FUNCTION.
ZNR, ZNI, FNU, KODE, _, CYR, CYI, NW, TOL, ELIM, ALIM = Zbknu(ZNR, ZNI, FNU, KODE, 1, CYR, CYI, NW, TOL, ELIM, ALIM)
if NW != 0 {
@@ -1796,7 +1796,7 @@ Twenty:
I = I + 1
K = 0
if INU < IAZ {
goto Fourty
goto Forty
}
// COMPUTE RELATIVE TRUNCATION ERROR FOR RATIOS.
P1R = ZEROR
@@ -1825,7 +1825,7 @@ Twenty:
continue
}
if ITIME == 2 {
goto Fourty
goto Forty
}
ACK = cmplx.Abs(complex(CKR, CKI))
FLAM = ACK + math.Sqrt(ACK*ACK-1.0E0)
@@ -1835,7 +1835,7 @@ Twenty:
ITIME = 2
}
goto OneTen
Fourty:
Forty:
// BACKWARD RECURRENCE AND SUM NORMALIZING RELATION.
K = K + 1
KK = max(I+IAZ, K+INU)
@@ -1957,7 +1957,7 @@ OneTen:
// condition |z| <= 2*sqrt(fnu+1) was violated and the computation must be
// completed in another routine with n -= abs(nz).
func Zseri(z complex128, fnu float64, kode, n int, y []complex128, tol, elim, alim float64) (nz int) {
// TOOD(btracey): The original fortran line is "ARM = 1.0D+3*D1MACH(1)". Evidently, in Fortran
// TODO(btracey): The original fortran line is "ARM = 1.0D+3*D1MACH(1)". Evidently, in Fortran
// this is interpreted as one to the power of +3*D1MACH(1). While it is possible
// this was intentional, it seems unlikely.
arm := 1000 * dmach[1]

View File

@@ -226,7 +226,7 @@ func zairyOrig(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
}
AA = AZ * AZ
if AA < TOL/AZ {
goto Fourty
goto Forty
}
TRM1R = CONER
TRM1I = CONEI
@@ -263,12 +263,12 @@ func zairyOrig(ZR, ZI float64, ID, KODE int) (AIR, AII float64, NZ int) {
D2 = D2 + BK
AD = dmin(D1, D2)
if ATRM < TOL*AD {
goto Fourty
goto Forty
}
AK = AK + 18.0E0
BK = BK + 18.0E0
}
Fourty:
Forty:
if ID == 1 {
goto Fifty
}
@@ -530,7 +530,7 @@ func zbknuOrig(ZR, ZI, FNU float64, KODE, N int, YR, YI []float64, NZ int, TOL,
* CYI(2)
*/
// TOOD(btracey): Find which of these are inputs/outputs/both and clean up
// TODO(btracey): Find which of these are inputs/outputs/both and clean up
// the function call.
// YR and YI have length n (but n+1 with better indexing)
var AA, AK, ASCLE, A1, A2, BB, BK, CAZ,
@@ -623,7 +623,7 @@ Ten:
T2 = dexp(-dgamln(A2, IDUM))
T1 = 1.0E0 / (T2 * FC)
if dabs(DNU) > 0.1E0 {
goto Fourty
goto Forty
}
// SERIES FOR F0 TO RESOLVE INDETERMINACY FOR SMALL ABS(DNU).
@@ -640,7 +640,7 @@ Ten:
Thirty:
G1 = -S
goto Fifty
Fourty:
Forty:
G1 = (T1 - T2) / (DNU + DNU)
Fifty:
G2 = (T1 + T2) * 0.5E0
@@ -1325,7 +1325,7 @@ Twenty:
YI[I] = CSI
NZ = NZ - 1
if IC == KK-1 {
goto Fourty
goto Forty
}
IC = KK
continue
@@ -1344,7 +1344,7 @@ Twenty:
NZ = N - 1
}
goto FourtyFive
Fourty:
Forty:
NZ = KK - 2
FourtyFive:
for I = 1; I <= NZ; I++ {
@@ -1413,7 +1413,7 @@ func zacaiOrig(ZR, ZI, FNU float64, KODE, MR, N int, YR, YI []float64, NZ int, R
Ten:
// POWER SERIES FOR THE I FUNCTION.
ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL, ELIM, ALIM = zseriOrig(ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL, ELIM, ALIM)
goto Fourty
goto Forty
Twenty:
if AZ < RL {
goto Thirty
@@ -1423,14 +1423,14 @@ Twenty:
if NW < 0 {
goto Eighty
}
goto Fourty
goto Forty
Thirty:
// MILLER ALGORITHM NORMALIZED BY THE SERIES FOR THE I FUNCTION
ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL = zmlriOrig(ZNR, ZNI, FNU, KODE, NN, YR, YI, NW, TOL)
if NW < 0 {
goto Eighty
}
Fourty:
Forty:
// ANALYTIC CONTINUATION TO THE LEFT HALF PLANE FOR THE K FUNCTION.
ZNR, ZNI, FNU, KODE, _, CYR, CYI, NW, TOL, ELIM, ALIM = zbknuOrig(ZNR, ZNI, FNU, KODE, 1, CYR, CYI, NW, TOL, ELIM, ALIM)
if NW != 0 {
@@ -1746,7 +1746,7 @@ Twenty:
I = I + 1
K = 0
if INU < IAZ {
goto Fourty
goto Forty
}
// COMPUTE RELATIVE TRUNCATION ERROR FOR RATIOS.
P1R = ZEROR
@@ -1775,7 +1775,7 @@ Twenty:
continue
}
if ITIME == 2 {
goto Fourty
goto Forty
}
ACK = zabs(complex(CKR, CKI))
FLAM = ACK + dsqrt(ACK*ACK-1.0E0)
@@ -1785,7 +1785,7 @@ Twenty:
ITIME = 2
}
goto OneTen
Fourty:
Forty:
// BACKWARD RECURRENCE AND SUM NORMALIZING RELATION.
K = K + 1
KK = max0(I+IAZ, K+INU)
@@ -1964,7 +1964,7 @@ Twenty:
AK1R = AK1R - ZR
}
if AK1R > (-ELIM) {
goto Fourty
goto Forty
}
Thirty:
NZ = NZ + 1
@@ -1978,7 +1978,7 @@ Thirty:
return ZR, ZI, FNU, KODE, N, YR, YI, NZ, TOL, ELIM, ALIM
}
goto Twenty
Fourty:
Forty:
if AK1R > (-ALIM) {
goto Fifty
}

View File

@@ -46,7 +46,7 @@ const (
// errEst: error estimation
func falsePosition(x1, x2, f1, f2, absErr, relErr, bisectTil float64, f objectiveFunc, fExtra []float64) (fSolveResult, float64, float64, float64) {
// The false position steps are either unmodified, or modified with the
// Anderson-Bjorck method as appropiate. Theoretically, this has a "speed of
// Anderson-Bjorck method as appropriate. Theoretically, this has a "speed of
// convergence" of 1.7 (bisection is 1, Newton is 2).
// Note that this routine was designed initially to work with gammaincinv, so
// it may not be tuned right for other problems. Don't use it blindly.

View File

@@ -141,7 +141,7 @@ func simplex(initialBasic []int, c []float64, A mat.Matrix, b []float64, tol flo
basicIdxs = make([]int, len(initialBasic))
copy(basicIdxs, initialBasic)
} else {
// No inital basis supplied. Solve the PhaseI problem.
// No initial basis supplied. Solve the PhaseI problem.
basicIdxs, ab, xb, err = findInitialBasic(A, b)
if err != nil {
return math.NaN(), nil, nil, err

View File

@@ -24,7 +24,7 @@ type GlobalMethod interface {
Done()
}
// Global uses a global optimizer to search for the gloabl minimum of a
// Global uses a global optimizer to search for the global minimum of a
// function. A maximization problem can be transformed into a
// minimization problem by multiplying the function by -1.
//

View File

@@ -70,7 +70,7 @@ type Statuser interface {
// dir_k starting at the most recent location x_k, i.e., it tries to minimize
// the function
// φ(step) := f(x_k + step * dir_k) where step > 0.
// Typically, a Linesearcher will be used in conjuction with LinesearchMethod
// Typically, a Linesearcher will be used in conjunction with LinesearchMethod
// for performing gradient-based optimization through sequential line searches.
type Linesearcher interface {
// Init initializes the Linesearcher and a new line search. Value and
@@ -100,7 +100,7 @@ type Linesearcher interface {
// NextDirectioner implements a strategy for computing a new line search
// direction at each major iteration. Typically, a NextDirectioner will be
// used in conjuction with LinesearchMethod for performing gradient-based
// used in conjunction with LinesearchMethod for performing gradient-based
// optimization through sequential line searches.
type NextDirectioner interface {
// InitDirection initializes the NextDirectioner at the given starting location,

View File

@@ -184,7 +184,7 @@ type Settings struct {
//
// If f < f_best and
// f_best - f > FunctionConverge.Relative * maxabs(f, f_best) + FunctionConverge.Absolute
// then a significant decrease has occured, and f_best is updated.
// then a significant decrease has occurred, and f_best is updated.
//
// If there is no significant decrease for FunctionConverge.Iterations
// major iterations, FunctionConvergence status is returned.

View File

@@ -9,7 +9,7 @@ import (
"math/rand"
)
// Categorical is an extension of the Bernouilli distribution where x takes
// Categorical is an extension of the Bernoulli distribution where x takes
// values {0, 1, ..., len(w)-1} where w is the weight vector. Categorical must
// be initialized with NewCategorical.
type Categorical struct {

View File

@@ -23,7 +23,7 @@ type MHProposal interface {
ConditionalLogProb(x, y []float64) (prob float64)
// ConditionalRand generates a new random location conditioned being at the
// location y. If the first arguement is nil, a new slice is allocated and
// location y. If the first argument is nil, a new slice is allocated and
// returned. Otherwise, the random location is stored in-place into the first
// argument, and ConditionalRand will panic if the input slice lengths differ.
ConditionalRand(x, y []float64) []float64
@@ -114,7 +114,7 @@ func (m MetropolisHastingser) Sample(batch *mat.Dense) {
// MetropolisHastings generates rows(batch) samples using the Metropolis Hastings
// algorithm (http://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm),
// with the given target and proposal distributions, starting at the intial location
// with the given target and proposal distributions, starting at the initial location
// and storing the results in-place into samples. If src != nil, it will be used to generate random
// numbers, otherwise rand.Float64 will be used.
//
@@ -204,7 +204,7 @@ func (p *ProposalNormal) ConditionalLogProb(x, y []float64) (prob float64) {
}
// ConditionalRand generates a new random location conditioned being at the
// location y. If the first arguement is nil, a new slice is allocated and
// location y. If the first argument is nil, a new slice is allocated and
// returned. Otherwise, the random location is stored in-place into the first
// argument, and ConditionalRand will panic if the input slice lengths differ or
// if they are not equal to the dimension of the covariance matrix.

View File

@@ -333,7 +333,7 @@ func (m MetropolisHastingser) Sample(batch []float64) {
// MetropolisHastings generates len(batch) samples using the Metropolis Hastings
// algorithm (http://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm),
// with the given target and proposal distributions, starting at the intial location
// with the given target and proposal distributions, starting at the initial location
// and storing the results in-place into samples. If src != nil, it will be used to generate random
// numbers, otherwise rand.Float64 will be used.
//

View File

@@ -138,7 +138,7 @@ var (
// Dimensions represent the dimensionality of the unit in powers
// of that dimension. If a key is not present, the power of that
// dimension is zero. Dimensions is used in conjuction with New.
// dimension is zero. Dimensions is used in conjunction with New.
type Dimensions map[Dimension]int
func (d Dimensions) String() string {
@@ -253,7 +253,7 @@ func DimensionsMatch(a, b Uniter) bool {
return true
}
// Add adds the function argument to the reciever. Panics if the units of
// Add adds the function argument to the receiver. Panics if the units of
// the receiver and the argument don't match.
func (u *Unit) Add(uniter Uniter) *Unit {
a := uniter.Unit()