forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNumPy.sorting.gen.cs
More file actions
821 lines (800 loc) · 32.7 KB
/
NumPy.sorting.gen.cs
File metadata and controls
821 lines (800 loc) · 32.7 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
// 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>
/// Return a sorted copy of an array.<br></br>
///
/// Notes
///
/// The various sorting algorithms are characterized by their average speed,
/// worst case performance, work space size, and whether they are stable.<br></br>
/// A
/// stable sort keeps items with the same key in the same relative
/// order.<br></br>
/// The three available algorithms have the following
/// properties:
///
/// All the sort algorithms make temporary copies of the data when
/// sorting along any but the last axis.<br></br>
/// Consequently, sorting along
/// the last axis is faster and uses less space than sorting along
/// any other axis.<br></br>
///
/// The sort order for complex numbers is lexicographic.<br></br>
/// If both the real
/// and imaginary parts are non-nan then the order is determined by the
/// real parts except when they are equal, in which case the order is
/// determined by the imaginary parts.<br></br>
///
/// Previous to numpy 1.4.0 sorting real and complex arrays containing nan
/// values led to undefined behaviour.<br></br>
/// In numpy versions >= 1.4.0 nan
/// values are sorted to the end.<br></br>
/// The extended sort order is:
///
/// where R is a non-nan real value.<br></br>
/// Complex values with the same nan
/// placements are sorted according to the non-nan part if it exists.<br></br>
///
/// Non-nan values are sorted as before.<br></br>
///
/// quicksort has been changed to an introsort which will switch
/// heapsort when it does not make enough progress.<br></br>
/// This makes its
/// worst case O(n*log(n)).<br></br>
///
/// ‘stable’ automatically choses the best stable sorting algorithm
/// for the data type being sorted.<br></br>
/// It is currently mapped to
/// merge sort.
/// </summary>
/// <param name="a">
/// Array to be sorted.
/// </param>
/// <param name="axis">
/// Axis along which to sort.<br></br>
/// If None, the array is flattened before
/// sorting.<br></br>
/// The default is -1, which sorts along the last axis.
/// </param>
/// <param name="kind">
/// Sorting algorithm.<br></br>
/// Default is ‘quicksort’.
/// </param>
/// <param name="order">
/// When a is an array with fields defined, this argument specifies
/// which fields to compare first, second, etc.<br></br>
/// A single field can
/// be specified as a string, and not all fields need be specified,
/// but unspecified fields will still be used, in the order in which
/// they come up in the dtype, to break ties.
/// </param>
/// <returns>
/// Array of the same type and shape as a.
/// </returns>
public NDarray sort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
if (kind!="quicksort") kwargs["kind"]=ToPython(kind);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Perform an indirect stable sort using a sequence of keys.<br></br>
///
/// Given multiple sorting keys, which can be interpreted as columns in a
/// spreadsheet, lexsort returns an array of integer indices that describes
/// the sort order by multiple columns.<br></br>
/// The last key in the sequence is used
/// for the primary sort order, the second-to-last key for the secondary sort
/// order, and so on.<br></br>
/// The keys argument must be a sequence of objects that
/// can be converted to arrays of the same shape.<br></br>
/// If a 2D array is provided
/// for the keys argument, it’s rows are interpreted as the sorting keys and
/// sorting is according to the last row, second last row etc.
/// </summary>
/// <param name="keys">
/// The k different “columns” to be sorted.<br></br>
/// The last column (or row if
/// keys is a 2D array) is the primary sort key.
/// </param>
/// <param name="axis">
/// Axis to be indirectly sorted.<br></br>
/// By default, sort over the last axis.
/// </param>
/// <returns>
/// Array of indices that sort the keys along the specified axis.
/// </returns>
public NDarray lexsort(NDarray keys, int? axis = -1)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
keys,
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
dynamic py = __self__.InvokeMethod("lexsort", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Returns the indices that would sort an array.<br></br>
///
/// Perform an indirect sort along the given axis using the algorithm specified
/// by the kind keyword.<br></br>
/// It returns an array of indices of the same shape as
/// a that index data along the given axis in sorted order.<br></br>
///
/// Notes
///
/// See sort for notes on the different sorting algorithms.<br></br>
///
/// As of NumPy 1.4.0 argsort works with real/complex arrays containing
/// nan values.<br></br>
/// The enhanced sort order is documented in sort.
/// </summary>
/// <param name="a">
/// Array to sort.
/// </param>
/// <param name="axis">
/// Axis along which to sort.<br></br>
/// The default is -1 (the last axis).<br></br>
/// If None,
/// the flattened array is used.
/// </param>
/// <param name="kind">
/// Sorting algorithm.
/// </param>
/// <param name="order">
/// When a is an array with fields defined, this argument specifies
/// which fields to compare first, second, etc.<br></br>
/// A single field can
/// be specified as a string, and not all fields need be specified,
/// but unspecified fields will still be used, in the order in which
/// they come up in the dtype, to break ties.
/// </param>
/// <returns>
/// Array of indices that sort a along the specified axis.<br></br>
///
/// If a is one-dimensional, a[index_array] yields a sorted a.<br></br>
///
/// More generally, np.take_along_axis(a, index_array, axis=a) always
/// yields the sorted a, irrespective of dimensionality.
/// </returns>
public NDarray argsort(NDarray a, int? axis = -1, string kind = "quicksort", string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
if (kind!="quicksort") kwargs["kind"]=ToPython(kind);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("argsort", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Sort an array, in-place.<br></br>
///
/// Notes
///
/// See sort for notes on the different sorting algorithms.
/// </summary>
/// <param name="axis">
/// Axis along which to sort.<br></br>
/// Default is -1, which means sort along the
/// last axis.
/// </param>
/// <param name="kind">
/// Sorting algorithm.<br></br>
/// Default is ‘quicksort’.
/// </param>
/// <param name="order">
/// When a is an array with fields defined, this argument specifies
/// which fields to compare first, second, etc.<br></br>
/// A single field can
/// be specified as a string, and not all fields need be specified,
/// but unspecified fields will still be used, in the order in which
/// they come up in the dtype, to break ties.
/// </param>
public void sort(int? axis = -1, string kind = null, string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
if (kind!=null) kwargs["kind"]=ToPython(kind);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("sort", pyargs, kwargs);
}
/// <summary>
/// Return a copy of an array sorted along the first axis.<br></br>
///
/// Notes
///
/// np.msort(a) is equivalent to np.sort(a, axis=0).
/// </summary>
/// <param name="a">
/// Array to be sorted.
/// </param>
/// <returns>
/// Array of the same type and shape as a.
/// </returns>
public NDarray msort(NDarray a)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("msort", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Sort a complex array using the real part first, then the imaginary part.
/// </summary>
/// <param name="a">
/// Input array
/// </param>
/// <returns>
/// Always returns a sorted complex array.
/// </returns>
public NDarray sort_complex(NDarray a)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("sort_complex", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return a partitioned copy of an array.<br></br>
///
/// Creates a copy of the array with its elements rearranged in such a
/// way that the value of the element in k-th position is in the
/// position it would be in a sorted array.<br></br>
/// All elements smaller than
/// the k-th element are moved before this element and all equal or
/// greater are moved behind it.<br></br>
/// The ordering of the elements in the two
/// partitions is undefined.<br></br>
///
/// Notes
///
/// The various selection algorithms are characterized by their average
/// speed, worst case performance, work space size, and whether they are
/// stable.<br></br>
/// A stable sort keeps items with the same key in the same
/// relative order.<br></br>
/// The available algorithms have the following
/// properties:
///
/// All the partition algorithms make temporary copies of the data when
/// partitioning along any but the last axis.<br></br>
/// Consequently,
/// partitioning along the last axis is faster and uses less space than
/// partitioning along any other axis.<br></br>
///
/// The sort order for complex numbers is lexicographic.<br></br>
/// If both the
/// real and imaginary parts are non-nan then the order is determined by
/// the real parts except when they are equal, in which case the order
/// is determined by the imaginary parts.
/// </summary>
/// <param name="a">
/// Array to be sorted.
/// </param>
/// <param name="kth">
/// Element index to partition by.<br></br>
/// The k-th value of the element
/// will be in its final sorted position and all smaller elements
/// will be moved before it and all equal or greater elements behind
/// it.<br></br>
/// The order of all elements in the partitions is undefined.<br></br>
/// If
/// provided with a sequence of k-th it will partition all elements
/// indexed by k-th of them into their sorted position at once.
/// </param>
/// <param name="axis">
/// Axis along which to sort.<br></br>
/// If None, the array is flattened before
/// sorting.<br></br>
/// The default is -1, which sorts along the last axis.
/// </param>
/// <param name="kind">
/// Selection algorithm.<br></br>
/// Default is ‘introselect’.
/// </param>
/// <param name="order">
/// When a is an array with fields defined, this argument
/// specifies which fields to compare first, second, etc.<br></br>
/// A single
/// field can be specified as a string.<br></br>
/// Not all fields need be
/// specified, but unspecified fields will still be used, in the
/// order in which they come up in the dtype, to break ties.
/// </param>
/// <returns>
/// Array of the same type and shape as a.
/// </returns>
public NDarray partition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
kth,
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
if (kind!="introselect") kwargs["kind"]=ToPython(kind);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("partition", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Perform an indirect partition along the given axis using the
/// algorithm specified by the kind keyword.<br></br>
/// It returns an array of
/// indices of the same shape as a that index data along the given
/// axis in partitioned order.<br></br>
///
/// Notes
///
/// See partition for notes on the different selection algorithms.
/// </summary>
/// <param name="a">
/// Array to sort.
/// </param>
/// <param name="kth">
/// Element index to partition by.<br></br>
/// The k-th element will be in its
/// final sorted position and all smaller elements will be moved
/// before it and all larger elements behind it.<br></br>
/// The order all
/// elements in the partitions is undefined.<br></br>
/// If provided with a
/// sequence of k-th it will partition all of them into their sorted
/// position at once.
/// </param>
/// <param name="axis">
/// Axis along which to sort.<br></br>
/// The default is -1 (the last axis).<br></br>
/// If
/// None, the flattened array is used.
/// </param>
/// <param name="kind">
/// Selection algorithm.<br></br>
/// Default is ‘introselect’
/// </param>
/// <param name="order">
/// When a is an array with fields defined, this argument
/// specifies which fields to compare first, second, etc.<br></br>
/// A single
/// field can be specified as a string, and not all fields need be
/// specified, but unspecified fields will still be used, in the
/// order in which they come up in the dtype, to break ties.
/// </param>
/// <returns>
/// Array of indices that partition a along the specified axis.<br></br>
///
/// If a is one-dimensional, a[index_array] yields a partitioned a.<br></br>
///
/// More generally, np.take_along_axis(a, index_array, axis=a) always
/// yields the partitioned a, irrespective of dimensionality.
/// </returns>
public NDarray argpartition(NDarray a, int[] kth, int? axis = -1, string kind = "introselect", string order = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
kth,
});
var kwargs=new PyDict();
if (axis!=-1) kwargs["axis"]=ToPython(axis);
if (kind!="introselect") kwargs["kind"]=ToPython(kind);
if (order!=null) kwargs["order"]=ToPython(order);
dynamic py = __self__.InvokeMethod("argpartition", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Returns the indices of the maximum values along an axis.<br></br>
///
/// Notes
///
/// In case of multiple occurrences of the maximum values, the indices
/// corresponding to the first occurrence are returned.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axis">
/// By default, the index is into the flattened array, otherwise
/// along the specified axis.
/// </param>
/// <param name="out">
/// If provided, the result will be inserted into this array.<br></br>
/// It should
/// be of the appropriate shape and dtype.
/// </param>
/// <returns>
/// Array of indices into the array.<br></br>
/// It has the same shape as a.shape
/// with the dimension along axis removed.
/// </returns>
public NDarray argmax(NDarray a, int? axis = null, NDarray @out = 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);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("argmax", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the indices of the maximum values in the specified axis ignoring
/// NaNs.<br></br>
/// For all-NaN slices ValueError is raised.<br></br>
/// Warning: the
/// results cannot be trusted if a slice contains only NaNs and -Infs.
/// </summary>
/// <param name="a">
/// Input data.
/// </param>
/// <param name="axis">
/// Axis along which to operate.<br></br>
/// By default flattened input is used.
/// </param>
/// <returns>
/// An array of indices or a single index value.
/// </returns>
public NDarray nanargmax(NDarray a, int? 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("nanargmax", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Returns the indices of the minimum values along an axis.<br></br>
///
/// Notes
///
/// In case of multiple occurrences of the minimum values, the indices
/// corresponding to the first occurrence are returned.
/// </summary>
/// <param name="a">
/// Input array.
/// </param>
/// <param name="axis">
/// By default, the index is into the flattened array, otherwise
/// along the specified axis.
/// </param>
/// <param name="out">
/// If provided, the result will be inserted into this array.<br></br>
/// It should
/// be of the appropriate shape and dtype.
/// </param>
/// <returns>
/// Array of indices into the array.<br></br>
/// It has the same shape as a.shape
/// with the dimension along axis removed.
/// </returns>
public NDarray argmin(NDarray a, int? axis = null, NDarray @out = 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);
if (@out!=null) kwargs["out"]=ToPython(@out);
dynamic py = __self__.InvokeMethod("argmin", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the indices of the minimum values in the specified axis ignoring
/// NaNs.<br></br>
/// For all-NaN slices ValueError is raised.<br></br>
/// Warning: the results
/// cannot be trusted if a slice contains only NaNs and Infs.
/// </summary>
/// <param name="a">
/// Input data.
/// </param>
/// <param name="axis">
/// Axis along which to operate.<br></br>
/// By default flattened input is used.
/// </param>
/// <returns>
/// An array of indices or a single index value.
/// </returns>
public NDarray nanargmin(NDarray a, int? 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("nanargmin", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Find the indices of array elements that are non-zero, grouped by element.<br></br>
///
/// Notes
///
/// np.argwhere(a) is the same as np.transpose(np.nonzero(a)).<br></br>
///
/// The output of argwhere is not suitable for indexing arrays.<br></br>
///
/// For this purpose use nonzero(a) instead.
/// </summary>
/// <param name="a">
/// Input data.
/// </param>
/// <returns>
/// Indices of elements that are non-zero.<br></br>
/// Indices are grouped by element.
/// </returns>
public NDarray argwhere(NDarray a)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("argwhere", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return indices that are non-zero in the flattened version of a.<br></br>
///
/// This is equivalent to np.nonzero(np.ravel(a))[0].
/// </summary>
/// <param name="a">
/// Input data.
/// </param>
/// <returns>
/// Output array, containing the indices of the elements of a.ravel()
/// that are non-zero.
/// </returns>
public NDarray flatnonzero(NDarray a)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("flatnonzero", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Find indices where elements should be inserted to maintain order.<br></br>
///
/// Find the indices into a sorted array a such that, if the
/// corresponding elements in v were inserted before the indices, the
/// order of a would be preserved.<br></br>
///
/// Assuming that a is sorted:
///
/// Notes
///
/// Binary search is used to find the required insertion points.<br></br>
///
/// As of NumPy 1.4.0 searchsorted works with real/complex arrays containing
/// nan values.<br></br>
/// The enhanced sort order is documented in sort.<br></br>
///
/// This function is a faster version of the builtin python bisect.bisect_left
/// (side='left') and bisect.bisect_right (side='right') functions,
/// which is also vectorized in the v argument.
/// </summary>
/// <param name="a">
/// Input array.<br></br>
/// If sorter is None, then it must be sorted in
/// ascending order, otherwise sorter must be an array of indices
/// that sort it.
/// </param>
/// <param name="v">
/// Values to insert into a.
/// </param>
/// <param name="side">
/// If ‘left’, the index of the first suitable location found is given.<br></br>
///
/// If ‘right’, return the last such index.<br></br>
/// If there is no suitable
/// index, return either 0 or N (where N is the length of a).
/// </param>
/// <param name="sorter">
/// Optional array of integer indices that sort array a into ascending
/// order.<br></br>
/// They are typically the result of argsort.
/// </param>
/// <returns>
/// Array of insertion points with the same shape as v.
/// </returns>
public NDarray<int> searchsorted(NDarray a, NDarray v, string side = "left", NDarray sorter = null)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
v,
});
var kwargs=new PyDict();
if (side!="left") kwargs["side"]=ToPython(side);
if (sorter!=null) kwargs["sorter"]=ToPython(sorter);
dynamic py = __self__.InvokeMethod("searchsorted", pyargs, kwargs);
return ToCsharp<NDarray<int>>(py);
}
/// <summary>
/// Return the elements of an array that satisfy some condition.<br></br>
///
/// This is equivalent to np.compress(ravel(condition), ravel(arr)).<br></br>
/// If
/// condition is boolean np.extract is equivalent to arr[condition].<br></br>
///
/// Note that place does the exact opposite of extract.
/// </summary>
/// <param name="condition">
/// An array whose nonzero or True entries indicate the elements of arr
/// to extract.
/// </param>
/// <param name="arr">
/// Input array of the same size as condition.
/// </param>
/// <returns>
/// Rank 1 array of values from arr where condition is True.
/// </returns>
public NDarray extract(NDarray condition, NDarray arr)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
condition,
arr,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("extract", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Counts the number of non-zero values in the array a.<br></br>
///
/// The word “non-zero” is in reference to the Python 2.x
/// built-in method __nonzero__() (renamed __bool__()
/// in Python 3.x) of Python objects that tests an object’s
/// “truthfulness”. For example, any number is considered
/// truthful if it is nonzero, whereas any string is considered
/// truthful if it is not the empty string.<br></br>
/// Thus, this function
/// (recursively) counts how many elements in a (and in
/// sub-arrays thereof) have their __nonzero__() or __bool__()
/// method evaluated to True.
/// </summary>
/// <param name="a">
/// The array for which to count non-zeros.
/// </param>
/// <param name="axis">
/// Axis or tuple of axes along which to count non-zeros.<br></br>
///
/// Default is None, meaning that non-zeros will be counted
/// along a flattened version of a.
/// </param>
/// <returns>
/// Number of non-zero values in the array along a given axis.<br></br>
///
/// Otherwise, the total number of non-zero values in the array
/// is returned.
/// </returns>
public NDarray<int> count_nonzero(NDarray a, int[] axis)
{
//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("count_nonzero", pyargs, kwargs);
return ToCsharp<NDarray<int>>(py);
}
/// <summary>
/// Counts the number of non-zero values in the array a.<br></br>
///
/// The word “non-zero” is in reference to the Python 2.x
/// built-in method __nonzero__() (renamed __bool__()
/// in Python 3.x) of Python objects that tests an object’s
/// “truthfulness”. For example, any number is considered
/// truthful if it is nonzero, whereas any string is considered
/// truthful if it is not the empty string.<br></br>
/// Thus, this function
/// (recursively) counts how many elements in a (and in
/// sub-arrays thereof) have their __nonzero__() or __bool__()
/// method evaluated to True.
/// </summary>
/// <param name="a">
/// The array for which to count non-zeros.
/// </param>
/// <returns>
/// Number of non-zero values in the array along a given axis.<br></br>
///
/// Otherwise, the total number of non-zero values in the array
/// is returned.
/// </returns>
public int count_nonzero(NDarray a)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("count_nonzero", pyargs, kwargs);
return ToCsharp<int>(py);
}
}
}