Documentation
¶
Index ¶
- Constants
- Variables
- func Dur(x Date, y Date) int
- func ErrPos(s string, pos int) string
- func FieldsToCsvString[T any](a T, suffix string) string
- func FilePathToName(str string) (string, error)
- func FindFieldByName[T any](s T, fieldName string) (reflect.Value, bool)
- func FindFile(tbl string) (fileLoc string)
- func FindMp(fileName string) (fileLoc string)
- func GetEnumName(enm string) string
- func GetFileList(root string, suffix string) (paths []string, err error)
- func GetFileName(s string) string
- func GetFilePath(fileName string, paths []string) (fileLoc string)
- func GetMongoClient(ctx context.Context) *qmgo.Client
- func GetRedisClient() *redis.Client
- func InitializePath(path string)
- func IntToClmTitle(n int) string
- func IsDir(path string) bool
- func IsFac(filePath string) bool
- func LoadCsv[T any](fileName string, row T) []*T
- func LoadFacHashToFastCache0814(filePath string, maxBytes int) ([]string, *fastcache.Cache)
- func LoadFacHashToFastCacheBk(filePath string, maxBytes int) *fastcache.Cache
- func LoadFacToFastCache(filePath string, maxBytes int) *fastcache.Cache
- func LoadFacToHashMap(filePath string) map[string]map[string]string
- func LoadFacToMap(filePath string) map[string]string
- func LoadFacToRedisHash(filePath string)
- func LoadFileToStruct[T any](fileName string, skipLines int, dataStruct T) []*T
- func LoadPropMpToChn[T any](fileName string, dataStruct T, dataChn chan *T)
- func LoadPropMpToStruct[T any](fileName string, dataStruct T) []*T
- func MapContainsValue[K, V comparable](m map[K]V, value V) bool
- func MapUniqValues[T comparable](m map[string]T) []T
- func MergeStringSlices(slices ...[]string) []string
- func ParseCsvMap(filename string) (map[string][]string, error)
- func PivotFloat64(data any, tags []string, fieldsToSum []string) map[string]map[string]float64
- func ReadConfig(c *viper.Viper)
- func ReadProdSpecs(filePath string) ([]string, map[string][]string)
- func RecordToCsvString[T any](record T, suffix string) string
- func RemoveDup(this []*float64) []*float64
- func ReplaceWholeWord(originalString string, oldWord string, newWord string) string
- func SCA(A [][]float64, b []float64, δ float64) (x []float64, i int, err error)
- func SCAKKT(A [][]float64, b []float64, ε float64) ([]float64, int, error)
- func SCALimit(A [][]float64, b []float64, limit int) ([]float64, int, error)
- func SetLogOutput()
- func StreamGenericCsvFile[T any](filePath string, row T, dataChn chan *T)
- func StreamGenericTxtFile[T any](filePath string, headerLine int, row T, dataChn chan *T)
- func StringExists(s []string, t string) bool
- func WriteCsv(start, end Date, res ProjResult)
- type Date
- type Enum
- type Parser
- type ProjResult
- type TblCache
- type Token
Constants ¶
const ( Identifier = iota // e.g. 50 Literal // e.g. + - * / Operator // , COMMA )
Variables ¶
var Conf *viper.Viper
var Ctx = context.Background()
var EnumLocs []string
var Enums []string
var Limit int = 1e7
Limit is an absolute limit on number of iterations.
var MpLocs []string
var Mps []string
var Rdb *redis.Client
var TableLocs []string
var Tables []string
Functions ¶
func FieldsToCsvString ¶
func FilePathToName ¶
func GetEnumName ¶
func GetFileName ¶
func GetFilePath ¶
func GetRedisClient ¶
func GetRedisClient() *redis.Client
func InitializePath ¶
func InitializePath(path string)
func IntToClmTitle ¶
1 -> A, 2 -> B, 3 -> C, ..., 26 -> Z, 27 -> AA, 28 -> AB, ...
func LoadFacToMap ¶
func LoadFacToRedisHash ¶
func LoadFacToRedisHash(filePath string)
func LoadFileToStruct ¶
func LoadPropMpToChn ¶
func LoadPropMpToStruct ¶
func MapContainsValue ¶
func MapContainsValue[K, V comparable](m map[K]V, value V) bool
func MapUniqValues ¶
func MapUniqValues[T comparable](m map[string]T) []T
func MergeStringSlices ¶
func PivotFloat64 ¶
func ReadConfig ¶
func RecordToCsvString ¶
func ReplaceWholeWord ¶
func SCA ¶
SCA solves the non-negative least squares problem.
Argument A represents a design or input matrix. Each element of A must have the same length. b represents a measurement or output vector. δ is a tolerance for the result.
Iteration will stop when the least squares objective is within δ of an optimal solution.
The result x returns coefficients of the fitted linear function, it will have the same length as elements of A. Result i is the number of iterations performed. An error is returned if A and b are not the same length.
func SCAKKT ¶
SCAKKT solves the non-negative least squares problem.
Argument A represents a design or input matrix. Each element of A must have the same length. b represents a measurement or output vector. ε is a tolerance for stopping iteration.
Stopping criteria for this function are based on Karush–Kuhn–Tucker conditions (see https://en.wikipedia.org/wiki/Karush%E2%80%93Kuhn%E2%80%93Tucker_conditions). Iteration stops when a result is non-negative and the gradient of the objective function is within ε of KKT conditions. The advantage of this function over SCA is that stopping conditions are simpler to compute and so each iteration takes less time. The disadvantage is that the ε of this function is less obviously related to the objective function and stopping criteria are less clear.
The result x returns coefficients of the fitted linear function, it will have the same length as elements of A. Result i is the number of iterations performed. An error is returned if A and b are not the same length.
func SCALimit ¶
SCALimit solves the non-negative least squares problem.
Argument A represents a design or input matrix. Each element of A must have the same length. b represents a measurement or output vector. limit is a maximum number of iterations.
Iteration will stops after limit iterations or when the result does not change from one iteration to the next. If argument limit is < 0, the package value Limit is used.
The result x returns coefficients of the fitted linear function, it will have the same length as elements of A. Result i is the number of iterations performed. An error is returned if A and b are not the same length.
func SetLogOutput ¶
func SetLogOutput()
func StreamGenericCsvFile ¶
func StreamGenericTxtFile ¶
for MP source with header and contents in the same file
func StringExists ¶
func WriteCsv ¶
func WriteCsv(start, end Date, res ProjResult)
Types ¶
type Enum ¶
type Enum struct { VarName string // contains filtered or unexported fields }
bi-directional map