本文整理汇总了Golang中container/vector.IntVector.Copy方法的典型用法代码示例。如果您正苦于以下问题:Golang IntVector.Copy方法的具体用法?Golang IntVector.Copy怎么用?Golang IntVector.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类container/vector.IntVector
的用法示例。
在下文中一共展示了IntVector.Copy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Init
func (this *Sum) Init(newElements vector.IntVector) {
this.elements = newElements.Copy()
this.accumulated = 0
for _, v := range this.elements {
this.accumulated += v
}
}
示例2: recursive
func recursive(in int64, value *big.Int, v vector.IntVector, primeIndex int, primes []*big.Int, winner *big.Int, winner2 *vector.IntVector) {
if in > 4000000 {
if value.Cmp(winner) < 0 || winner.Cmp(big.NewInt(-1)) == 0 {
winner.Set(value)
*winner2 = v
fmt.Println(in, winner, *winner2)
//fmt.Print(in, winner, *winner2, " (")
//for k, v := range *winner2 {
// fmt.Print(primes[k], "**", v, " * ")
//}
//fmt.Println(")")
}
return
}
for i := int64(15); i >= 1; i -= 1 {
var factor big.Int
factor.Exp(primes[primeIndex], big.NewInt(i), nil)
//fmt.Println(factor, i, primes[primeIndex])
newV := v.Copy()
newV.Push(int(i))
var newValue big.Int
newValue.Mul(value, &factor)
recursive(in*(2*i+1)-i, &newValue, newV, primeIndex+1, primes, winner, winner2)
}
}
示例3: Init
func (this *Sum) Init(newElements vector.IntVector) {
this.elements = newElements.Copy()
}
示例4: Init2
func (this *Sum) Init2(newElements vector.IntVector, newAccumulated int) {
this.elements = newElements.Copy()
this.accumulated = newAccumulated
}