-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
numeric.gen.go
326 lines (286 loc) · 11 KB
/
numeric.gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
// Code generated by tensor/numeric.gen.go.tmpl. DO NOT EDIT.
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tensor
import (
"github.com/apache/arrow/go/v12/arrow"
)
// Int8 is an n-dim array of int8s.
type Int8 struct {
tensorBase
values []int8
}
// NewInt8 returns a new n-dimensional array of int8s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewInt8(data arrow.ArrayData, shape, strides []int64, names []string) *Int8 {
tsr := &Int8{tensorBase: *newTensor(arrow.PrimitiveTypes.Int8, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Int8Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Int8) Value(i []int64) int8 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Int8) Int8Values() []int8 { return tsr.values }
// Int16 is an n-dim array of int16s.
type Int16 struct {
tensorBase
values []int16
}
// NewInt16 returns a new n-dimensional array of int16s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewInt16(data arrow.ArrayData, shape, strides []int64, names []string) *Int16 {
tsr := &Int16{tensorBase: *newTensor(arrow.PrimitiveTypes.Int16, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Int16Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Int16) Value(i []int64) int16 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Int16) Int16Values() []int16 { return tsr.values }
// Int32 is an n-dim array of int32s.
type Int32 struct {
tensorBase
values []int32
}
// NewInt32 returns a new n-dimensional array of int32s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewInt32(data arrow.ArrayData, shape, strides []int64, names []string) *Int32 {
tsr := &Int32{tensorBase: *newTensor(arrow.PrimitiveTypes.Int32, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Int32Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Int32) Value(i []int64) int32 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Int32) Int32Values() []int32 { return tsr.values }
// Int64 is an n-dim array of int64s.
type Int64 struct {
tensorBase
values []int64
}
// NewInt64 returns a new n-dimensional array of int64s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewInt64(data arrow.ArrayData, shape, strides []int64, names []string) *Int64 {
tsr := &Int64{tensorBase: *newTensor(arrow.PrimitiveTypes.Int64, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Int64Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Int64) Value(i []int64) int64 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Int64) Int64Values() []int64 { return tsr.values }
// Uint8 is an n-dim array of uint8s.
type Uint8 struct {
tensorBase
values []uint8
}
// NewUint8 returns a new n-dimensional array of uint8s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewUint8(data arrow.ArrayData, shape, strides []int64, names []string) *Uint8 {
tsr := &Uint8{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint8, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Uint8Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Uint8) Value(i []int64) uint8 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Uint8) Uint8Values() []uint8 { return tsr.values }
// Uint16 is an n-dim array of uint16s.
type Uint16 struct {
tensorBase
values []uint16
}
// NewUint16 returns a new n-dimensional array of uint16s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewUint16(data arrow.ArrayData, shape, strides []int64, names []string) *Uint16 {
tsr := &Uint16{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint16, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Uint16Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Uint16) Value(i []int64) uint16 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Uint16) Uint16Values() []uint16 { return tsr.values }
// Uint32 is an n-dim array of uint32s.
type Uint32 struct {
tensorBase
values []uint32
}
// NewUint32 returns a new n-dimensional array of uint32s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewUint32(data arrow.ArrayData, shape, strides []int64, names []string) *Uint32 {
tsr := &Uint32{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint32, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Uint32Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Uint32) Value(i []int64) uint32 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Uint32) Uint32Values() []uint32 { return tsr.values }
// Uint64 is an n-dim array of uint64s.
type Uint64 struct {
tensorBase
values []uint64
}
// NewUint64 returns a new n-dimensional array of uint64s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewUint64(data arrow.ArrayData, shape, strides []int64, names []string) *Uint64 {
tsr := &Uint64{tensorBase: *newTensor(arrow.PrimitiveTypes.Uint64, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Uint64Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Uint64) Value(i []int64) uint64 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Uint64) Uint64Values() []uint64 { return tsr.values }
// Float32 is an n-dim array of float32s.
type Float32 struct {
tensorBase
values []float32
}
// NewFloat32 returns a new n-dimensional array of float32s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewFloat32(data arrow.ArrayData, shape, strides []int64, names []string) *Float32 {
tsr := &Float32{tensorBase: *newTensor(arrow.PrimitiveTypes.Float32, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Float32Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Float32) Value(i []int64) float32 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Float32) Float32Values() []float32 { return tsr.values }
// Float64 is an n-dim array of float64s.
type Float64 struct {
tensorBase
values []float64
}
// NewFloat64 returns a new n-dimensional array of float64s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewFloat64(data arrow.ArrayData, shape, strides []int64, names []string) *Float64 {
tsr := &Float64{tensorBase: *newTensor(arrow.PrimitiveTypes.Float64, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Float64Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Float64) Value(i []int64) float64 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Float64) Float64Values() []float64 { return tsr.values }
// Date32 is an n-dim array of date32s.
type Date32 struct {
tensorBase
values []arrow.Date32
}
// NewDate32 returns a new n-dimensional array of date32s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewDate32(data arrow.ArrayData, shape, strides []int64, names []string) *Date32 {
tsr := &Date32{tensorBase: *newTensor(arrow.PrimitiveTypes.Date32, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Date32Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Date32) Value(i []int64) arrow.Date32 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Date32) Date32Values() []arrow.Date32 { return tsr.values }
// Date64 is an n-dim array of date64s.
type Date64 struct {
tensorBase
values []arrow.Date64
}
// NewDate64 returns a new n-dimensional array of date64s.
// If strides is nil, row-major strides will be inferred.
// If names is nil, a slice of empty strings will be created.
func NewDate64(data arrow.ArrayData, shape, strides []int64, names []string) *Date64 {
tsr := &Date64{tensorBase: *newTensor(arrow.PrimitiveTypes.Date64, data, shape, strides, names)}
vals := tsr.data.Buffers()[1]
if vals != nil {
tsr.values = arrow.Date64Traits.CastFromBytes(vals.Bytes())
beg := tsr.data.Offset()
end := beg + tsr.data.Len()
tsr.values = tsr.values[beg:end]
}
return tsr
}
func (tsr *Date64) Value(i []int64) arrow.Date64 { j := int(tsr.offset(i)); return tsr.values[j] }
func (tsr *Date64) Date64Values() []arrow.Date64 { return tsr.values }
var (
_ Interface = (*Int8)(nil)
_ Interface = (*Int16)(nil)
_ Interface = (*Int32)(nil)
_ Interface = (*Int64)(nil)
_ Interface = (*Uint8)(nil)
_ Interface = (*Uint16)(nil)
_ Interface = (*Uint32)(nil)
_ Interface = (*Uint64)(nil)
_ Interface = (*Float32)(nil)
_ Interface = (*Float64)(nil)
_ Interface = (*Date32)(nil)
_ Interface = (*Date64)(nil)
)