-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathNDarray.gen.cs
More file actions
460 lines (444 loc) · 18.1 KB
/
Copy pathNDarray.gen.cs
File metadata and controls
460 lines (444 loc) · 18.1 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
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp)
// 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;
#if PYTHON_INCLUDED
using Python.Included;
#endif
namespace Numpy
{
public partial class NDarray
{
/// <summary>
/// Copy an element of an array to a standard Python scalar and return it.<br></br>
///
/// Notes
///
/// When the data type of a is longdouble or clongdouble, item() returns
/// a scalar array object because there is no available Python scalar that
/// would not lose information.<br></br>
/// Void arrays return a buffer object for item(),
/// unless fields are defined, in which case a tuple is returned.<br></br>
///
/// item is very similar to a[args], except, instead of an array scalar,
/// a standard Python scalar is returned.<br></br>
/// This can be useful for speeding up
/// access to elements of the array and doing arithmetic on elements of the
/// array using Python’s optimized math.
/// </summary>
/// <returns>
/// A copy of the specified element of the array as a suitable
/// Python scalar
/// </returns>
public T item<T>(params int[] args)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
args,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("item", pyargs, kwargs);
return ToCsharp<T>(py);
}
/*
/// <summary>
/// Return the array as a (possibly nested) list.<br></br>
///
/// Return a copy of the array data as a (nested) Python list.<br></br>
///
/// Data items are converted to the nearest compatible Python type.<br></br>
///
/// Notes
///
/// The array may be recreated, a = np.array(a.tolist()).
/// </summary>
/// <returns>
/// The possibly nested list of array elements.
/// </returns>
public List<T> tolist<T>()
{
//auto-generated code, do not change
var __self__=self;
dynamic py = __self__.InvokeMethod("tolist");
return ToCsharp<List<T>>(py);
}
*/
/// <summary>
/// Write array to a file as text or binary (default).<br></br>
///
/// Data is always written in ‘C’ order, independent of the order of a.<br></br>
///
/// The data produced by this method can be recovered using the function
/// fromfile().<br></br>
///
/// Notes
///
/// This is a convenience function for quick storage of array data.<br></br>
///
/// Information on endianness and precision is lost, so this method is not a
/// good choice for files intended to archive data or transport data between
/// machines with different endianness.<br></br>
/// Some of these problems can be overcome
/// by outputting the data as text files, at the expense of speed and file
/// size.<br></br>
///
/// When fid is a file object, array contents are directly written to the
/// file, bypassing the file object’s write method.<br></br>
/// As a result, tofile
/// cannot be used with files objects supporting compression (e.g., GzipFile)
/// or file-like objects that do not support fileno() (e.g., BytesIO).
/// </summary>
/// <param name="fid">
/// An open file object, or a string containing a filename.
/// </param>
/// <param name="sep">
/// Separator between array items for text output.<br></br>
///
/// If “” (empty), a binary file is written, equivalent to
/// file.write(a.tobytes()).
/// </param>
/// <param name="format">
/// Format string for text file output.<br></br>
///
/// Each entry in the array is formatted to text by first converting
/// it to the closest Python type, and then using “format” % item.
/// </param>
public void tofile(string fid, string sep, string format)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
fid,
sep,
format,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("tofile", pyargs, kwargs);
}
/// <summary>
/// Dump a pickle of the array to the specified file.<br></br>
///
/// The array can be read back with pickle.load or numpy.load.
/// </summary>
/// <param name="file">
/// A string naming the dump file.
/// </param>
public void dump(string file)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
file,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("dump", pyargs, kwargs);
}
/// <summary>
/// Returns the pickle of the array as a string.<br></br>
///
/// pickle.loads or numpy.loads will convert the string back to an array.
/// </summary>
public void dumps()
{
//auto-generated code, do not change
var __self__=self;
dynamic py = __self__.InvokeMethod("dumps");
}
/// <summary>
/// Copy of the array, cast to a specified type.<br></br>
///
/// Notes
///
/// Starting in NumPy 1.9, astype method now returns an error if the string
/// dtype to cast to is not long enough in ‘safe’ casting mode to hold the max
/// value of integer/float array that is being casted.<br></br>
/// Previously the casting
/// was allowed even if the result was truncated.
/// </summary>
/// <param name="dtype">
/// Typecode or data-type to which the array is cast.
/// </param>
/// <param name="order">
/// Controls the memory layout order of the result.<br></br>
///
/// ‘C’ means C order, ‘F’ means Fortran order, ‘A’
/// means ‘F’ order if all the arrays are Fortran contiguous,
/// ‘C’ order otherwise, and ‘K’ means as close to the
/// order the array elements appear in memory as possible.<br></br>
///
/// Default is ‘K’.
/// </param>
/// <param name="casting">
/// Controls what kind of data casting may occur.<br></br>
/// Defaults to ‘unsafe’
/// for backwards compatibility.
/// </param>
/// <param name="subok">
/// If True, then sub-classes will be passed-through (default), otherwise
/// the returned array will be forced to be a base-class array.
/// </param>
/// <param name="copy">
/// By default, astype always returns a newly allocated array.<br></br>
/// If this
/// is set to false, and the dtype, order, and subok
/// requirements are satisfied, the input array is returned instead
/// of a copy.
/// </param>
/// <returns>
/// Unless copy is False and the other conditions for returning the input
/// array are satisfied (see description for copy input parameter), arr_t
/// is a new array of the same shape as the input array, with dtype, order
/// given by dtype, order.
/// </returns>
public NDarray astype(Dtype dtype, string order = null, string casting = null, bool? subok = null, bool? copy = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dtype,
});
var kwargs=new PyDict();
if (order!=null) kwargs["order"]=ToPython(order);
if (casting!=null) kwargs["casting"]=ToPython(casting);
if (subok!=null) kwargs["subok"]=ToPython(subok);
if (copy!=null) kwargs["copy"]=ToPython(copy);
dynamic py = __self__.InvokeMethod("astype", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Swap the bytes of the array elements
///
/// Toggle between low-endian and big-endian data representation by
/// returning a byteswapped array, optionally swapped in-place.
/// </summary>
/// <param name="inplace">
/// If True, swap bytes in-place, default is False.
/// </param>
/// <returns>
/// The byteswapped array.<br></br>
/// If inplace is True, this is
/// a view to self.
/// </returns>
public NDarray byteswap(bool? inplace = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (inplace!=null) kwargs["inplace"]=ToPython(inplace);
dynamic py = __self__.InvokeMethod("byteswap", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return a copy of the array.
/// </summary>
/// <param name="order">
/// Controls the memory layout of the copy.<br></br>
/// ‘C’ means C-order,
/// ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous,
/// ‘C’ otherwise.<br></br>
/// ‘K’ means match the layout of a as closely
/// as possible.<br></br>
/// (Note that this function and numpy.copy are very
/// similar, but have different default values for their order=
/// arguments.)
/// </param>
public NDarray copy(string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("copy", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Returns a field of the given array as a certain type.<br></br>
///
/// A field is a view of the array data with a given data-type.<br></br>
/// The values in
/// the view are determined by the given type and the offset into the current
/// array in bytes.<br></br>
/// The offset needs to be such that the view dtype fits in the
/// array dtype; for example an array of dtype complex128 has 16-byte elements.<br></br>
///
/// If taking a view with a 32-bit integer (4 bytes), the offset needs to be
/// between 0 and 12 bytes.
/// </summary>
/// <param name="dtype">
/// The data type of the view.<br></br>
/// The dtype size of the view can not be larger
/// than that of the array itself.
/// </param>
/// <param name="offset">
/// Number of bytes to skip before beginning the element view.
/// </param>
public void getfield(Dtype dtype, int offset)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dtype,
offset,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("getfield", pyargs, kwargs);
}
/// <summary>
/// Set array flags WRITEABLE, ALIGNED, (WRITEBACKIFCOPY and UPDATEIFCOPY),
/// respectively.<br></br>
///
/// These Boolean-valued flags affect how numpy interprets the memory
/// area used by a (see Notes below).<br></br>
/// The ALIGNED flag can only
/// be set to True if the data is actually aligned according to the type.<br></br>
///
/// The WRITEBACKIFCOPY and (deprecated) UPDATEIFCOPY flags can never be set
/// to True.<br></br>
/// The flag WRITEABLE can only be set to True if the array owns its
/// own memory, or the ultimate owner of the memory exposes a writeable buffer
/// interface, or is a string.<br></br>
/// (The exception for string is made so that
/// unpickling can be done without copying memory.)
///
/// Notes
///
/// Array flags provide information about how the memory area used
/// for the array is to be interpreted.<br></br>
/// There are 7 Boolean flags
/// in use, only four of which can be changed by the user:
/// WRITEBACKIFCOPY, UPDATEIFCOPY, WRITEABLE, and ALIGNED.<br></br>
///
/// WRITEABLE (W) the data area can be written to;
///
/// ALIGNED (A) the data and strides are aligned appropriately for the hardware
/// (as determined by the compiler);
///
/// UPDATEIFCOPY (U) (deprecated), replaced by WRITEBACKIFCOPY;
///
/// WRITEBACKIFCOPY (X) this array is a copy of some other array (referenced
/// by .base).<br></br>
/// When the C-API function PyArray_ResolveWritebackIfCopy is
/// called, the base array will be updated with the contents of this array.<br></br>
///
/// All flags can be accessed using the single (upper case) letter as well
/// as the full name.
/// </summary>
/// <param name="write">
/// Describes whether or not a can be written to.
/// </param>
/// <param name="align">
/// Describes whether or not a is aligned properly for its type.
/// </param>
/// <param name="uic">
/// Describes whether or not a is a copy of another “base” array.
/// </param>
public void setflags(bool? write = null, bool? align = null, bool? uic = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (write!=null) kwargs["write"]=ToPython(write);
if (align!=null) kwargs["align"]=ToPython(align);
if (uic!=null) kwargs["uic"]=ToPython(uic);
dynamic py = __self__.InvokeMethod("setflags", pyargs, kwargs);
}
/// <summary>
/// Fill the array with a scalar value.
/// </summary>
/// <param name="value">
/// All elements of a will be assigned this value.
/// </param>
public void fill(ValueType @value)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
@value,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("fill", pyargs, kwargs);
}
/// <summary>
/// Return a copy of the array collapsed into one dimension.
/// </summary>
/// <param name="order">
/// ‘C’ means to flatten in row-major (C-style) order.<br></br>
///
/// ‘F’ means to flatten in column-major (Fortran-
/// style) order.<br></br>
/// ‘A’ means to flatten in column-major
/// order if a is Fortran contiguous in memory,
/// row-major order otherwise.<br></br>
/// ‘K’ means to flatten
/// a in the order the elements occur in memory.<br></br>
///
/// The default is ‘C’.
/// </param>
/// <returns>
/// A copy of the input array, flattened to one dimension.
/// </returns>
public NDarray flatten(string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("flatten", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// For unpickling.<br></br>
///
/// The state argument must be a sequence that contains the following
/// elements:
/// </summary>
/// <param name="version">
/// optional pickle version.<br></br>
/// If omitted defaults to 0.
/// </param>
/// <param name="rawdata">
/// a binary string with the data (or a list if ‘a’ is an object array)
/// </param>
public void __setstate__(int version, Shape shape, Dtype dtype, bool isFortran, string rawdata)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
version,
shape,
dtype,
isFortran,
rawdata,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("__setstate__", pyargs, kwargs);
}
}
}