| 12345678910111213141516171819202122232425262728293031 |
- import { singleVarfunctions } from '~/components/playground/gradient-descent/functions'
- export const state = () => ({
- isPlaying: false,
- currentFunction: Object.keys(singleVarfunctions)[0],
- learningRate: 0.01,
- choosingPoint: true
- })
- type RootState = ReturnType<typeof state>
- export const mutations = {
- setIsPlaying(state: RootState, isPlaying: boolean) {
- state.isPlaying = isPlaying
- },
- setCurrentFunction(state: RootState, value: string) {
- state.currentFunction = value
- },
- setLearningRate(state: RootState, value: number) {
- state.learningRate = value
- },
- setChoosingPoint(state: RootState, value: boolean) {
- state.choosingPoint = value
- }
- }
- export const getters = {
- getCurrentFunction(state: RootState) {
- return singleVarfunctions[state.currentFunction]
- }
- }
|