Documentation
¶
Index ¶
- Constants
- func CreateDefaultFile() error
- func PseudoMain()
- type BaseData
- func (data *BaseData) Calculate(layout map[rune]int) float64
- func (data *BaseData) Calculate2(layout map[rune]int) float64
- func (data *BaseData) Calculate3(layout map[rune]int) float64
- func (data *BaseData) ConvertAllowed() map[rune][]int
- func (data *BaseData) GeneratePermutations(accumulated map[rune]int, subTask *perm.SubTask, ...)
- func (data *BaseData) GetNextKey(acc map[rune]int) (int, error)
- func (data *BaseData) Get_next_key(acc map[rune]int) (int, error)
- func (data *BaseData) Get_next_key2(acc map[int]rune) (int, error)
- func (data *BaseData) Get_remaining(acc map[rune]int) []int
- func (data *BaseData) Get_remaining2(acc map[int]rune) []int
- func (data *BaseData) Letter_key_diff() int
- func (data *BaseData) MakeBigramMatrix() *mat.Dense
- func (data *BaseData) MakeBigramRunes() map[rune]map[rune]float64
- func (data *BaseData) MakeScoreMatrix(layout map[rune]int) *mat.Dense
- func (data *BaseData) MakeSortedLetters() map[rune]int
- func (data *BaseData) ResultHandler(subRes *perm.SubResult, results chan map[rune]int)
- type ClientConfig
- type ForcedShutdown
- type Server
- type Tasks
- type TasksState
- func (state *TasksState) FinishTask()
- func (state *TasksState) IsActive() bool
- func (state *TasksState) IsEmpty() bool
- func (state *TasksState) IsPaused() bool
- func (t *TasksState) NewResults(task perm.Task)
- func (state *TasksState) NewTask(chunk []int)
- func (state *TasksState) Pause()
- func (t *TasksState) Rate() float64
- func (state *TasksState) RecordTimestamp(timestamp int64) int64
- func (state *TasksState) Resume()
- func (state *TasksState) ResumeTasks()
- func (state *TasksState) Saturated() bool
- func (state *TasksState) SetLimit(limit int)
- func (state *TasksState) StartTask()
- type UIModel
Constants ¶
const ClientConfigFile = "client.cfg"
Variables ¶
This section is empty.
Functions ¶
func CreateDefaultFile ¶
func CreateDefaultFile() error
func PseudoMain ¶
func PseudoMain()
Types ¶
type BaseData ¶
type BaseData struct {
Allowed map[int][]rune // which letters are allowed in which key position
Allowed2 map[rune][]int // which letters are allowed in which key position
Bigrams map[string]float64 // occurrence of a bigram per 1M words
Scores map[int]map[int]float64 // score of a bigram
Letter_freq map[string]int // occurrence of a letter per 1M words
Letters []rune // order of most common letter
Keys []int // order of most valuable position
Key_diff int // difference between number of positions and letters
MaxLetters int // the number of letters for a layout
BigramMatrix *mat.Dense // occurrence of a bigram, but as matrix
LetterOrder map[rune]int // arbitrary but given order of the letters
BigramRunes map[rune]map[rune]float64
}
func ConvertLetterData ¶
func ConvertLetterData(msg perm.LetterMessage) *BaseData
func (*BaseData) Calculate ¶
Scores is already a big matrix. place bigram freqs in a corresponding matrix. a single matrix multiplication computes the sum then dot product then sum the resulting matrix faster than Calculate2
func (*BaseData) Calculate2 ¶
check if this actually calculates the correct results. or if the other one is bad about 20k for this vs 6M for the other slowest currently. maybe inefficient handling of matrix objects.
func (*BaseData) Calculate3 ¶
fastest yet, slightly faster than Calculate()
func (*BaseData) ConvertAllowed ¶
func (*BaseData) GeneratePermutations ¶
func (data *BaseData) GeneratePermutations( accumulated map[rune]int, subTask *perm.SubTask, calcFunc func(map[rune]int) float64)
Generates layout permutations don't run the channel that receives the permutations simultaneously won't be single core otherwise
func (*BaseData) Get_next_key ¶
part of this can be done before permutations lol not working
func (*BaseData) Letter_key_diff ¶
discrepancy between number of letters and key positions
func (*BaseData) MakeBigramMatrix ¶
func (*BaseData) MakeBigramRunes ¶
func (*BaseData) MakeScoreMatrix ¶
func (*BaseData) MakeSortedLetters ¶
type ClientConfig ¶
type ClientConfig struct {
ClientID string `ini:"client_id"`
Address string `ini:"address"`
Port int `ini:"port"`
Threads int `ini:"threads"`
}
func ParseConfig ¶
func ParseConfig() (ClientConfig, error)
func (*ClientConfig) FullAddress ¶
func (conf *ClientConfig) FullAddress() string
func (*ClientConfig) HelloMessage ¶
func (conf *ClientConfig) HelloMessage() perm.HelloMessage
func (*ClientConfig) SetDefaultClientID ¶
func (conf *ClientConfig) SetDefaultClientID()
type ForcedShutdown ¶
type ForcedShutdown bool
type Server ¶
type Server *sock.HostConnection
type Tasks ¶
type Tasks *TasksState
type TasksState ¶
type TasksState struct {
sync.RWMutex
TaskLimit int // maximum amount of tasks that can be active
PrevLimit int
ActiveTasks int // current active tasks
TaskFinished chan bool // notify every time task counter or limit changes
NewLimit chan bool
TaskSize []int
Timestamp int64 // when most recent task finished
CompletedTasks int
Computations int
RecentResults []perm.Task
ZeroTasks int
// contains filtered or unexported fields
}
func (*TasksState) FinishTask ¶
func (state *TasksState) FinishTask()
func (*TasksState) IsActive ¶
func (state *TasksState) IsActive() bool
func (*TasksState) IsEmpty ¶
func (state *TasksState) IsEmpty() bool
func (*TasksState) IsPaused ¶
func (state *TasksState) IsPaused() bool
func (*TasksState) NewResults ¶
func (t *TasksState) NewResults(task perm.Task)
func (*TasksState) NewTask ¶
func (state *TasksState) NewTask(chunk []int)
func (*TasksState) Pause ¶
func (state *TasksState) Pause()
func (*TasksState) Rate ¶
func (t *TasksState) Rate() float64
func (*TasksState) RecordTimestamp ¶
func (state *TasksState) RecordTimestamp(timestamp int64) int64
func (*TasksState) Resume ¶
func (state *TasksState) Resume()
func (*TasksState) ResumeTasks ¶
func (state *TasksState) ResumeTasks()
func (*TasksState) Saturated ¶
func (state *TasksState) Saturated() bool
func (*TasksState) SetLimit ¶
func (state *TasksState) SetLimit(limit int)
func (*TasksState) StartTask ¶
func (state *TasksState) StartTask()
type UIModel ¶
type UIModel struct {
Connection *sock.GlobalConnection
Counter int
Stats perm.StatsTables
Server *sock.HostConnection
TasksState *TasksState
HostChan chan sock.HostConnection
TextInput textinput.Model
// contains filtered or unexported fields
}
func CreateModel ¶
func CreateModel( gc *sock.GlobalConnection, hostChan chan sock.HostConnection) UIModel