MCPcopy Create free account
hub / github.com/accellera-official/systemc / get_array

Function get_array

examples/sysc/async_suspend/matplotlibcpp.h:270–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268
269template<typename Numeric>
270PyObject* get_array(const std::vector<Numeric>& v)
271{
272 detail::_interpreter::get(); //interpreter needs to be initialized for the numpy commands to work
273 NPY_TYPES type = select_npy_type<Numeric>::type;
274 if (type == NPY_NOTYPE)
275 {
276 std::vector<double> vd(v.size());
277 npy_intp vsize = v.size();
278 std::copy(v.begin(),v.end(),vd.begin());
279 PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, NPY_DOUBLE, (void*)(vd.data()));
280 return varray;
281 }
282
283 npy_intp vsize = v.size();
284 PyObject* varray = PyArray_SimpleNewFromData(1, &vsize, type, (void*)(v.data()));
285 return varray;
286}
287
288template<typename Numeric>
289PyObject* get_2darray(const std::vector<::std::vector<Numeric>>& v)

Callers 15

plotFunction · 0.85
stemFunction · 0.85
fillFunction · 0.85
fill_betweenFunction · 0.85
histFunction · 0.85
scatterFunction · 0.85
barFunction · 0.85
named_histFunction · 0.85
quiverFunction · 0.85
semilogxFunction · 0.85
semilogyFunction · 0.85
loglogFunction · 0.85

Calls 5

copyFunction · 0.85
atMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected