forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnp.array_manipulation.gen.cs
More file actions
1664 lines (1619 loc) · 64.9 KB
/
np.array_manipulation.gen.cs
File metadata and controls
1664 lines (1619 loc) · 64.9 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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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 static partial class np
{
/// <summary>
/// Copies values from one array to another, broadcasting as necessary.<br></br>
///
/// Raises a TypeError if the casting rule is violated, and if
/// where is provided, it selects which elements to copy.
/// </summary>
/// <param name="dst">
/// The array into which values are copied.
/// </param>
/// <param name="src">
/// The array from which values are copied.
/// </param>
/// <param name="casting">
/// Controls what kind of data casting may occur when copying.
/// </param>
/// <param name="where">
/// A boolean array which is broadcasted to match the dimensions
/// of dst, and selects elements to copy from src to dst
/// wherever it contains the value True.
/// </param>
public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", NDarray @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dst,
src,
});
var kwargs=new PyDict();
if (casting!="same_kind") kwargs["casting"]=ToPython(casting);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("copyto", pyargs, kwargs);
}
/// <summary>
/// Copies values from one array to another, broadcasting as necessary.<br></br>
///
/// Raises a TypeError if the casting rule is violated, and if
/// where is provided, it selects which elements to copy.
/// </summary>
/// <param name="dst">
/// The array into which values are copied.
/// </param>
/// <param name="src">
/// The array from which values are copied.
/// </param>
/// <param name="casting">
/// Controls what kind of data casting may occur when copying.
/// </param>
/// <param name="where">
/// A boolean array which is broadcasted to match the dimensions
/// of dst, and selects elements to copy from src to dst
/// wherever it contains the value True.
/// </param>
public static void copyto(NDarray dst, NDarray src, string casting = "same_kind", bool[] @where = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
dst,
src,
});
var kwargs=new PyDict();
if (casting!="same_kind") kwargs["casting"]=ToPython(casting);
if (@where!=null) kwargs["where"]=ToPython(@where);
dynamic py = __self__.InvokeMethod("copyto", pyargs, kwargs);
}
/// <summary>
/// Gives a new shape to an array without changing its data.<br></br>
///
/// Notes
///
/// It is not always possible to change the shape of an array without
/// copying the data.<br></br>
/// If you want an error to be raised when the data is copied,
/// you should assign the new shape to the shape attribute of the array:
///
/// The order keyword gives the index ordering both for fetching the values
/// from a, and then placing the values into the output array.<br></br>
///
/// For example, let’s say you have an array:
///
/// You can think of reshaping as first raveling the array (using the given
/// index order), then inserting the elements from the raveled array into the
/// new array using the same kind of index ordering as was used for the
/// raveling.
/// </summary>
/// <param name="a">
/// Array to be reshaped.
/// </param>
/// <param name="newshape">
/// The new shape should be compatible with the original shape.<br></br>
/// If
/// an integer, then the result will be a 1-D array of that length.<br></br>
///
/// One shape dimension can be -1. In this case, the value is
/// inferred from the length of the array and remaining dimensions.
/// </param>
/// <param name="order">
/// Read the elements of a using this index order, and place the
/// elements into the reshaped array using this index order.<br></br>
/// ‘C’
/// means to read / write the elements using C-like index order,
/// with the last axis index changing fastest, back to the first
/// axis index changing slowest.<br></br>
/// ‘F’ means to read / write the
/// elements using Fortran-like index order, with the first index
/// changing fastest, and the last index changing slowest.<br></br>
/// Note that
/// the ‘C’ and ‘F’ options take no account of the memory layout of
/// the underlying array, and only refer to the order of indexing.<br></br>
///
/// ‘A’ means to read / write the elements in Fortran-like index
/// order if a is Fortran contiguous in memory, C-like order
/// otherwise.
/// </param>
/// <returns>
/// This will be a new view object if possible; otherwise, it will
/// be a copy.<br></br>
/// Note there is no guarantee of the memory layout (C- or
/// Fortran- contiguous) of the returned array.
/// </returns>
public static NDarray reshape(NDarray a, Shape newshape, string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
newshape,
});
var kwargs=new PyDict();
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("reshape", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return a contiguous flattened array.<br></br>
///
/// A 1-D array, containing the elements of the input, is returned.<br></br>
/// A copy is
/// made only if needed.<br></br>
///
/// As of NumPy 1.10, the returned array will have the same type as the input
/// array.<br></br>
/// (for example, a masked array will be returned for a masked array
/// input)
///
/// Notes
///
/// In row-major, C-style order, in two dimensions, the row index
/// varies the slowest, and the column index the quickest.<br></br>
/// This can
/// be generalized to multiple dimensions, where row-major order
/// implies that the index along the first axis varies slowest, and
/// the index along the last quickest.<br></br>
/// The opposite holds for
/// column-major, Fortran-style index ordering.<br></br>
///
/// When a view is desired in as many cases as possible, arr.reshape(-1)
/// may be preferable.
/// </summary>
/// <param name="a">
/// Input array.<br></br>
/// The elements in a are read in the order specified by
/// order, and packed as a 1-D array.
/// </param>
/// <param name="order">
/// The elements of a are read using this index order.<br></br>
/// ‘C’ means
/// to index the elements in row-major, C-style order,
/// with the last axis index changing fastest, back to the first
/// axis index changing slowest.<br></br>
/// ‘F’ means to index the elements
/// in column-major, Fortran-style order, with the
/// first index changing fastest, and the last index changing
/// slowest.<br></br>
/// Note that the ‘C’ and ‘F’ options take no account of
/// the memory layout of the underlying array, and only refer to
/// the order of axis indexing.<br></br>
/// ‘A’ means to read the elements in
/// Fortran-like index order if a is Fortran contiguous in
/// memory, C-like order otherwise.<br></br>
/// ‘K’ means to read the
/// elements in the order they occur in memory, except for
/// reversing the data when strides are negative.<br></br>
/// By default, ‘C’
/// index order is used.
/// </param>
/// <returns>
/// y is an array of the same subtype as a, with shape (a.size,).<br></br>
///
/// Note that matrices are special cased for backward compatibility, if a
/// is a matrix, then y is a 1-D ndarray.
/// </returns>
public static NDarray ravel(NDarray a, string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("ravel", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <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 static 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>
/// Move axes of an array to new positions.<br></br>
///
/// Other axes remain in their original order.
/// </summary>
/// <param name="a">
/// The array whose axes should be reordered.
/// </param>
/// <param name="source">
/// Original positions of the axes to move.<br></br>
/// These must be unique.
/// </param>
/// <param name="destination">
/// Destination positions for each of the original axes.<br></br>
/// These must also be
/// unique.
/// </param>
/// <returns>
/// Array with moved axes.<br></br>
/// This array is a view of the input array.
/// </returns>
public static NDarray moveaxis(NDarray a, int[] source, int[] destination)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
source,
destination,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("moveaxis", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Roll the specified axis backwards, until it lies in a given position.<br></br>
///
/// This function continues to be supported for backward compatibility, but you
/// should prefer moveaxis.<br></br>
/// The moveaxis function was added in NumPy
/// 1.11.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axis">
/// The axis to roll backwards.<br></br>
/// The positions of the other axes do not
/// change relative to one another.
/// </param>
/// <param name="start">
/// The axis is rolled until it lies before this position.<br></br>
/// The default,
/// 0, results in a “complete” roll.
/// </param>
/// <returns>
/// For NumPy >= 1.10.0 a view of a is always returned.<br></br>
/// For earlier
/// NumPy versions a view of a is returned only if the order of the
/// axes is changed, otherwise the input array is returned.
/// </returns>
public static NDarray rollaxis(NDarray a, int axis, int? start = 0)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
axis,
});
var kwargs=new PyDict();
if (start!=0) kwargs["start"]=ToPython(start);
dynamic py = __self__.InvokeMethod("rollaxis", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Interchange two axes of an array.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axis1">
/// First axis.
/// </param>
/// <param name="axis2">
/// Second axis.
/// </param>
/// <returns>
/// For NumPy >= 1.10.0, if a is an ndarray, then a view of a is
/// returned; otherwise a new array is created.<br></br>
/// For earlier NumPy
/// versions a view of a is returned only if the order of the
/// axes is changed, otherwise the input array is returned.
/// </returns>
public static NDarray swapaxes(NDarray a, int axis1, int axis2)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
axis1,
axis2,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("swapaxes", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Permute the dimensions of an array.<br></br>
///
/// Notes
///
/// Use transpose(a, argsort(axes)) to invert the transposition of tensors
/// when using the axes keyword argument.<br></br>
///
/// Transposing a 1-D array returns an unchanged view of the original array.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axes">
/// By default, reverse the dimensions, otherwise permute the axes
/// according to the values given.
/// </param>
/// <returns>
/// a with its axes permuted.<br></br>
/// A view is returned whenever
/// possible.
/// </returns>
public static NDarray transpose(NDarray a, int[] axes = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (axes!=null) kwargs["axes"]=ToPython(axes);
dynamic py = __self__.InvokeMethod("transpose", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Permute the dimensions of an array.<br></br>
///
/// Notes
///
/// Use transpose(a, argsort(axes)) to invert the transposition of tensors
/// when using the axes keyword argument.<br></br>
///
/// Transposing a 1-D array returns an unchanged view of the original array.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axes">
/// By default, reverse the dimensions, otherwise permute the axes
/// according to the values given.
/// </param>
/// <returns>
/// a with its axes permuted.<br></br>
/// A view is returned whenever
/// possible.
/// </returns>
public static NDarray transpose(NDarray[] a, int[] axes = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (axes!=null) kwargs["axes"]=ToPython(axes);
dynamic py = __self__.InvokeMethod("transpose", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Convert inputs to arrays with at least one dimension.<br></br>
///
/// Scalar inputs are converted to 1-dimensional arrays, whilst
/// higher-dimensional inputs are preserved.
/// </summary>
/// <param name="arys">
/// One or more input arrays.
/// </param>
/// <returns>
/// An array, or list of arrays, each with a.ndim >= 1.<br></br>
///
/// Copies are made only if necessary.
/// </returns>
public static NDarray atleast_1d(params NDarray[] arys)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arys,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("atleast_1d", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// View inputs as arrays with at least two dimensions.
/// </summary>
/// <param name="arys">
/// One or more array-like sequences.<br></br>
/// Non-array inputs are converted
/// to arrays.<br></br>
/// Arrays that already have two or more dimensions are
/// preserved.
/// </param>
/// <returns>
/// An array, or list of arrays, each with a.ndim >= 2.<br></br>
///
/// Copies are avoided where possible, and views with two or more
/// dimensions are returned.
/// </returns>
public static NDarray atleast_2d(params NDarray[] arys)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arys,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("atleast_2d", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// View inputs as arrays with at least three dimensions.
/// </summary>
/// <param name="arys">
/// One or more array-like sequences.<br></br>
/// Non-array inputs are converted to
/// arrays.<br></br>
/// Arrays that already have three or more dimensions are
/// preserved.
/// </param>
/// <returns>
/// An array, or list of arrays, each with a.ndim >= 3.<br></br>
/// Copies are
/// avoided where possible, and views with three or more dimensions are
/// returned.<br></br>
/// For example, a 1-D array of shape (N,) becomes a view
/// of shape (1, N, 1), and a 2-D array of shape (M, N) becomes a
/// view of shape (M, N, 1).
/// </returns>
public static NDarray atleast_3d(params NDarray[] arys)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arys,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("atleast_3d", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Produce an object that mimics broadcasting.
/// </summary>
/// <param name="in2">
/// Input parameters.
/// </param>
/// <param name="in1">
/// Input parameters.
/// </param>
/// <returns>
/// Broadcast the input parameters against one another, and
/// return an object that encapsulates the result.<br></br>
///
/// Amongst others, it has shape and nd properties, and
/// may be used as an iterator.
/// </returns>
public static NDarray broadcast(NDarray in2, NDarray in1)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
in2,
in1,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("broadcast", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Broadcast an array to a new shape.<br></br>
///
/// Notes
/// </summary>
/// <param name="array">
/// The array to broadcast.
/// </param>
/// <param name="shape">
/// The shape of the desired array.
/// </param>
/// <param name="subok">
/// If True, then sub-classes will be passed-through, otherwise
/// the returned array will be forced to be a base-class array (default).
/// </param>
/// <returns>
/// A readonly view on the original array with the given shape.<br></br>
/// It is
/// typically not contiguous.<br></br>
/// Furthermore, more than one element of a
/// broadcasted array may refer to a single memory location.
/// </returns>
public static NDarray broadcast_to(NDarray array, Shape shape, bool? subok = false)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
array,
shape,
});
var kwargs=new PyDict();
if (subok!=false) kwargs["subok"]=ToPython(subok);
dynamic py = __self__.InvokeMethod("broadcast_to", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Broadcast any number of arrays against each other.
/// </summary>
/// <param name="args">
/// The arrays to broadcast.
/// </param>
/// <param name="subok">
/// If True, then sub-classes will be passed-through, otherwise
/// the returned arrays will be forced to be a base-class array (default).
/// </param>
/// <returns>
/// These arrays are views on the original arrays.<br></br>
/// They are typically
/// not contiguous.<br></br>
/// Furthermore, more than one element of a
/// broadcasted array may refer to a single memory location.<br></br>
/// If you
/// need to write to the arrays, make copies first.
/// </returns>
public static NDarray[] broadcast_arrays(NDarray[] args, bool? subok = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
args,
});
var kwargs=new PyDict();
if (subok!=null) kwargs["subok"]=ToPython(subok);
dynamic py = __self__.InvokeMethod("broadcast_arrays", pyargs, kwargs);
return ToCsharp<NDarray[]>(py);
}
/// <summary>
/// Expand the shape of an array.<br></br>
///
/// Insert a new axis that will appear at the axis position in the expanded
/// array shape.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axis">
/// Position in the expanded axes where the new axis is placed.
/// </param>
/// <returns>
/// Output array.<br></br>
/// The number of dimensions is one greater than that of
/// the input array.
/// </returns>
public static NDarray expand_dims(NDarray a, int axis)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
axis,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("expand_dims", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Remove single-dimensional entries from the shape of an array.
/// </summary>
/// <param name="a">
/// Input data.
/// </param>
/// <param name="axis">
/// Selects a subset of the single-dimensional entries in the
/// shape.<br></br>
/// If an axis is selected with shape entry greater than
/// one, an error is raised.
/// </param>
/// <returns>
/// The input array, but with all or a subset of the
/// dimensions of length 1 removed.<br></br>
/// This is always a itself
/// or a view into a.
/// </returns>
public static NDarray squeeze(NDarray a, Axis axis = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (axis!=null) kwargs["axis"]=ToPython(axis);
dynamic py = __self__.InvokeMethod("squeeze", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return an array converted to a float type.
/// </summary>
/// <param name="a">
/// The input array.
/// </param>
/// <param name="dtype">
/// Float type code to coerce input array a.<br></br>
/// If dtype is one of the
/// ‘int’ dtypes, it is replaced with float64.
/// </param>
/// <returns>
/// The input a as a float ndarray.
/// </returns>
public static NDarray asfarray(NDarray a, Dtype dtype = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (dtype!=null) kwargs["dtype"]=ToPython(dtype);
dynamic py = __self__.InvokeMethod("asfarray", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return an array (ndim >= 1) laid out in Fortran order in memory.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="dtype">
/// By default, the data-type is inferred from the input data.
/// </param>
/// <returns>
/// The input a in Fortran, or column-major, order.
/// </returns>
public static NDarray asfortranarray(NDarray a, Dtype dtype = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (dtype!=null) kwargs["dtype"]=ToPython(dtype);
dynamic py = __self__.InvokeMethod("asfortranarray", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Convert the input to an array, checking for NaNs or Infs.
/// </summary>
/// <param name="a">
/// Input data, in any form that can be converted to an array.<br></br>
/// This
/// includes lists, lists of tuples, tuples, tuples of tuples, tuples
/// of lists and ndarrays.<br></br>
/// Success requires no NaNs or Infs.
/// </param>
/// <param name="dtype">
/// By default, the data-type is inferred from the input data.
/// </param>
/// <param name="order">
/// Whether to use row-major (C-style) or
/// column-major (Fortran-style) memory representation.<br></br>
///
/// Defaults to ‘C’.
/// </param>
/// <returns>
/// Array interpretation of a.<br></br>
/// No copy is performed if the input
/// is already an ndarray.<br></br>
/// If a is a subclass of ndarray, a base
/// class ndarray is returned.
/// </returns>
public static NDarray asarray_chkfinite(NDarray a, Dtype dtype = null, string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (dtype!=null) kwargs["dtype"]=ToPython(dtype);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("asarray_chkfinite", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return an ndarray of the provided type that satisfies requirements.<br></br>
///
/// This function is useful to be sure that an array with the correct flags
/// is returned for passing to compiled code (perhaps through ctypes).<br></br>
///
/// Notes
///
/// The returned array will be guaranteed to have the listed requirements
/// by making a copy if needed.
/// </summary>
/// <param name="a">
/// The object to be converted to a type-and-requirement-satisfying array.
/// </param>
/// <param name="dtype">
/// The required data-type.<br></br>
/// If None preserve the current dtype.<br></br>
/// If your
/// application requires the data to be in native byteorder, include
/// a byteorder specification as a part of the dtype specification.
/// </param>
/// <param name="requirements">
/// The requirements list can be any of the following
/// </param>
public static NDarray require(NDarray a, Dtype dtype, string[] requirements = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
dtype,
});
var kwargs=new PyDict();
if (requirements!=null) kwargs["requirements"]=ToPython(requirements);
dynamic py = __self__.InvokeMethod("require", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Join a sequence of arrays along an existing axis.<br></br>
///
/// Notes
///
/// When one or more of the arrays to be concatenated is a MaskedArray,
/// this function will return a MaskedArray object instead of an ndarray,
/// but the input masks are not preserved.<br></br>
/// In cases where a MaskedArray
/// is expected as input, use the ma.concatenate function from the masked
/// array module instead.
/// </summary>
/// <param name="arys">
/// The arrays must have the same shape, except in the dimension
/// corresponding to axis (the first, by default).
/// </param>
/// <param name="axis">
/// The axis along which the arrays will be joined.<br></br>
/// If axis is None,
/// arrays are flattened before use.<br></br>
/// Default is 0.
/// </param>
/// <param name="out">
/// If provided, the destination to place the result.<br></br>
/// The shape must be
/// correct, matching that of what concatenate would have returned if no
/// out argument were specified.
/// </param>
/// <returns>
/// The concatenated array.
/// </returns>
public static NDarray concatenate(NDarray[] arys, int? axis = 0, NDarray @out = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arys,
});
var kwargs=new PyDict();
if (axis!=0) kwargs["axis"]=ToPython(axis);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("concatenate", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Join a sequence of arrays along a new axis.<br></br>
///
/// The axis parameter specifies the index of the new axis in the dimensions
/// of the result.<br></br>
/// For example, if axis=0 it will be the first dimension
/// and if axis=-1 it will be the last dimension.
/// </summary>
/// <param name="arrays">
/// Each array must have the same shape.
/// </param>
/// <param name="axis">
/// The axis in the result array along which the input arrays are stacked.
/// </param>
/// <param name="out">
/// If provided, the destination to place the result.<br></br>
/// The shape must be
/// correct, matching that of what stack would have returned if no
/// out argument were specified.
/// </param>
/// <returns>
/// The stacked array has one more dimension than the input arrays.
/// </returns>
public static NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
arrays,
});
var kwargs=new PyDict();
if (axis!=0) kwargs["axis"]=ToPython(axis);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("stack", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Stack arrays in sequence depth wise (along third axis).<br></br>
///
/// This is equivalent to concatenation along the third axis after 2-D arrays
/// of shape (M,N) have been reshaped to (M,N,1) and 1-D arrays of shape
/// (N,) have been reshaped to (1,N,1).<br></br>
/// Rebuilds arrays divided by
/// dsplit.<br></br>
///
/// This function makes most sense for arrays with up to 3 dimensions.<br></br>
/// For
/// instance, for pixel-data with a height (first axis), width (second axis),
/// and r/g/b channels (third axis).<br></br>
/// The functions concatenate, stack and
/// block provide more general stacking and concatenation operations.
/// </summary>
/// <param name="tup">
/// The arrays must have the same shape along all but the third axis.<br></br>
///
/// 1-D or 2-D arrays must have the same shape.
/// </param>
/// <returns>
/// The array formed by stacking the given arrays, will be at least 3-D.
/// </returns>
public static NDarray dstack(params NDarray[] tup)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
tup,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("dstack", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Stack arrays in sequence horizontally (column wise).<br></br>
///
/// This is equivalent to concatenation along the second axis, except for 1-D
/// arrays where it concatenates along the first axis.<br></br>
/// Rebuilds arrays divided
/// by hsplit.<br></br>
///
/// This function makes most sense for arrays with up to 3 dimensions.<br></br>
/// For
/// instance, for pixel-data with a height (first axis), width (second axis),
/// and r/g/b channels (third axis).<br></br>
/// The functions concatenate, stack and
/// block provide more general stacking and concatenation operations.
/// </summary>
/// <param name="tup">
/// The arrays must have the same shape along all but the second axis,
/// except 1-D arrays which can be any length.
/// </param>
/// <returns>
/// The array formed by stacking the given arrays.
/// </returns>
public static NDarray hstack(params NDarray[] tup)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
tup,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("hstack", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Stack arrays in sequence vertically (row wise).<br></br>
///
/// This is equivalent to concatenation along the first axis after 1-D arrays
/// of shape (N,) have been reshaped to (1,N).<br></br>
/// Rebuilds arrays divided by
/// vsplit.<br></br>
///
/// This function makes most sense for arrays with up to 3 dimensions.<br></br>