gitee.com/quant1x/num@v0.3.2/internal/functions/special.go (about) 1 package functions 2 3 import ( 4 "gitee.com/quant1x/num/math32" 5 "math" 6 ) 7 8 func Sqrt_Go_F64(x []float64) { 9 for i := 0; i < len(x); i++ { 10 x[i] = math.Sqrt(x[i]) 11 } 12 } 13 14 func Sqrt_Go_F32(x []float32) { 15 for i := 0; i < len(x); i++ { 16 x[i] = math32.Sqrt(x[i]) 17 } 18 } 19 20 func Round_Go_F64(x []float64) { 21 for i := 0; i < len(x); i++ { 22 x[i] = math.Round(x[i]) 23 } 24 } 25 26 func Round_Go_F32(x []float32) { 27 for i := 0; i < len(x); i++ { 28 x[i] = math32.Round(x[i]) 29 } 30 } 31 32 func Floor_Go_F64(x []float64) { 33 for i := 0; i < len(x); i++ { 34 x[i] = math.Floor(x[i]) 35 } 36 } 37 38 func Floor_Go_F32(x []float32) { 39 for i := 0; i < len(x); i++ { 40 x[i] = math32.Floor(x[i]) 41 } 42 } 43 44 func Ceil_Go_F64(x []float64) { 45 for i := 0; i < len(x); i++ { 46 x[i] = math.Ceil(x[i]) 47 } 48 } 49 50 func Ceil_Go_F32(x []float32) { 51 for i := 0; i < len(x); i++ { 52 x[i] = math32.Ceil(x[i]) 53 } 54 } 55 56 func Pow_Go_F64(x, y []float64) { 57 for i := 0; i < len(x); i++ { 58 x[i] = math.Pow(x[i], y[i]) 59 } 60 } 61 62 func Pow_Go_F32(x, y []float32) { 63 for i := 0; i < len(x); i++ { 64 x[i] = math32.Pow(x[i], y[i]) 65 } 66 } 67 68 func Sin_Go_F64(x []float64) { 69 for i := 0; i < len(x); i++ { 70 x[i] = math.Sin(x[i]) 71 } 72 } 73 74 func Sin_Go_F32(x []float32) { 75 for i := 0; i < len(x); i++ { 76 x[i] = math32.Sin(x[i]) 77 } 78 } 79 80 func Cos_Go_F64(x []float64) { 81 for i := 0; i < len(x); i++ { 82 x[i] = math.Cos(x[i]) 83 } 84 } 85 86 func Cos_Go_F32(x []float32) { 87 for i := 0; i < len(x); i++ { 88 x[i] = math32.Cos(x[i]) 89 } 90 } 91 92 func SinCos_Go_F64(dstSin, dstCos, x []float64) { 93 for i := 0; i < len(x); i++ { 94 dstSin[i] = math.Sin(x[i]) 95 dstCos[i] = math.Cos(x[i]) 96 } 97 } 98 99 func SinCos_Go_F32(dstSin, dstCos, x []float32) { 100 for i := 0; i < len(x); i++ { 101 dstSin[i] = math32.Sin(x[i]) 102 dstCos[i] = math32.Cos(x[i]) 103 } 104 } 105 106 func Exp_Go_F64(x []float64) { 107 for i := 0; i < len(x); i++ { 108 x[i] = math.Exp(x[i]) 109 } 110 } 111 112 func Exp_Go_F32(x []float32) { 113 for i := 0; i < len(x); i++ { 114 x[i] = math32.Exp(x[i]) 115 } 116 } 117 118 func Log_Go_F64(x []float64) { 119 for i := 0; i < len(x); i++ { 120 x[i] = math.Log(x[i]) 121 } 122 } 123 124 func Log_Go_F32(x []float32) { 125 for i := 0; i < len(x); i++ { 126 x[i] = math32.Log(x[i]) 127 } 128 } 129 130 func Log2_Go_F64(x []float64) { 131 for i := 0; i < len(x); i++ { 132 x[i] = math.Log2(x[i]) 133 } 134 } 135 136 func Log2_Go_F32(x []float32) { 137 for i := 0; i < len(x); i++ { 138 x[i] = math32.Log2(x[i]) 139 } 140 } 141 142 func Log10_Go_F64(x []float64) { 143 for i := 0; i < len(x); i++ { 144 x[i] = math.Log10(x[i]) 145 } 146 } 147 148 func Log10_Go_F32(x []float32) { 149 for i := 0; i < len(x); i++ { 150 x[i] = math32.Log10(x[i]) 151 } 152 }