| 1 |
// Code generated by genlib2. DO NOT EDIT. |
| 2 |
|
| 3 |
package execution |
| 4 |
|
| 5 |
import ( |
| 6 |
"reflect" |
| 7 |
|
| 8 |
"github.com/pkg/errors" |
| 9 |
"gorgonia.org/tensor/internal/storage" |
| 10 |
) |
| 11 |
|
| 12 |
func MonotonicSum(t reflect.Type, a *storage.Header) (retVal interface{}, err error) { |
| 13 |
switch t { |
| 14 |
case Int: |
| 15 |
retVal = SumI(a.Ints()) |
| 16 |
return |
| 17 |
case Int8: |
| 18 |
retVal = SumI8(a.Int8s()) |
| 19 |
return |
| 20 |
case Int16: |
| 21 |
retVal = SumI16(a.Int16s()) |
| 22 |
return |
| 23 |
case Int32: |
| 24 |
retVal = SumI32(a.Int32s()) |
| 25 |
return |
| 26 |
case Int64: |
| 27 |
retVal = SumI64(a.Int64s()) |
| 28 |
return |
| 29 |
case Uint: |
| 30 |
retVal = SumU(a.Uints()) |
| 31 |
return |
| 32 |
case Uint8: |
| 33 |
retVal = SumU8(a.Uint8s()) |
| 34 |
return |
| 35 |
case Uint16: |
| 36 |
retVal = SumU16(a.Uint16s()) |
| 37 |
return |
| 38 |
case Uint32: |
| 39 |
retVal = SumU32(a.Uint32s()) |
| 40 |
return |
| 41 |
case Uint64: |
| 42 |
retVal = SumU64(a.Uint64s()) |
| 43 |
return |
| 44 |
case Float32: |
| 45 |
retVal = SumF32(a.Float32s()) |
| 46 |
return |
| 47 |
case Float64: |
| 48 |
retVal = SumF64(a.Float64s()) |
| 49 |
return |
| 50 |
case Complex64: |
| 51 |
retVal = SumC64(a.Complex64s()) |
| 52 |
return |
| 53 |
case Complex128: |
| 54 |
retVal = SumC128(a.Complex128s()) |
| 55 |
return |
| 56 |
default: |
| 57 |
err = errors.Errorf("Cannot perform Sum on %v", t) |
| 58 |
return |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
func SumMethods(t reflect.Type) (firstFn, lasFn, defaultFn interface{}, err error) { |
| 63 |
switch t { |
| 64 |
case Int: |
| 65 |
return VecAddI, SumI, AddI, nil |
| 66 |
case Int8: |
| 67 |
return VecAddI8, SumI8, AddI8, nil |
| 68 |
case Int16: |
| 69 |
return VecAddI16, SumI16, AddI16, nil |
| 70 |
case Int32: |
| 71 |
return VecAddI32, SumI32, AddI32, nil |
| 72 |
case Int64: |
| 73 |
return VecAddI64, SumI64, AddI64, nil |
| 74 |
case Uint: |
| 75 |
return VecAddU, SumU, AddU, nil |
| 76 |
case Uint8: |
| 77 |
return VecAddU8, SumU8, AddU8, nil |
| 78 |
case Uint16: |
| 79 |
return VecAddU16, SumU16, AddU16, nil |
| 80 |
case Uint32: |
| 81 |
return VecAddU32, SumU32, AddU32, nil |
| 82 |
case Uint64: |
| 83 |
return VecAddU64, SumU64, AddU64, nil |
| 84 |
case Float32: |
| 85 |
return VecAddF32, SumF32, AddF32, nil |
| 86 |
case Float64: |
| 87 |
return VecAddF64, SumF64, AddF64, nil |
| 88 |
case Complex64: |
| 89 |
return VecAddC64, SumC64, AddC64, nil |
| 90 |
case Complex128: |
| 91 |
return VecAddC128, SumC128, AddC128, nil |
| 92 |
default: |
| 93 |
return nil, nil, nil, errors.Errorf("No methods found for Sum for %v", t) |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
func MonotonicMax(t reflect.Type, a *storage.Header) (retVal interface{}, err error) { |
| 98 |
switch t { |
| 99 |
case Int: |
| 100 |
retVal = SliceMaxI(a.Ints()) |
| 101 |
return |
| 102 |
case Int8: |
| 103 |
retVal = SliceMaxI8(a.Int8s()) |
| 104 |
return |
| 105 |
case Int16: |
| 106 |
retVal = SliceMaxI16(a.Int16s()) |
| 107 |
return |
| 108 |
case Int32: |
| 109 |
retVal = SliceMaxI32(a.Int32s()) |
| 110 |
return |
| 111 |
case Int64: |
| 112 |
retVal = SliceMaxI64(a.Int64s()) |
| 113 |
return |
| 114 |
case Uint: |
| 115 |
retVal = SliceMaxU(a.Uints()) |
| 116 |
return |
| 117 |
case Uint8: |
| 118 |
retVal = SliceMaxU8(a.Uint8s()) |
| 119 |
return |
| 120 |
case Uint16: |
| 121 |
retVal = SliceMaxU16(a.Uint16s()) |
| 122 |
return |
| 123 |
case Uint32: |
| 124 |
retVal = SliceMaxU32(a.Uint32s()) |
| 125 |
return |
| 126 |
case Uint64: |
| 127 |
retVal = SliceMaxU64(a.Uint64s()) |
| 128 |
return |
| 129 |
case Float32: |
| 130 |
retVal = SliceMaxF32(a.Float32s()) |
| 131 |
return |
| 132 |
case Float64: |
| 133 |
retVal = SliceMaxF64(a.Float64s()) |
| 134 |
return |
| 135 |
default: |
| 136 |
err = errors.Errorf("Cannot perform Max on %v", t) |
| 137 |
return |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
func MaxMethods(t reflect.Type) (firstFn, lasFn, defaultFn interface{}, err error) { |
| 142 |
switch t { |
| 143 |
case Int: |
| 144 |
return VecMaxI, SliceMaxI, MaxI, nil |
| 145 |
case Int8: |
| 146 |
return VecMaxI8, SliceMaxI8, MaxI8, nil |
| 147 |
case Int16: |
| 148 |
return VecMaxI16, SliceMaxI16, MaxI16, nil |
| 149 |
case Int32: |
| 150 |
return VecMaxI32, SliceMaxI32, MaxI32, nil |
| 151 |
case Int64: |
| 152 |
return VecMaxI64, SliceMaxI64, MaxI64, nil |
| 153 |
case Uint: |
| 154 |
return VecMaxU, SliceMaxU, MaxU, nil |
| 155 |
case Uint8: |
| 156 |
return VecMaxU8, SliceMaxU8, MaxU8, nil |
| 157 |
case Uint16: |
| 158 |
return VecMaxU16, SliceMaxU16, MaxU16, nil |
| 159 |
case Uint32: |
| 160 |
return VecMaxU32, SliceMaxU32, MaxU32, nil |
| 161 |
case Uint64: |
| 162 |
return VecMaxU64, SliceMaxU64, MaxU64, nil |
| 163 |
case Float32: |
| 164 |
return VecMaxF32, SliceMaxF32, MaxF32, nil |
| 165 |
case Float64: |
| 166 |
return VecMaxF64, SliceMaxF64, MaxF64, nil |
| 167 |
default: |
| 168 |
return nil, nil, nil, errors.Errorf("No methods found for Max for %v", t) |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
func MonotonicMin(t reflect.Type, a *storage.Header) (retVal interface{}, err error) { |
| 173 |
switch t { |
| 174 |
case Int: |
| 175 |
retVal = SliceMinI(a.Ints()) |
| 176 |
return |
| 177 |
case Int8: |
| 178 |
retVal = SliceMinI8(a.Int8s()) |
| 179 |
return |
| 180 |
case Int16: |
| 181 |
retVal = SliceMinI16(a.Int16s()) |
| 182 |
return |
| 183 |
case Int32: |
| 184 |
retVal = SliceMinI32(a.Int32s()) |
| 185 |
return |
| 186 |
case Int64: |
| 187 |
retVal = SliceMinI64(a.Int64s()) |
| 188 |
return |
| 189 |
case Uint: |
| 190 |
retVal = SliceMinU(a.Uints()) |
| 191 |
return |
| 192 |
case Uint8: |
| 193 |
retVal = SliceMinU8(a.Uint8s()) |
| 194 |
return |
| 195 |
case Uint16: |
| 196 |
retVal = SliceMinU16(a.Uint16s()) |
| 197 |
return |
| 198 |
case Uint32: |
| 199 |
retVal = SliceMinU32(a.Uint32s()) |
| 200 |
return |
| 201 |
case Uint64: |
| 202 |
retVal = SliceMinU64(a.Uint64s()) |
| 203 |
return |
| 204 |
case Float32: |
| 205 |
retVal = SliceMinF32(a.Float32s()) |
| 206 |
return |
| 207 |
case Float64: |
| 208 |
retVal = SliceMinF64(a.Float64s()) |
| 209 |
return |
| 210 |
default: |
| 211 |
err = errors.Errorf("Cannot perform Min on %v", t) |
| 212 |
return |
| 213 |
} |
| 214 |
} |
| 215 |
|
| 216 |
func MinMethods(t reflect.Type) (firstFn, lasFn, defaultFn interface{}, err error) { |
| 217 |
switch t { |
| 218 |
case Int: |
| 219 |
return VecMinI, SliceMinI, MinI, nil |
| 220 |
case Int8: |
| 221 |
return VecMinI8, SliceMinI8, MinI8, nil |
| 222 |
case Int16: |
| 223 |
return VecMinI16, SliceMinI16, MinI16, nil |
| 224 |
case Int32: |
| 225 |
return VecMinI32, SliceMinI32, MinI32, nil |
| 226 |
case Int64: |
| 227 |
return VecMinI64, SliceMinI64, MinI64, nil |
| 228 |
case Uint: |
| 229 |
return VecMinU, SliceMinU, MinU, nil |
| 230 |
case Uint8: |
| 231 |
return VecMinU8, SliceMinU8, MinU8, nil |
| 232 |
case Uint16: |
| 233 |
return VecMinU16, SliceMinU16, MinU16, nil |
| 234 |
case Uint32: |
| 235 |
return VecMinU32, SliceMinU32, MinU32, nil |
| 236 |
case Uint64: |
| 237 |
return VecMinU64, SliceMinU64, MinU64, nil |
| 238 |
case Float32: |
| 239 |
return VecMinF32, SliceMinF32, MinF32, nil |
| 240 |
case Float64: |
| 241 |
return VecMinF64, SliceMinF64, MinF64, nil |
| 242 |
default: |
| 243 |
return nil, nil, nil, errors.Errorf("No methods found for Min for %v", t) |
| 244 |
} |
| 245 |
} |