本文整理匯總了Golang中github.com/dukejeffrie/htm/data.Bitset.IsSet方法的典型用法代碼示例。如果您正苦於以下問題:Golang Bitset.IsSet方法的具體用法?Golang Bitset.IsSet怎麽用?Golang Bitset.IsSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/dukejeffrie/htm/data.Bitset
的用法示例。
在下文中一共展示了Bitset.IsSet方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: weaken
func (pm *PermanenceMap) weaken(input data.Bitset) {
for k, v := range pm.permanence {
if input.IsSet(k) {
v -= pm.config.Decrement
}
pm.Set(k, v)
}
}
示例2: narrow
func (pm *PermanenceMap) narrow(input data.Bitset) {
for k, v := range pm.permanence {
if input.IsSet(k) {
v += pm.config.Increment
} else {
v -= pm.config.Decrement
}
pm.Set(k, v)
}
}
示例3: ConfirmPrediction
func (c *Column) ConfirmPrediction(state data.Bitset) bool {
if c.learning >= 0 && state.IsSet(c.CellId(c.learning)) {
if log.HtmLogger.Enabled() {
log.HtmLogger.Printf("\t(%d, %d)=%04d: Confirmed prediction.",
c.Index, c.learning, c.CellId(c.learning))
}
return true
}
return false
}
示例4: Decode
func (s *PeriodicSensor) Decode(bits data.Bitset) interface{} {
found := bits.Any(func(int) bool {
return true
})
if bits.IsSet(found + 2) {
return found + 1 + s.First
} else if bits.IsSet(found + 1) {
// found is the center bit, so first.
return s.First
} else {
// found is center bit + 1, so last.
return s.Last
}
}