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

Tidying.

parent 7e04a1f4
Branches
No related tags found
No related merge requests found
// Put ackley in here, so we can also write a little test // Put ackley in here, so we can also write a little test, separate from
// We will code it in the n-dimensional version, even if we do not need it. // the Monte Carlo code.
// Hard-coding 2, 3 or 4 dimensions would be faster (no for loop), but not so elegant.
package ackley package ackley
...@@ -14,8 +13,8 @@ const ( ...@@ -14,8 +13,8 @@ const (
c = 2 * math.Pi c = 2 * math.Pi
) )
// ackley calculates the n-dimensional ackley function for a slice x. The constants // ackley calculates the n-dimensional ackley function for a slice x.
// are hard-coded above. //The constants are hard-coded above.
func Ackley(x []float32) float64 { func Ackley(x []float32) float64 {
var sum1, sum2 float64 var sum1, sum2 float64
for i := range x { for i := range x {
......
the ackley function .. in the word file
Run dlv in emacs under windows Run dlv in emacs under windows
dlv --allow-non-terminal-interactive=true debug dlv --allow-non-terminal-interactive=true debug
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment