NDArrayAdvanced#
-
class numpy::NDArrayAdvanced#
numpy C++ class.
Example#
#include <numpy/np_ndarray.h>
using namespace numpy;
// Use NDArrayAdvanced
NDArrayAdvanced obj;
// ... operations ...
Constructors#
Signature |
Location |
Example |
|---|---|---|
|
NP_NDARRAY_ADVANCED.H:23 |
|
|
NP_NDARRAY_ADVANCED.H:24 |
Operators#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
T |
NP_NDARRAY_ADVANCED.H:32 |
|
|
IndexedArrayResult<T> |
NP_NDARRAY_ADVANCED.H:45 |
|
|
IndexedArrayResult<T> |
NP_NDARRAY_ADVANCED.H:49 |
|
|
IndexedArrayResult<T> |
NP_NDARRAY_ADVANCED.H:54 |
|
|
NDArray<T> |
NP_NDARRAY_ADVANCED.H:61 |
|
|
NDArray<T> |
NP_NDARRAY_ADVANCED.H:66 |
|
|
NDArray<T> |
NP_NDARRAY_ADVANCED.H:77 |
Indexing / Selection#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
auto |
NP_NDARRAY_ADVANCED.H:95 |
|
|
void |
NP_NDARRAY_ADVANCED.H:133 |
Math Operations#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
NP_NDARRAY_ADVANCED.H:187 |
|
|
void |
NP_NDARRAY_ADVANCED.H:191 |
|
|
void |
NP_NDARRAY_ADVANCED.H:195 |
|
|
void |
NP_NDARRAY_ADVANCED.H:199 |
|
|
void |
NP_NDARRAY_ADVANCED.H:203 |
|
|
void |
NP_NDARRAY_ADVANCED.H:207 |
|
|
void |
NP_NDARRAY_ADVANCED.H:211 |
Other Methods#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
NP_NDARRAY_ADVANCED.H:216 |
|
|
void |
NP_NDARRAY_ADVANCED.H:179 |
|
|
void |
NP_NDARRAY_ADVANCED.H:103 |
Code Examples#
The following examples are extracted from the test suite.
put (np_test_5_all.cpp:4389)
4379 numpy::NDArray<size_t> indices({ 3 });
4380 indices.setElementAt({ 0 }, 5); // Last position
4381 indices.setElementAt({ 1 }, 2); // Middle position
4382 indices.setElementAt({ 2 }, 0); // First position
4383
4384 numpy::NDArray<int32_t> values({ 3 });
4385 values.setElementAt({ 0 }, 100);
4386 values.setElementAt({ 1 }, 200);
4387 values.setElementAt({ 2 }, 300);
4388
4389 numpy::put(arr, indices, values);
4390
4391 // Check modified values
4392 if (arr.getElementAt({ 0 }) != 300 || arr.getElementAt({ 2 }) != 200 || arr.getElementAt({ 5 }) != 100) {
4393 std::cout << " [FAIL] : in np_test_put_basic() : Values not correctly placed";
4394 throw std::runtime_error("Test failed");
4395 }
4396
4397 // Check unmodified values
4398 if (arr.getElementAt({ 1 }) != 10 || arr.getElementAt({ 3 }) != 30 || arr.getElementAt({ 4 }) != 40) {
4399 std::cout << " [FAIL] : in np_test_put_basic() : Unmodified values changed";