Skip to content
Snippets Groups Projects
Commit ad94adc5 authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

Unused variables found by golangci-lint.

parent 20d8b583
No related branches found
No related tags found
No related merge requests found
...@@ -10,15 +10,12 @@ import ( ...@@ -10,15 +10,12 @@ import (
"os" "os"
) )
const ndimDflt = 2
type mcPrm struct { type mcPrm struct {
iniTmp, fnlTmp float32 // Initial and final temperatures iniTmp, fnlTmp float32 // Initial and final temperatures
xIni []float32 // initial x slice xIni []float32 // initial x slice
xDlta float32 // change x by up to +- xDlta in trial moves xDlta float32 // change x by up to +- xDlta in trial moves
nStep uint32 // number of steps nStep uint32 // number of steps
nRun uint32 // number of separate runs nRun uint32 // number of separate runs
nOutput uint32 // write at least this many lines of output
fOutName string // where we write output to fOutName string // where we write output to
fPltName string // where we plot to (function values) fPltName string // where we plot to (function values)
xPltName string // where we plot x trajectories to xPltName string // where we plot x trajectories to
......
...@@ -60,7 +60,7 @@ func isNotSane (mcPrm *mcPrm) error { ...@@ -60,7 +60,7 @@ func isNotSane (mcPrm *mcPrm) error {
func setupRun(mcPrm *mcPrm, cprm *cprm) error { func setupRun(mcPrm *mcPrm, cprm *cprm) error {
const finalTempErr = "Final temp %g higher than initial temp %g" const finalTempErr = "Final temp %g higher than initial temp %g"
var err error var err error
if mcPrm.dummy == true { if mcPrm.dummy {
return nil return nil
} }
cprm.rand = rand.New(rand.NewSource(getSeed())) cprm.rand = rand.New(rand.NewSource(getSeed()))
...@@ -118,14 +118,14 @@ func setupRun(mcPrm *mcPrm, cprm *cprm) error { ...@@ -118,14 +118,14 @@ func setupRun(mcPrm *mcPrm, cprm *cprm) error {
// newx gets a candidate x slice. We have n dimensions, so a candidate // newx gets a candidate x slice. We have n dimensions, so a candidate
// move is a slice of length n. // move is a slice of length n.
func nnewx(xold []float32, xT []float32, rand *rand.Rand, xDlta float32) { /*
func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float32) {
for i, x := range xold { for i, x := range xold {
t := 2.*rand.Float32() - 1 t := 2.*rand.Float32() - 1
t *= xDlta t *= xDlta
xT[i] = x + t xT[i] = x + t
} }
} } */
// newx will move just one coordinate at a time // newx will move just one coordinate at a time
func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float32) { func newx(xold []float32, xT []float32, rand *rand.Rand, xDlta float32) {
var iDim int var iDim int
...@@ -228,7 +228,7 @@ func doRun(mcPrm *mcPrm) error { ...@@ -228,7 +228,7 @@ func doRun(mcPrm *mcPrm) error {
accept = true accept = true
} }
} }
if accept == true { if accept {
nAcc++ nAcc++
runAcc = runMult*runAcc + (1.0 - runMult) runAcc = runMult*runAcc + (1.0 - runMult)
copy(x, xT) copy(x, xT)
......
...@@ -23,7 +23,7 @@ import ( ...@@ -23,7 +23,7 @@ import (
) )
// maketicks gives reasonable default tick locations // maketicks gives reasonable default tick locations
func maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick { func maketicks(axisDscrpt axticks.AxisDscrpt) []chart.Tick {
xmin, xmax, delta, prcsn := axisDscrpt.Xmin, axisDscrpt.Xmax, axisDscrpt.Delta, axisDscrpt.Prcsn xmin, xmax, delta, prcsn := axisDscrpt.Xmin, axisDscrpt.Xmax, axisDscrpt.Delta, axisDscrpt.Prcsn
rnge := axisDscrpt.Xmax - axisDscrpt.Xmin rnge := axisDscrpt.Xmax - axisDscrpt.Xmin
ntick := int(math.Round((rnge / delta) + 1)) ntick := int(math.Round((rnge / delta) + 1))
...@@ -41,7 +41,7 @@ func maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick { ...@@ -41,7 +41,7 @@ func maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick {
return t return t
} }
// maketicks this version works, but usually leaves you wanting one tick more. // maketicks this version works, but usually leaves you wanting one tick more.
func alt_maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick { /*func alt_maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick {
xmin, xmax, delta, prcsn := axisDscrpt.Xmin, axisDscrpt.Xmax, axisDscrpt.Delta, axisDscrpt.Prcsn xmin, xmax, delta, prcsn := axisDscrpt.Xmin, axisDscrpt.Xmax, axisDscrpt.Delta, axisDscrpt.Prcsn
var t []chart.Tick var t []chart.Tick
const fstr = "%.*f" const fstr = "%.*f"
...@@ -50,11 +50,11 @@ func alt_maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick { ...@@ -50,11 +50,11 @@ func alt_maketicks(axisDscrpt axticks.AxisDscrpt, prcsn int) []chart.Tick {
fmt.Println (axisDscrpt) fmt.Println (axisDscrpt)
} }
for ; xv <= xmax; xv, xl = xv+delta, fmt.Sprintf("%.*f", prcsn, xv) { for ; xv <= xmax; xv, xl = xv+delta, fmt.Sprintf("%.*f", prcsn, xv) {
t = append(t, chart.Tick {xv, xl}) t = append(t, chart.Tick {Value: xv, Label: xl})
} }
return t return t
} }*/
// range2 just lets us append methods to a range/continuousrange structure // range2 just lets us append methods to a range/continuousrange structure
type range2 struct { type range2 struct {
...@@ -73,7 +73,7 @@ func (rng *range2) GetTicks(r chart.Renderer, cs chart.Style, vf chart.ValueForm ...@@ -73,7 +73,7 @@ func (rng *range2) GetTicks(r chart.Renderer, cs chart.Style, vf chart.ValueForm
} else { } else {
rng.Min = a.Xmin rng.Min = a.Xmin
rng.Max = a.Xmax rng.Max = a.Xmax
return maketicks(a, a.Prcsn) return maketicks(a)
} }
} }
......
...@@ -15,7 +15,6 @@ import ( ...@@ -15,7 +15,6 @@ import (
"strings" "strings"
) )
var i int = 6
var cmdDflt = []struct { var cmdDflt = []struct {
key string key string
v string v string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment