Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ackley_mc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Torda, Prof. Dr. Andrew Ernest
ackley_mc
Commits
ad94adc5
Commit
ad94adc5
authored
3 years ago
by
Andrew E. Torda
Browse files
Options
Downloads
Patches
Plain Diff
Unused variables found by golangci-lint.
parent
20d8b583
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ackwork/ackwork.go
+0
-3
0 additions, 3 deletions
ackwork/ackwork.go
ackwork/dorun.go
+5
-5
5 additions, 5 deletions
ackwork/dorun.go
ackwork/plot.go
+5
-5
5 additions, 5 deletions
ackwork/plot.go
ackwork/rdprm.go
+0
-1
0 additions, 1 deletion
ackwork/rdprm.go
with
10 additions
and
14 deletions
ackwork/ackwork.go
+
0
−
3
View file @
ad94adc5
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
ackwork/dorun.go
+
5
−
5
View file @
ad94adc5
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
ackwork/plot.go
+
5
−
5
View file @
ad94adc5
...
@@ -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
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
ackwork/rdprm.go
+
0
−
1
View file @
ad94adc5
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment