IndexBuilder#

class numpy::IndexBuilder#

numpy C++ class.

Example#

#include <numpy/np_ndarray.h>
using namespace numpy;

// Use IndexBuilder
IndexBuilder obj;
// ... operations ...

Math Operations#

Signature

Return Type

Location

Example

IndexBuilder & add(ssize_tidx)

IndexBuilder &

NP_INDEX_TYPES.H:297

View

IndexBuilder & add(const Slice &slice)

IndexBuilder &

NP_INDEX_TYPES.H:298

View

IndexBuilder & add(const NDArray<T>&array)

IndexBuilder &

NP_INDEX_TYPES.H:303

View

IndexBuilder & add_all()

IndexBuilder &

NP_INDEX_TYPES.H:299

IndexBuilder & add_ellipsis()

IndexBuilder &

NP_INDEX_TYPES.H:300

IndexBuilder & add_newaxis()

IndexBuilder &

NP_INDEX_TYPES.H:301

Other Methods#

Signature

Return Type

Location

Example

IndexExpr build()

IndexExpr

NP_INDEX_TYPES.H:309

Code Examples#

The following examples are extracted from the test suite.

add (np_test_1_all.cpp:6410)
6400void testCharArrayStringOperationsCharArray() {
6401    std::cout << "========= testStringOperations =======================";
6402
6403    // Test string concatenation
6404    std::vector<std::string> words1 = {"Hello", "Good", "Nice"};
6405    std::vector<std::string> words2 = {" World", " Day", " Work"};
6406
6407    auto arr1 = array<32>(words1);
6408    auto arr2 = array<32>(words2);
6409
6410    auto result = add(arr1, arr2);
6411    // std::cout << "String concatenation (add):" << std::endl;
6412    for (size_t i = 0; i < result.size(); ++i) {
6413        // std::cout << "'" << arr1[i] << "' + '" << arr2[i] << "' = '" << result[i] << "'";
6414    }
6415
6416    // Test scalar addition
6417    auto scalar_result = add(arr1, "!");
6418    // std::cout << "Scalar concatenation:" << std::endl;
6419    for (size_t i = 0; i < scalar_result.size(); ++i) {
6420        // std::cout << "'" << arr1[i] << "' + '!' = '" << scalar_result[i] << "'";
add (np_test_1_all.cpp:6410)
6400void testCharArrayStringOperationsCharArray() {
6401    std::cout << "========= testStringOperations =======================";
6402
6403    // Test string concatenation
6404    std::vector<std::string> words1 = {"Hello", "Good", "Nice"};
6405    std::vector<std::string> words2 = {" World", " Day", " Work"};
6406
6407    auto arr1 = array<32>(words1);
6408    auto arr2 = array<32>(words2);
6409
6410    auto result = add(arr1, arr2);
6411    // std::cout << "String concatenation (add):" << std::endl;
6412    for (size_t i = 0; i < result.size(); ++i) {
6413        // std::cout << "'" << arr1[i] << "' + '" << arr2[i] << "' = '" << result[i] << "'";
6414    }
6415
6416    // Test scalar addition
6417    auto scalar_result = add(arr1, "!");
6418    // std::cout << "Scalar concatenation:" << std::endl;
6419    for (size_t i = 0; i < scalar_result.size(); ++i) {
6420        // std::cout << "'" << arr1[i] << "' + '!' = '" << scalar_result[i] << "'";
add (np_test_1_all.cpp:6410)
6400void testCharArrayStringOperationsCharArray() {
6401    std::cout << "========= testStringOperations =======================";
6402
6403    // Test string concatenation
6404    std::vector<std::string> words1 = {"Hello", "Good", "Nice"};
6405    std::vector<std::string> words2 = {" World", " Day", " Work"};
6406
6407    auto arr1 = array<32>(words1);
6408    auto arr2 = array<32>(words2);
6409
6410    auto result = add(arr1, arr2);
6411    // std::cout << "String concatenation (add):" << std::endl;
6412    for (size_t i = 0; i < result.size(); ++i) {
6413        // std::cout << "'" << arr1[i] << "' + '" << arr2[i] << "' = '" << result[i] << "'";
6414    }
6415
6416    // Test scalar addition
6417    auto scalar_result = add(arr1, "!");
6418    // std::cout << "Scalar concatenation:" << std::endl;
6419    for (size_t i = 0; i < scalar_result.size(); ++i) {
6420        // std::cout << "'" << arr1[i] << "' + '!' = '" << scalar_result[i] << "'";