本文整理匯總了Golang中github.com/xlvector/hector/core.Vector.ElemWiseMultiplyAdd方法的典型用法代碼示例。如果您正苦於以下問題:Golang Vector.ElemWiseMultiplyAdd方法的具體用法?Golang Vector.ElemWiseMultiplyAdd怎麽用?Golang Vector.ElemWiseMultiplyAdd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/xlvector/hector/core.Vector
的用法示例。
在下文中一共展示了Vector.ElemWiseMultiplyAdd方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NextPoint
func (m *OWLQNMinimizer) NextPoint(curPos *core.Vector, dir *core.Vector, alpha float64) *core.Vector {
if owlqn_output_switch {
fmt.Printf(".")
}
newPos := curPos.ElemWiseMultiplyAdd(dir, alpha)
if m.l1reg > 0 {
for key, val := range curPos.Data {
if val*newPos.GetValue(key) < 0 {
newPos.SetValue(key, 0)
}
}
}
return newPos
}
示例2: UpdateState
// Description: the pos and gradient arguments should NOT be modified outside
func (h *QuasiNewtonHelper) UpdateState(nextPos *core.Vector, nextGrad *core.Vector) (isOptimal bool) {
if int64(len(h.sList)) >= h.numHist {
h.sList = h.sList[1:]
h.yList = h.yList[1:]
h.roList = h.roList[1:]
}
newS := nextPos.ElemWiseMultiplyAdd(h.curPos, -1)
newY := nextGrad.ElemWiseMultiplyAdd(h.curGrad, -1)
ro := newS.Dot(newY)
h.sList = append(h.sList, newS)
h.yList = append(h.yList, newY)
h.roList = append(h.roList, ro)
h.curPos = nextPos
h.curGrad = nextGrad
return ro == 0
}
示例3: NextPoint
func (m *LBFGSMinimizer) NextPoint(curPos *core.Vector, dir *core.Vector, alpha float64) *core.Vector {
if lbfgs_output_switch {
fmt.Printf(".")
}
return curPos.ElemWiseMultiplyAdd(dir, alpha)
}