forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnp.set.gen.cs
More file actions
228 lines (218 loc) · 9.37 KB
/
np.set.gen.cs
File metadata and controls
228 lines (218 loc) · 9.37 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
// 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 static partial class np
{
/// <summary>
/// Test whether each element of a 1-D array is also present in a second array.<br></br>
///
/// Returns a boolean array the same length as ar1 that is True
/// where an element of ar1 is in ar2 and False otherwise.<br></br>
///
/// We recommend using isin instead of in1d for new code.<br></br>
///
/// Notes
///
/// in1d can be considered as an element-wise function version of the
/// python keyword in, for 1-D sequences.<br></br>
/// in1d(a, b) is roughly
/// equivalent to np.array([item in b for item in a]).<br></br>
///
/// However, this idea fails if ar2 is a set, or similar (non-sequence)
/// container: As ar2 is converted to an array, in those cases
/// asarray(ar2) is an object array rather than the expected array of
/// contained values.
/// </summary>
/// <param name="ar1">
/// Input array.
/// </param>
/// <param name="ar2">
/// The values against which to test each value of ar1.
/// </param>
/// <param name="assume_unique">
/// If True, the input arrays are both assumed to be unique, which
/// can speed up the calculation.<br></br>
/// Default is False.
/// </param>
/// <param name="invert">
/// If True, the values in the returned array are inverted (that is,
/// False where an element of ar1 is in ar2 and True otherwise).<br></br>
///
/// Default is False.<br></br>
/// np.in1d(a, b, invert=True) is equivalent
/// to (but is faster than) np.invert(in1d(a, b)).
/// </param>
/// <returns>
/// The values ar1[in1d] are in ar2.
/// </returns>
public static NDarray in1d(NDarray ar1, NDarray ar2, bool? assume_unique = false, bool? invert = false)
=> NumPy.Instance.in1d(ar1, ar2, assume_unique:assume_unique, invert:invert);
/// <summary>
/// Find the intersection of two arrays.<br></br>
///
/// Return the sorted, unique values that are in both of the input arrays.
/// </summary>
/// <param name="ar2">
/// Input arrays.<br></br>
/// Will be flattened if not already 1D.
/// </param>
/// <param name="ar1">
/// Input arrays.<br></br>
/// Will be flattened if not already 1D.
/// </param>
/// <param name="assume_unique">
/// If True, the input arrays are both assumed to be unique, which
/// can speed up the calculation.<br></br>
/// Default is False.
/// </param>
/// <param name="return_indices">
/// If True, the indices which correspond to the intersection of the two
/// arrays are returned.<br></br>
/// The first instance of a value is used if there are
/// multiple.<br></br>
/// Default is False.
/// </param>
/// <returns>
/// A tuple of:
/// intersect1d
/// Sorted 1D array of common and unique elements.
/// comm1
/// The indices of the first occurrences of the common values in ar1.
/// Only provided if return_indices is True.
/// comm2
/// The indices of the first occurrences of the common values in ar2.
/// Only provided if return_indices is True.
/// </returns>
public static (NDarray, NDarray, NDarray) intersect1d(NDarray ar2, NDarray ar1, bool assume_unique = false, bool return_indices = false)
=> NumPy.Instance.intersect1d(ar2, ar1, assume_unique:assume_unique, return_indices:return_indices);
/// <summary>
/// Calculates element in test_elements, broadcasting over element only.<br></br>
///
/// Returns a boolean array of the same shape as element that is True
/// where an element of element is in test_elements and False otherwise.<br></br>
///
/// Notes
///
/// isin is an element-wise function version of the python keyword in.<br></br>
///
/// isin(a, b) is roughly equivalent to
/// np.array([item in b for item in a]) if a and b are 1-D sequences.<br></br>
///
/// element and test_elements are converted to arrays if they are not
/// already.<br></br>
/// If test_elements is a set (or other non-sequence collection)
/// it will be converted to an object array with one element, rather than an
/// array of the values contained in test_elements.<br></br>
/// This is a consequence
/// of the array constructor’s way of handling non-sequence collections.<br></br>
///
/// Converting the set to a list usually gives the desired behavior.
/// </summary>
/// <param name="element">
/// Input array.
/// </param>
/// <param name="test_elements">
/// The values against which to test each value of element.<br></br>
///
/// This argument is flattened if it is an array or array_like.<br></br>
///
/// See notes for behavior with non-array-like parameters.
/// </param>
/// <param name="assume_unique">
/// If True, the input arrays are both assumed to be unique, which
/// can speed up the calculation.<br></br>
/// Default is False.
/// </param>
/// <param name="invert">
/// If True, the values in the returned array are inverted, as if
/// calculating element not in test_elements.<br></br>
/// Default is False.<br></br>
///
/// np.isin(a, b, invert=True) is equivalent to (but faster
/// than) np.invert(np.isin(a, b)).
/// </param>
/// <returns>
/// Has the same shape as element.<br></br>
/// The values element[isin]
/// are in test_elements.
/// </returns>
public static NDarray isin(NDarray element, NDarray test_elements, bool? assume_unique = false, bool? invert = false)
=> NumPy.Instance.isin(element, test_elements, assume_unique:assume_unique, invert:invert);
/// <summary>
/// Find the set difference of two arrays.<br></br>
///
/// Return the unique values in ar1 that are not in ar2.
/// </summary>
/// <param name="ar1">
/// Input array.
/// </param>
/// <param name="ar2">
/// Input comparison array.
/// </param>
/// <param name="assume_unique">
/// If True, the input arrays are both assumed to be unique, which
/// can speed up the calculation.<br></br>
/// Default is False.
/// </param>
/// <returns>
/// 1D array of values in ar1 that are not in ar2. The result
/// is sorted when assume_unique=False, but otherwise only sorted
/// if the input is sorted.
/// </returns>
public static NDarray setdiff1d(NDarray ar1, NDarray ar2, bool assume_unique = false)
=> NumPy.Instance.setdiff1d(ar1, ar2, assume_unique:assume_unique);
/// <summary>
/// Find the set exclusive-or of two arrays.<br></br>
///
/// Return the sorted, unique values that are in only one (not both) of the
/// input arrays.
/// </summary>
/// <param name="ar2">
/// Input arrays.
/// </param>
/// <param name="ar1">
/// Input arrays.
/// </param>
/// <param name="assume_unique">
/// If True, the input arrays are both assumed to be unique, which
/// can speed up the calculation.<br></br>
/// Default is False.
/// </param>
/// <returns>
/// Sorted 1D array of unique values that are in only one of the input
/// arrays.
/// </returns>
public static NDarray setxor1d(NDarray ar2, NDarray ar1, bool assume_unique = false)
=> NumPy.Instance.setxor1d(ar2, ar1, assume_unique:assume_unique);
/// <summary>
/// Find the union of two arrays.<br></br>
///
/// Return the unique, sorted array of values that are in either of the two
/// input arrays.
/// </summary>
/// <param name="ar2">
/// Input arrays.<br></br>
/// They are flattened if they are not already 1D.
/// </param>
/// <param name="ar1">
/// Input arrays.<br></br>
/// They are flattened if they are not already 1D.
/// </param>
/// <returns>
/// Unique, sorted union of the input arrays.
/// </returns>
public static NDarray union1d(NDarray ar2, NDarray ar1)
=> NumPy.Instance.union1d(ar2, ar1);
}
}