NDPointer#

class numpy::NDPointer#

numpy C++ class.

Example#

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

// Use NDPointer
NDPointer obj;
// ... operations ...

Other Methods#

Signature

Return Type

Location

Example

bool matches(const NDArray<T>&array)

bool

NP_CTYPES_INTEROP.H:212

View

Code Examples#

The following examples are extracted from the test suite.

matches (np_test_1_all.cpp:26699)
26689            std::cout << std::string("[FAIL] ") + description << std::endl;
26690            throw std::runtime_error(description);
26691        }
26692        // std::cout << "  ✓ load_library() (stub)" << std::endl;
26693      }
26694
26695      // Test ndpointer
26696      {
26697        auto ptr_desc = numpy::ctypeslib::ndpointer<double>(2, { 10, 10 });
26698        auto arr = NDArray<double>({ 10, 10 }, 0.0);
26699        bool matches = ptr_desc.matches(arr);
26700        if (!(matches)) {
26701            std::string description = std::string("test_ctypes_interop():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(matches)";
26702            std::cout << std::string("[FAIL] ") + description << std::endl;
26703            throw std::runtime_error(description);
26704        }
26705        // std::cout << "  ✓ ndpointer()" << std::endl;
26706      }
26707
26708      // std::cout << "  [PASS] Sub-phase 6D complete (4 functions tested)" << std::endl;
26709    }