Repository navigation
Expand file tree
/
Copy pathnp.insert.cs
More file actions
243 lines (237 loc) · 9.06 KB
/
Copy pathnp.insert.cs
File metadata and controls
243 lines (237 loc) · 9.06 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Numpy;
using Numpy.Models;
using Python.Runtime;
namespace Numpy
{
/// <summary>
/// Manual type conversions
/// </summary>
public static partial class np
{
/// <summary>
/// Insert values along the given axis before the given indices.<br></br>
///
/// Notes
///
/// Note that for higher dimensional inserts obj=0 behaves very different
/// from obj=[0] just like arr[:,0,:] = values is different from
/// arr[:,[0],:] = values.
/// </summary>
/// <param name="arr">
/// Input array.
/// </param>
/// <param name="obj">
/// Object that defines the index or indices before which values is
/// inserted.<br></br>
///
/// Support for multiple insertions when obj is a single scalar or a
/// sequence with one element (similar to calling insert multiple
/// times).
/// </param>
/// <param name="values">
/// Values to insert into arr.<br></br>
/// If the type of values is different
/// from that of arr, values is converted to the type of arr.<br></br>
///
/// values should be shaped so that arr[...,obj,...] = values
/// is legal.
/// </param>
/// <param name="axis">
/// Axis along which to insert values.<br></br>
/// If axis is None then arr
/// is flattened first.
/// </param>
/// <returns>
/// A copy of arr with values inserted.<br></br>
/// Note that insert
/// does not occur in-place: a new array is returned.<br></br>
/// If
/// axis is None, out is a flattened array.
/// </returns>
public static NDarray insert(NDarray arr, int obj, NDarray values = null, int? axis = null)
{
//auto-generated code, do not change
var __self__ = self;
var pyargs = ToTuple(new object[]
{
arr,
ToPython(obj),
});
var kwargs = new PyDict();
if (values != null) kwargs["values"] = ToPython(values);
if (axis != null) kwargs["axis"] = ToPython(axis);
dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Insert values along the given axis before the given indices.<br></br>
///
/// Notes
///
/// Note that for higher dimensional inserts obj=0 behaves very different
/// from obj=[0] just like arr[:,0,:] = values is different from
/// arr[:,[0],:] = values.
/// </summary>
/// <param name="arr">
/// Input array.
/// </param>
/// <param name="obj">
/// Object that defines the index or indices before which values is
/// inserted.<br></br>
///
/// Support for multiple insertions when obj is a single scalar or a
/// sequence with one element (similar to calling insert multiple
/// times).
/// </param>
/// <param name="values">
/// Values to insert into arr.<br></br>
/// If the type of values is different
/// from that of arr, values is converted to the type of arr.<br></br>
///
/// values should be shaped so that arr[...,obj,...] = values
/// is legal.
/// </param>
/// <param name="axis">
/// Axis along which to insert values.<br></br>
/// If axis is None then arr
/// is flattened first.
/// </param>
/// <returns>
/// A copy of arr with values inserted.<br></br>
/// Note that insert
/// does not occur in-place: a new array is returned.<br></br>
/// If
/// axis is None, out is a flattened array.
/// </returns>
public static NDarray insert(NDarray arr, NDarray obj, NDarray values = null, int? axis = null)
{
//auto-generated code, do not change
var __self__ = self;
var pyargs = ToTuple(new object[]
{
arr,
obj,
});
var kwargs = new PyDict();
if (values != null) kwargs["values"] = ToPython(values);
if (axis != null) kwargs["axis"] = ToPython(axis);
dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Insert values along the given axis before the given indices.<br></br>
///
/// Notes
///
/// Note that for higher dimensional inserts obj=0 behaves very different
/// from obj=[0] just like arr[:,0,:] = values is different from
/// arr[:,[0],:] = values.
/// </summary>
/// <param name="arr">
/// Input array.
/// </param>
/// <param name="obj">
/// Object that defines the index or indices before which values is
/// inserted.<br></br>
///
/// Support for multiple insertions when obj is a single scalar or a
/// sequence with one element (similar to calling insert multiple
/// times).
/// </param>
/// <param name="values">
/// Values to insert into arr.<br></br>
/// If the type of values is different
/// from that of arr, values is converted to the type of arr.<br></br>
///
/// values should be shaped so that arr[...,obj,...] = values
/// is legal.
/// </param>
/// <param name="axis">
/// Axis along which to insert values.<br></br>
/// If axis is None then arr
/// is flattened first.
/// </param>
/// <returns>
/// A copy of arr with values inserted.<br></br>
/// Note that insert
/// does not occur in-place: a new array is returned.<br></br>
/// If
/// axis is None, out is a flattened array.
/// </returns>
public static NDarray insert(NDarray arr, Slice obj, NDarray values = null, int? axis = null)
{
//auto-generated code, do not change
var __self__ = self;
var pyargs = ToTuple(new object[]
{
arr,
obj.ToPython(),
});
var kwargs = new PyDict();
if (values != null) kwargs["values"] = ToPython(values);
if (axis != null) kwargs["axis"] = ToPython(axis);
dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Insert values along the given axis before the given indices.<br></br>
///
/// Notes
///
/// Note that for higher dimensional inserts obj=0 behaves very different
/// from obj=[0] just like arr[:,0,:] = values is different from
/// arr[:,[0],:] = values.
/// </summary>
/// <param name="arr">
/// Input array.
/// </param>
/// <param name="obj">
/// Object that defines the index or indices before which values is
/// inserted.<br></br>
///
/// Support for multiple insertions when obj is a single scalar or a
/// sequence with one element (similar to calling insert multiple
/// times).
/// </param>
/// <param name="values">
/// Values to insert into arr.<br></br>
/// If the type of values is different
/// from that of arr, values is converted to the type of arr.<br></br>
///
/// values should be shaped so that arr[...,obj,...] = values
/// is legal.
/// </param>
/// <param name="axis">
/// Axis along which to insert values.<br></br>
/// If axis is None then arr
/// is flattened first.
/// </param>
/// <returns>
/// A copy of arr with values inserted.<br></br>
/// Note that insert
/// does not occur in-place: a new array is returned.<br></br>
/// If
/// axis is None, out is a flattened array.
/// </returns>
public static NDarray insert<T>(NDarray arr, int obj, T values, int? axis = null) where T : struct
{
//auto-generated code, do not change
var __self__ = self;
var pyargs = ToTuple(new object[]
{
arr,
ToPython(obj),
});
var kwargs = new PyDict();
kwargs["values"] = ToPython(values);
if (axis != null) kwargs["axis"] = ToPython(axis);
dynamic py = __self__.InvokeMethod("insert", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
}