forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPy.bitwise.gen.cs
More file actions
444 lines (432 loc) · 17.8 KB
/
NumPy.bitwise.gen.cs
File metadata and controls
444 lines (432 loc) · 17.8 KB
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
// Copyright (c) 2019 by the SciSharp Team
// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Python.Runtime;
using Numpy.Models;
using Python.Included;
namespace Numpy
{
public partial class NumPy
{
/// <summary>
/// Compute the bit-wise AND of two arrays element-wise.<br></br>
///
/// Computes the bit-wise AND of the underlying binary representation of
/// the integers in the input arrays.<br></br>
/// This ufunc implements the C/Python
/// operator &.
/// </summary>
/// <param name="x2">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="x1">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Result.<br></br>
///
/// This is a scalar if both x1 and x2 are scalars.
/// </returns>
public NDarray bitwise_and(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x2,
x1,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("bitwise_and", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Compute the bit-wise OR of two arrays element-wise.<br></br>
///
/// Computes the bit-wise OR of the underlying binary representation of
/// the integers in the input arrays.<br></br>
/// This ufunc implements the C/Python
/// operator |.
/// </summary>
/// <param name="x2">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="x1">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Result.<br></br>
///
/// This is a scalar if both x1 and x2 are scalars.
/// </returns>
public NDarray bitwise_or(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x2,
x1,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("bitwise_or", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Compute the bit-wise XOR of two arrays element-wise.<br></br>
///
/// Computes the bit-wise XOR of the underlying binary representation of
/// the integers in the input arrays.<br></br>
/// This ufunc implements the C/Python
/// operator ^.
/// </summary>
/// <param name="x2">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="x1">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Result.<br></br>
///
/// This is a scalar if both x1 and x2 are scalars.
/// </returns>
public NDarray bitwise_xor(NDarray x2, NDarray x1, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x2,
x1,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("bitwise_xor", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Compute bit-wise inversion, or bit-wise NOT, element-wise.<br></br>
///
/// Computes the bit-wise NOT of the underlying binary representation of
/// the integers in the input arrays.<br></br>
/// This ufunc implements the C/Python
/// operator ~.
///
/// For signed integer inputs, the two’s complement is returned.<br></br>
/// In a
/// two’s-complement system negative numbers are represented by the two’s
/// complement of the absolute value.<br></br>
/// This is the most common method of
/// representing signed integers on computers [1].<br></br>
/// A N-bit
/// two’s-complement system can represent every integer in the range
/// to .
///
/// Notes
///
/// bitwise_not is an alias for invert:
///
/// References
/// </summary>
/// <param name="x">
/// Only integer and boolean types are handled.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Result.<br></br>
///
/// This is a scalar if x is a scalar.
/// </returns>
public NDarray invert(NDarray x, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("invert", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Shift the bits of an integer to the left.<br></br>
///
/// Bits are shifted to the left by appending x2 0s at the right of x1.
/// Since the internal representation of numbers is in binary format, this
/// operation is equivalent to multiplying x1 by 2**x2.
/// </summary>
/// <param name="x1">
/// Input values.
/// </param>
/// <param name="x2">
/// Number of zeros to append to x1. Has to be non-negative.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Return x1 with bits shifted x2 times to the left.<br></br>
///
/// This is a scalar if both x1 and x2 are scalars.
/// </returns>
public NDarray<int> left_shift(NDarray<int> x1, NDarray<int> x2, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x1,
x2,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("left_shift", pyargs, kwargs);
return ToCsharp<NDarray<int>>(py);
}
/// <summary>
/// Shift the bits of an integer to the right.<br></br>
///
/// Bits are shifted to the right x2. Because the internal
/// representation of numbers is in binary format, this operation is
/// equivalent to dividing x1 by 2**x2.
/// </summary>
/// <param name="x1">
/// Input values.
/// </param>
/// <param name="x2">
/// Number of bits to remove at the right of x1.
/// </param>
/// <param name="out">
/// A location into which the result is stored.<br></br>
/// If provided, it must have
/// a shape that the inputs broadcast to.<br></br>
/// If not provided or None,
/// a freshly-allocated array is returned.<br></br>
/// A tuple (possible only as a
/// keyword argument) must have length equal to the number of outputs.
/// </param>
/// <param name="where">
/// Values of True indicate to calculate the ufunc at that position, values
/// of False indicate to leave the value in the output alone.
/// </param>
/// <returns>
/// Return x1 with bits shifted x2 times to the right.<br></br>
///
/// This is a scalar if both x1 and x2 are scalars.
/// </returns>
public NDarray right_shift(NDarray x1, NDarray x2, NDarray @out = null, NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
x1,
x2,
});
var kwargs=new PyDict();
if (@out!=null) kwargs["out"]=ToPython(@out);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("right_shift", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Packs the elements of a binary-valued array into bits in a uint8 array.<br></br>
///
/// The result is padded to full bytes by inserting zero bits at the end.
/// </summary>
/// <param name="myarray">
/// An array of integers or booleans whose elements should be packed to
/// bits.
/// </param>
/// <param name="axis">
/// The dimension over which bit-packing is done.<br></br>
///
/// None implies packing the flattened array.
/// </param>
/// <returns>
/// Array of type uint8 whose elements represent bits corresponding to the
/// logical (0 or nonzero) value of the input elements.<br></br>
/// The shape of
/// packed has the same number of dimensions as the input (unless axis
/// is None, in which case the output is 1-D).
/// </returns>
public NDarray packbits(NDarray myarray, int? axis = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
myarray,
});
var kwargs=new PyDict();
if (axis!=null) kwargs["axis"]=ToPython(axis);
dynamic py = __self__.InvokeMethod("packbits", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Unpacks elements of a uint8 array into a binary-valued output array.<br></br>
///
/// Each element of myarray represents a bit-field that should be unpacked
/// into a binary-valued output array.<br></br>
/// The shape of the output array is either
/// 1-D (if axis is None) or the same shape as the input array with unpacking
/// done along the axis specified.
/// </summary>
/// <param name="myarray">
/// Input array.
/// </param>
/// <param name="axis">
/// The dimension over which bit-unpacking is done.<br></br>
///
/// None implies unpacking the flattened array.
/// </param>
/// <returns>
/// The elements are binary-valued (0 or 1).
/// </returns>
public NDarray unpackbits(NDarray myarray, int? axis = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
myarray,
});
var kwargs=new PyDict();
if (axis!=null) kwargs["axis"]=ToPython(axis);
dynamic py = __self__.InvokeMethod("unpackbits", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the binary representation of the input number as a string.<br></br>
///
/// For negative numbers, if width is not given, a minus sign is added to the
/// front.<br></br>
/// If width is given, the two’s complement of the number is
/// returned, with respect to that width.<br></br>
///
/// In a two’s-complement system negative numbers are represented by the two’s
/// complement of the absolute value.<br></br>
/// This is the most common method of
/// representing signed integers on computers [1].<br></br>
/// A N-bit two’s-complement
/// system can represent every integer in the range
/// to .
///
/// Notes
///
/// binary_repr is equivalent to using base_repr with base 2, but about 25x
/// faster.<br></br>
///
/// References
/// </summary>
/// <param name="num">
/// Only an integer decimal number can be used.
/// </param>
/// <param name="width">
/// The length of the returned string if num is positive, or the length
/// of the two’s complement if num is negative, provided that width is
/// at least a sufficient number of bits for num to be represented in the
/// designated form.<br></br>
///
/// If the width value is insufficient, it will be ignored, and num will
/// be returned in binary (num > 0) or two’s complement (num < 0) form
/// with its width equal to the minimum number of bits needed to represent
/// the number in the designated form.<br></br>
/// This behavior is deprecated and will
/// later raise an error.
/// </param>
/// <returns>
/// Binary representation of num or two’s complement of num.
/// </returns>
public string binary_repr(int num, int? width = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
num,
});
var kwargs=new PyDict();
if (width!=null) kwargs["width"]=ToPython(width);
dynamic py = __self__.InvokeMethod("binary_repr", pyargs, kwargs);
return ToCsharp<string>(py);
}
}
}