MCPcopy Create free account
hub / github.com/Singular/Singular / matrixFromArray

Function matrixFromArray

Singular/dyn_modules/python/interpreter_support.cc:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35#endif
36
37matrix matrixFromArray(const NumpyArrayType& f)
38{
39 object o=f.attr("shape");
40 object o1=o[0];
41 object o2=o[1];
42 int l1=extract<int>(o1);
43 int l2=extract<int>(o2);
44 matrix m=mpNew(l1,l2);
45 for(int i=0;i<l1;i++)
46 {
47 for(int j=0;j<l2;j++)
48 {
49 Poly& x = boost::python::extract<Poly&>(f[boost::python::make_tuple(i,j)]);
50 poly p=x.as_poly();
51 MATELEM(m,i+1,j+1)=p;
52 }
53 }
54 return m;
55}
56bool is_builtin(const char* name)
57{
58 int cmd_n=-1;

Callers 2

appendArrayMethod · 0.85
writeArrayMethod · 0.85

Calls 3

mpNewFunction · 0.85
attrMethod · 0.80
as_polyMethod · 0.45

Tested by

no test coverage detected