-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
52 lines (42 loc) · 1.22 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2023 The Markov Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"math"
"math/rand"
"gonum.org/v1/plot"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
"gonum.org/v1/plot/vg/draw"
)
// State is a state
type State [5]uint8
// https://sci.esa.int/web/xmm-newton/-/61070-investigating-the-expansion-of-the-universe-combining-type-ia-supernovas-and-quasars
func main() {
var state State
rnd, states, points := rand.New(rand.NewSource(1)), make(map[State]bool), make(plotter.XYs, 0, 8)
for i := 0; i < 8*1024*1024; i++ {
for i := 1; i < len(state); i++ {
state[i] = state[i-1]
}
state[0] = uint8(math.Abs(rnd.NormFloat64() * 64))
states[state] = true
points = append(points, plotter.XY{X: float64(i), Y: float64(len(states))})
}
p := plot.New()
p.Title.Text = "epochs vs size"
p.X.Label.Text = "epochs"
p.Y.Label.Text = "size"
scatter, err := plotter.NewScatter(points)
if err != nil {
panic(err)
}
scatter.GlyphStyle.Radius = vg.Length(1)
scatter.GlyphStyle.Shape = draw.CircleGlyph{}
p.Add(scatter)
err = p.Save(8*vg.Inch, 8*vg.Inch, "markov.png")
if err != nil {
panic(err)
}
}