本文整理汇总了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)
}