NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
put.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include "NumCpp/Core/Types.hpp"
31#include "NumCpp/NdArray.hpp"
32
33namespace nc
34{
35 //============================================================================
36 // Method Description:
45 template<typename dtype>
46 NdArray<dtype>& put(NdArray<dtype>& inArray, int32 inIndex, const dtype& inValue)
47 {
48 inArray.put(inIndex, inValue);
49 return inArray;
50 }
51
52 //============================================================================
53 // Method Description:
63 template<typename dtype>
64 NdArray<dtype>& put(NdArray<dtype>& inArray, int32 inRow, int32 inCol, const dtype& inValue)
65 {
66 inArray.put(inRow, inCol, inValue);
67 return inArray;
68 }
69
70 //============================================================================
71 // Method Description:
81 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
82 NdArray<dtype>& put(NdArray<dtype>& inArray, const Indices& inIndices, const dtype& inValue)
83 {
84 inArray.put(inIndices, inValue);
85 return inArray;
86 }
87
88 //============================================================================
89 // Method Description:
99 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
100 NdArray<dtype>& put(NdArray<dtype>& inArray, const Indices& inIndices, const NdArray<dtype>& inValues)
101 {
102 inArray.put(inIndices, inValues);
103 return inArray;
104 }
105
106 //============================================================================
107 // Method Description:
117 template<typename dtype>
118 NdArray<dtype>& put(NdArray<dtype>& inArray, const Slice& inSlice, const dtype& inValue)
119 {
120 inArray.put(inSlice, inValue);
121 return inArray;
122 }
123
124 //============================================================================
125 // Method Description:
135 template<typename dtype>
136 NdArray<dtype>& put(NdArray<dtype>& inArray, const Slice& inSlice, const NdArray<dtype>& inValues)
137 {
138 inArray.put(inSlice, inValues);
139 return inArray;
140 }
141
142 //============================================================================
143 // Method Description:
154 template<typename dtype,
155 typename RowIndices,
156 typename ColIndices,
157 type_traits::ndarray_int_concept<RowIndices> = 0,
158 type_traits::ndarray_int_concept<ColIndices> = 0>
160 const RowIndices& inRowIndices,
161 const ColIndices& inColIndices,
162 const dtype& inValue)
163 {
164 inArray.put(inRowIndices, inColIndices, inValue);
165 return inArray;
166 }
167
168 //============================================================================
169 // Method Description:
180 template<typename dtype, typename RowIndices, type_traits::ndarray_int_concept<RowIndices> = 0>
181 NdArray<dtype>&
182 put(NdArray<dtype>& inArray, const RowIndices& inRowIndices, const Slice& inColSlice, const dtype& inValue)
183 {
184 inArray.put(inRowIndices, inColSlice, inValue);
185 return inArray;
186 }
187
188 //============================================================================
189 // Method Description:
200 template<typename dtype, typename ColIndices, type_traits::ndarray_int_concept<ColIndices> = 0>
201 NdArray<dtype>&
202 put(NdArray<dtype>& inArray, const Slice& inRowSlice, const ColIndices& inColIndices, const dtype& inValue)
203 {
204 inArray.put(inRowSlice, inColIndices, inValue);
205 return inArray;
206 }
207
208 //============================================================================
209 // Method Description:
220 template<typename dtype>
221 NdArray<dtype>& put(NdArray<dtype>& inArray, const Slice& inRowSlice, const Slice& inColSlice, const dtype& inValue)
222 {
223 inArray.put(inRowSlice, inColSlice, inValue);
224 return inArray;
225 }
226
227 //============================================================================
228 // Method Description:
239 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
240 NdArray<dtype>& put(NdArray<dtype>& inArray, const Indices& inRowIndices, int32 inColIndex, const dtype& inValue)
241 {
242 inArray.put(inRowIndices, inColIndex, inValue);
243 return inArray;
244 }
245
246 //============================================================================
247 // Method Description:
258 template<typename dtype>
259 NdArray<dtype>& put(NdArray<dtype>& inArray, const Slice& inRowSlice, int32 inColIndex, const dtype& inValue)
260 {
261 inArray.put(inRowSlice, inColIndex, inValue);
262 return inArray;
263 }
264
265 //============================================================================
266 // Method Description:
277 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
278 NdArray<dtype>& put(NdArray<dtype>& inArray, int32 inRowIndex, const Indices& inColIndices, const dtype& inValue)
279 {
280 inArray.put(inRowIndex, inColIndices, inValue);
281 return inArray;
282 }
283
284 //============================================================================
285 // Method Description:
296 template<typename dtype>
297 NdArray<dtype>& put(NdArray<dtype>& inArray, int32 inRowIndex, const Slice& inColSlice, const dtype& inValue)
298 {
299 inArray.put(inRowIndex, inColSlice, inValue);
300 return inArray;
301 }
302
303 //============================================================================
304 // Method Description:
315 template<typename dtype,
316 typename RowIndices,
317 typename ColIndices,
318 type_traits::ndarray_int_concept<RowIndices> = 0,
319 type_traits::ndarray_int_concept<ColIndices> = 0>
321 const RowIndices& inRowIndices,
322 const ColIndices& inColIndices,
323 const NdArray<dtype>& inValues)
324 {
325 inArray.put(inRowIndices, inColIndices, inValues);
326 return inArray;
327 }
328
329 //============================================================================
330 // Method Description:
341 template<typename dtype, typename RowIndices, type_traits::ndarray_int_concept<RowIndices> = 0>
343 const RowIndices& inRowIndices,
344 const Slice& inColSlice,
345 const NdArray<dtype>& inValues)
346 {
347 inArray.put(inRowIndices, inColSlice, inValues);
348 return inArray;
349 }
350
351 //============================================================================
352 // Method Description:
363 template<typename dtype, typename ColIndices, type_traits::ndarray_int_concept<ColIndices> = 0>
365 const Slice& inRowSlice,
366 const ColIndices& inColIndices,
367 const NdArray<dtype>& inValues)
368 {
369 inArray.put(inRowSlice, inColIndices, inValues);
370 return inArray;
371 }
372
373 //============================================================================
374 // Method Description:
385 template<typename dtype>
386 NdArray<dtype>&
387 put(NdArray<dtype>& inArray, const Slice& inRowSlice, const Slice& inColSlice, const NdArray<dtype>& inValues)
388 {
389 inArray.put(inRowSlice, inColSlice, inValues);
390 return inArray;
391 }
392
393 //============================================================================
394 // Method Description:
405 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
406 NdArray<dtype>&
407 put(NdArray<dtype>& inArray, const Indices& inRowIndices, int32 inColIndex, const NdArray<dtype>& inValues)
408 {
409 inArray.put(inRowIndices, inColIndex, inValues);
410 return inArray;
411 }
412
413 //============================================================================
414 // Method Description:
425 template<typename dtype>
426 NdArray<dtype>&
427 put(NdArray<dtype>& inArray, const Slice& inRowSlice, int32 inColIndex, const NdArray<dtype>& inValues)
428 {
429 inArray.put(inRowSlice, inColIndex, inValues);
430 return inArray;
431 }
432
433 //============================================================================
434 // Method Description:
445 template<typename dtype, typename Indices, type_traits::ndarray_int_concept<Indices> = 0>
446 NdArray<dtype>&
447 put(NdArray<dtype>& inArray, int32 inRowIndex, const Indices& inColIndices, const NdArray<dtype>& inValues)
448 {
449 inArray.put(inRowIndex, inColIndices, inValues);
450 return inArray;
451 }
452
453 //============================================================================
454 // Method Description:
465 template<typename dtype>
466 NdArray<dtype>&
467 put(NdArray<dtype>& inArray, int32 inRowIndex, const Slice& inColSlice, const NdArray<dtype>& inValues)
468 {
469 inArray.put(inRowIndex, inColSlice, inValues);
470 return inArray;
471 }
472} // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
self_type & put(index_type inIndex, const value_type &inValue)
Definition: NdArrayCore.hpp:3693
A Class for slicing into NdArrays.
Definition: Slice.hpp:45
Definition: Cartesian.hpp:40
NdArray< dtype > & put(NdArray< dtype > &inArray, int32 inIndex, const dtype &inValue)
Definition: put.hpp:46
std::int32_t int32
Definition: Types.hpp:36