gitee.com/quant1x/num@v0.3.2/arithmetics_mul.go (about)

     1  package num
     2  
     3  import (
     4  	"gitee.com/quant1x/num/x32"
     5  	"gitee.com/quant1x/num/x64"
     6  	"slices"
     7  )
     8  
     9  // Mul arithmetics 乘法
    10  func Mul[T Number](x []T, y any) []T {
    11  	return BinaryOperations(x, y, x32.Mul, x64.Mul, __mul_go[T])
    12  }
    13  
    14  func __mul_go[T Number](x, y []T) []T {
    15  	x = slices.Clone(x)
    16  	for i := 0; i < len(x); i++ {
    17  		x[i] *= y[i]
    18  	}
    19  	return x
    20  }