MCPcopy Create free account
hub / github.com/HViktorTsoi/FAST_LIO_LOCALIZATION / get_array

Function get_array

include/matplotlibcpp.h:322–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320
321template<typename Numeric>
322PyObject* get_array(const std::vector<Numeric>& v)
323{
324 npy_intp vsize = v.size();
325 NPY_TYPES type = select_npy_type<Numeric>::type;
326 if (type == NPY_NOTYPE) {
327 size_t memsize = v.size()*sizeof(double);
328 double* dp = static_cast<double*>(::malloc(memsize));
329 for (size_t i=0; i<v.size(); ++i)
330 dp[i] = v[i];
331 PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, NPY_DOUBLE, dp);
332 PyArray_UpdateFlags(reinterpret_cast<PyArrayObject*>(varray), NPY_ARRAY_OWNDATA);
333 return varray;
334 }
335
336 PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, type, (void*)(v.data()));
337 return varray;
338}
339
340
341template<typename Numeric>

Callers 15

get_listlistFunction · 0.85
plotFunction · 0.85
plot3Function · 0.85
stemFunction · 0.85
fillFunction · 0.85
fill_betweenFunction · 0.85
histFunction · 0.85
scatterFunction · 0.85
boxplotFunction · 0.85
barFunction · 0.85
named_histFunction · 0.85
contourFunction · 0.85

Calls 1

dataMethod · 0.80

Tested by

no test coverage detected