Documentation ¶
Index ¶
- Constants
- func ARange(start int, stop int) []float64
- func Abs(a float64) float64
- func AbsDiffInt(x, y int) int
- func AbsInt(x int) int
- func ArgSort(s []float64) []int
- func ArgSortMaxToMin(s []float64) []int
- func Avg(s []float64) float64
- func BisectLeft(s []float64, v float64) int
- func BisectRight(s []float64, v float64) int
- func ByteToPng(imgByte []byte, path string) error
- func CalcPercent(i interface{}, total interface{}) int
- func Capitalize(i string) string
- func ClearAndF64(i interface{}) float64
- func CompareF64(a, b float64, Operation string) bool
- func CompareStruct(aa interface{}, oo interface{}, ExceptKeys ...string) (keys []string)
- func CompressZLib(src []byte) ([]byte, error)
- func Convolve(a, v []float64, mode ConvolutionMode) []float64
- func Copy(src interface{}, dst interface{}) error
- func CopySF64(src []float64) []float64
- func CopySInt(src []int) []int
- func CopyST(s []string) []string
- func Cross2Line(x1, x2, y1, y2 float64) bool
- func CrossPosList(s []float64, limit float64) []int
- func DecryptUnCompressUnpackTo(src []byte, dst interface{}, key string) (err error)
- func DecryptUnpack(src []byte, key string) (dst interface{}, err error)
- func Default(OriginalValue, v string) string
- func DefaultF64(OriginalValue, v float64) float64
- func DefaultInt(OriginalValue, v int) int
- func DefaultInt64(OriginalValue, v int64) int64
- func DefaultST(OriginalValue, v []string) []string
- func DelSStr(s []string, delValue string) []string
- func DeprecatedTest(i float64) float64deprecated
- func Diff(s []float64) float64
- func DiffOneValue(s []float64, v float64) []float64
- func DiffTowSliceMax(s1, s2 []float64, validPercent ...float64) float64
- func Encrypt(plainText, key, iv string) (dst []byte, err error)
- func EqualSF(a, b []float64) bool
- func EqualSI(a, b []int) bool
- func EqualStr(a []string, b []string) bool
- func F64(i interface{}) float64
- func F64Str(v float64, decimals ...int) string
- func F64s(s []string) []float64
- func F64sAdd(i []float64, a float64, decimals ...int) []float64
- func F64sGTIdx(s []float64, limit float64) int
- func F64sReverse(i []float64, decimals ...int) []float64
- func FileExists(f string) bool
- func First(s S, defaultValue ...interface{}) interface{}
- func FirstBool(s []bool, defaultValue ...bool) bool
- func FirstF64(s []float64, defaultV ...float64) float64
- func FirstInt(s []int, defaultValue ...int) int
- func FirstStr(s []string, defaultV ...string) string
- func Float64sAddRandom(i []float64, x1 float64, x2 float64, decimals ...int) []float64
- func Float64sSort(s []float64) []float64
- func Float64sSortMaxToMin(s []float64) []float64
- func GetFieldDiffOne(a, o interface{}) (keyList []string, v1List []string, v2List []string)
- func GetS(s []interface{}, p int) interface{}
- func GetSF(s []float64, p int) float64
- func GetSInt(s []int, p int) int
- func GetST(s []string, p int, defaultValue ...string) string
- func GetType(i interface{}) reflect.Type
- func HexToInt64(i string) (int64, error)
- func IdxS(i interface{}, s S) int
- func IdxSI(i int, s SI) int
- func IdxST(i string, s []string) int
- func If(cdt bool, a interface{}, b interface{}) interface{}
- func IfErr(cdt bool, a interface{}, s ...interface{}) error
- func IfErr2(cdt bool, a, b error) error
- func IfF64(cdt bool, a float64, b float64) float64
- func IfInt(cdt bool, a int, b int) int
- func IfInt64(cdt bool, a int64, b int64) int64
- func IfPanic(cdt bool, s ...interface{})
- func IfSF(cdt bool, a []float64, b []float64) []float64
- func IfSI(cdt bool, a []int, b []int) []int
- func IfSST(cdt bool, a [][]string, b [][]string) [][]string
- func IfST(cdt bool, a []string, b []string) []string
- func IfStr(cdt bool, a string, b string) string
- func InF64(i, x1, x2 float64) float64
- func InInt(i, x1, x2 int) int
- func InRangeF64(i, minVal, maxVal float64) float64
- func InRangeInt(i, minVal, maxVal int) int
- func InRangeInt64(i, minVal, maxVal int64) int64
- func InSF(i float64, s []float64) bool
- func InSI(i int, s []int) bool
- func InSSF(i []float64, ss [][]float64) bool
- func InSSI(si []int, ssi [][]int) bool
- func InST(i string, s []string) bool
- func InSTIgnore(i string, s ...string) bool
- func InSlice(i string, s []string) bool
- func InStringList(i string, s []string) bool
- func InsertSF64(s []float64, index int, value float64) []float64
- func InsertSStr(s []string, index int, value string) []string
- func Int(i interface{}) int
- func Int64(i interface{}) int64
- func IntDiffOneValue(s []int, v int) []int
- func IntListReverse(i []int) []int
- func IntSAdd(i []int, a int) []int
- func IntZ2(i int) string
- func IntZ3(i int) string
- func IntZ8(i int) string
- func Intersect(a, b []string) []string
- func IntersectSize(a, b []string) int
- func IsEmptyStr(i string) bool
- func IsErr(e1 error, e2 error) bool
- func IsInRangeF64(i, minVal, maxVal float64) bool
- func IsPointer(value interface{}) error
- func IsUuid(i string) bool
- func Join(s ...interface{}) string
- func JoinRmEmpty(sep string, s ...interface{}) string
- func LastF64(s []float64, defaultV ...float64) float64
- func LastStr(s []string, defaultV ...string) string
- func LinSpace(start, end float64, num int) []float64
- func LineToLog(i float64) float64
- func LineToLogs(i []float64) []float64
- func Linspace(start, end float64, num int) []float64
- func LogToLine(i float64) float64
- func LogToLineSumLineToLog(i []float64) float64
- func LogToLines(i []float64) []float64
- func LstSq(a, b *mat.Dense) *mat.Dense
- func MakeFloat64(length int, v float64) []float64
- func MapKeyInts(m map[int]interface{}) []int
- func MapKeys(m map[string]interface{}) []string
- func MapKvReverse(kv g.MapStrStr) g.MapStrStr
- func MapValueF64s(m map[string]float64) []float64
- func Max(s []float64) float64
- func MaxF64(s ...float64) float64
- func MaxIdx(s []float64) int
- func MaxInt(s []int) int
- func MaxInt64(s ...int64) int64
- func MaxIntIdx(s []int) int
- func MergeMapStrStr(maps ...map[string]string) map[string]string
- func MergeStr(a, b []string) []string
- func Min(s []float64) float64
- func MinF64(s ...float64) float64
- func MinIdx(s []float64) int
- func MinInt(s []int) int
- func MinIntIdx(s []int) int
- func MinMaxInt(s []int) (int, int, int, int)
- func MsToStr(i int64, format string) string
- func MustIn(i string, s ...string) error
- func MustInF64(i float64, s ...float64) error
- func MustInInt(i int, s ...int) error
- func Ones(size int) []float64
- func OrFloat(a float64, b ...float64) float64
- func OrInt(a int, b ...int) int
- func OrString(a string, b ...string) string
- func Pack(src interface{}) ([]byte, error)
- func PackCompress(src interface{}) ([]byte, error)
- func PackCompressEncrypt(src interface{}, key string) (dst []byte, err error)
- func PartSF(s []float64, maxLength int) []float64
- func PartSI(s []int, maxLength int) []int
- func PermutationsInt(s []int) [][]int
- func PrintMemUsage()
- func ProductSF64(ssf [][]float64) [][]float64
- func PullUp01(src [][]float64, point int) [][]float64
- func R0(i float64) float64
- func R0s(s []float64) []float64
- func R1(i float64) float64
- func R1s(s []float64) []float64
- func R2(i float64) float64
- func R2s(s []float64) []float64
- func R3(i float64) float64
- func R3s(s []float64) []float64
- func R4(i float64) float64
- func R5(i float64) float64
- func R6(i float64) float64
- func R6s(s []float64) []float64
- func R8(i float64) float64
- func R9(i float64) float64
- func RandomF64(x1, x2 float64, decimals ...int) float64
- func RandomF64s(x1, x2 float64, n int, decimals ...int) []float64
- func RandomInSF64(s ...float64) float64
- func RandomInt(x1, x2 int) int
- func RandomIntInSI(s []int) int
- func RandomIntS(x1, x2 int, n int) []int
- func RandomLetter(length int) string
- func RandomLetterLower(length int) string
- func RandomNumber(length int) string
- func RandomSliceIntUnique(x1, x2, count int) []int
- func RandomStrInST(s []string) string
- func Range(start, stop int) []float64
- func RangeInt(start, stop int) []int
- func RemoveDuplicateFloat64(s []float64) []float64
- func RemoveDuplicateInt(s []int) []int
- func RemoveDuplicateStr(s []string) []string
- func RemoveItemInST(s []string, removeItem string) []string
- func ReplaceAndInt(i interface{}) int
- func ReverseF64(s []float64) []float64
- func ReverseST(s []string) []string
- func Round(i float64, decimals ...int) float64
- func Rounds(s []float64, decimals ...int) []float64
- func SF64Index(i float64, s []float64) int
- func SStrIndex(i string, s []string) int
- func SafeFilename(i string) string
- func SameMapStrStr(a map[string]string, b map[string]string) bool
- func SavGolFilter(x []float64, windowLength int, polyOrder int, deRiv int, delta float64) []float64
- func Sha1(v interface{}) string
- func Sha3(v interface{}) string
- func Sha3Bytes(v []byte) string
- func Sha3File(path string) string
- func Show(i interface{})
- func ShowBytes(i []byte)
- func ShowDetail(i interface{})
- func ShowType(i interface{})
- func Sleep(s float64, show ...int)
- func SliceEqual(a S, b S) bool
- func SliceEqualST(a []string, b []string) bool
- func SliceFloat64Equal(a []float64, b []float64) bool
- func SliceStrRepeat(i string, num int) []string
- func SortMapByKey(m map[string]interface{}) []string
- func SortMapByValue(m map[string]float64) []string
- func SortMapByValueInt(m map[string]int) []string
- func SortMapByValueIntMinToMax(m map[string]int) []string
- func Split01(src []float64) [][]float64
- func Str(i interface{}) string
- func StrToMs(i string, format string) int64
- func SubStr(str string, start int, length ...int) string
- func SubStringHan(s string, n int) string
- func Sum(s []float64) float64
- func SumWhereGT(src [][]float64, limit, a, b float64) []float64
- func T1(title ...interface{})
- func T2(title ...interface{})
- func TestAssert12(t *gtest.T, e1, e2 error, v0, v1, v2 interface{})
- func ToMaxF64(y []float64, maxVal float64) []float64
- func ToMinF64(y []float64, minVal float64) []float64
- func ToMs(i float64) float64
- func ToPercent(i float64) float64
- func TodayDate() string
- func TryExpect()
- func UnCompressUnpack(src []byte) (dst interface{}, err error)
- func UnCompressUnpackTo(src []byte, dst interface{}) (err error)
- func UnCompressZLib(src []byte) ([]byte, error)
- func Unpack(src []byte) (dst interface{}, err error)
- func UnpackTo(src []byte, dst interface{}) (err error)
- func WhereGE(s []float64, limit, a, b float64) []float64
- func WhereGT(s []float64, limit, a, b float64) []float64
- func WhereGT2(s []float64, limit float64) []float64
- func WhereGtNum(s []float64, limit float64) (num int)
- func WhereGtSI(s []int, limit, a, b int) []int
- func WhereLT(s []float64, limit, a, b float64) []float64
- func WhereLtNum(s []float64, limit float64) (num int)
- func YListLogToLineAndP2PLineToLog(yList [][]float64) []float64
- func YListP2PSum(yList [][]float64) []float64
- func Z1(i float64) string
- func Z2(i float64) string
- func Z3(i float64) string
- func Z4(i float64) string
- func ZFill(i float64, decimals int) string
- func Zeroes(size int) []float64
- func Zzz(title ...string)
- type ConvolutionMode
- type Ip2LocationRecord
- type PsInfo
- type PsInfoItem
- type PsInfoLoad
- type S
- type SF
- type SI
- type SS
- type SSF
- type SSI
- type SST
- type SStr
- type ST
Constants ¶
const ( // Full - returns the convolution at each point of overlap, i.e. of length N+M-1. Full = iota // Same - returns the output of length max(M, N). Same // Valid - returns the output of length max(M, N) - min(M, N) + 1. Valid )
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
Variables ¶
This section is empty.
Functions ¶
func ARange ¶
ARange implements `np.ARange` - i.e. returns a list of integers (start, ..., stop - 1) in the form of []float64
func AbsDiffInt ¶
func BisectLeft ¶
BisectLeft all(val >= x for val in a) // https://docs.python.org/ 3 /library/bisect.html
func BisectRight ¶
BisectRight all(val > x for val in a) // https://docs.python.org/ 3 /library/bisect.html
func CalcPercent ¶
func CalcPercent(i interface{}, total interface{}) int
func Capitalize ¶
func ClearAndF64 ¶
func ClearAndF64(i interface{}) float64
func CompareF64 ¶
func CompareStruct ¶
func CompressZLib ¶
func Convolve ¶
func Convolve(a, v []float64, mode ConvolutionMode) []float64
Convolve is a (very naive) implementation of precise discrete convolution. The results are numerically equivalent to `np.convolve(a, v, mode)` - it looks like that `np.convolve` uses precise convolution as well (but not an FFT approximation). TODO: optimize the implementation - the current one has O((M+N)^2) time complexity. Looks like it's possible to achieve at least O(MN).
func CrossPosList ¶
func DecryptUnpack ¶
func DefaultF64 ¶
func DefaultInt ¶
func DefaultInt64 ¶
func DeprecatedTest
deprecated
func DiffOneValue ¶
func DiffTowSliceMax ¶
func F64sReverse ¶
func FileExists ¶
func Float64sAddRandom ¶
func Float64sSort ¶
func Float64sSortMaxToMin ¶
Float64sSortMaxToMin max > min
func GetFieldDiffOne ¶
func HexToInt64 ¶
func IfPanic ¶
func IfPanic(cdt bool, s ...interface{})
If evaluates a condition, if true returns the first parameter otherwise the second
func InRangeF64 ¶
func InRangeInt ¶
func InRangeInt64 ¶
func InSTIgnore ¶
func InStringList ¶
func IntDiffOneValue ¶
func IntListReverse ¶
func IntersectSize ¶
func IsInRangeF64 ¶
func JoinRmEmpty ¶
func LinSpace ¶
LinSpace implements `np.LinSpace` - i.e. splits the interval [start, end] into `num - 1` equal intervals and returns `num` split points.
func LineToLogs ¶
func LogToLineSumLineToLog ¶
func LogToLines ¶
func LstSq ¶
LstSq computes least-squares solution to equation A*x = b, i.e. computes a vector x such that the 2-norm “|b - A x|“ is minimized. Based on: https://github.com/scipy/scipy/blob/v1.3.0rc1/scipy/linalg/basic.py#L1042
func MakeFloat64 ¶
func MapKeyInts ¶
func MapValueF64s ¶
func PackCompress ¶
func PackCompressEncrypt ¶
PackEncrypt Note that the key must be 16/24/32 bit length.
func PermutationsInt ¶
func PrintMemUsage ¶
func PrintMemUsage()
func ProductSF64 ¶
func RandomInSF64 ¶
func RandomIntInSI ¶
func RandomIntS ¶
func RandomLetter ¶
func RandomLetterLower ¶
func RandomNumber ¶
func RandomSliceIntUnique ¶
func RandomStrInST ¶
func RemoveDuplicateFloat64 ¶
func RemoveDuplicateInt ¶
func RemoveDuplicateStr ¶
func RemoveItemInST ¶
func ReplaceAndInt ¶
func ReplaceAndInt(i interface{}) int
func ReverseF64 ¶
func SafeFilename ¶
func SavGolFilter ¶
SavGolFilter implements Savitzky-Golay filter (https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.savgol_filter.html) based on: https://github.com/scipy/scipy/blob/v1.3.0rc1/scipy/signal/_savitzky_golay.py#L227
func ShowDetail ¶
func ShowDetail(i interface{})
func SliceEqual ¶
func SliceEqualST ¶
func SliceFloat64Equal ¶
func SliceStrRepeat ¶
func SortMapByKey ¶
func SortMapByValue ¶
func SumWhereGT ¶
SumWhereGT 2维变1维,然后相加
func TestAssert12 ¶
func UnCompressUnpack ¶
func UnCompressUnpackTo ¶
func UnCompressZLib ¶
func WhereGtNum ¶
func WhereLtNum ¶
func YListP2PSum ¶
Types ¶
type ConvolutionMode ¶
type ConvolutionMode int
ConvolutionMode defines convolution output array length.
type Ip2LocationRecord ¶
type Ip2LocationRecord struct { CountryShort string Country string Province string // Region Province City string }
func Ip2Location ¶
func Ip2Location(ipList []string) ([]*Ip2LocationRecord, error)
Ip2Location ... Country / CountryShort / Province / City
type PsInfo ¶
type PsInfo struct { Memory PsInfoItem Disk PsInfoItem Load PsInfoLoad Uptime uint64 }