ItemsRange#
-
class numpy::ItemsRange#
numpy C++ class.
Example#
#include <numpy/np_ndarray.h>
using namespace numpy;
// Use ItemsRange
ItemsRange obj;
// ... operations ...
Other Methods#
Code Examples#
The following examples are extracted from the test suite.
begin (np_test_1_all.cpp:6171)
6161 // Test sorted data generation
6162 std::vector<int> data = gen.generate(50, DataPattern::SORTED);
6163
6164 if (!(data.size() == 50)) {
6165 std::string description = std::string("test_data_generator_sortedBenchmarkSorting():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(data.size() == 50)";
6166 std::cout << std::string("[FAIL] ") + description << std::endl;
6167 throw std::runtime_error(description);
6168 }
6169
6170 // Verify data is sorted
6171 if (!(std::is_sorted(data.begin(), data.end()))) {
6172 std::string description = std::string("test_data_generator_sortedBenchmarkSorting():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(std::is_sorted(data.begin(), data.end()))";
6173 std::cout << std::string("[FAIL] ") + description << std::endl;
6174 throw std::runtime_error(description);
6175 }
6176
6177 // std::cout << "Sorted data generation test passed" << std::endl;
6178
6179 std::cout << " -> tests passed" << std::endl;
6180}
end (np_test_1_all.cpp:6171)
6161 // Test sorted data generation
6162 std::vector<int> data = gen.generate(50, DataPattern::SORTED);
6163
6164 if (!(data.size() == 50)) {
6165 std::string description = std::string("test_data_generator_sortedBenchmarkSorting():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(data.size() == 50)";
6166 std::cout << std::string("[FAIL] ") + description << std::endl;
6167 throw std::runtime_error(description);
6168 }
6169
6170 // Verify data is sorted
6171 if (!(std::is_sorted(data.begin(), data.end()))) {
6172 std::string description = std::string("test_data_generator_sortedBenchmarkSorting():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(std::is_sorted(data.begin(), data.end()))";
6173 std::cout << std::string("[FAIL] ") + description << std::endl;
6174 throw std::runtime_error(description);
6175 }
6176
6177 // std::cout << "Sorted data generation test passed" << std::endl;
6178
6179 std::cout << " -> tests passed" << std::endl;
6180}