MCPcopy Create free account
hub / github.com/numpy/numpy / check_object

Function check_object

numpy/linalg/lapack_litemodule.c:75–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73#define TRY(E) if (!(E)) return NULL
74
75static int
76check_object(PyObject *ob, int t, char *obname,
77 char *tname, char *funname)
78{
79 if (!PyArray_Check(ob)) {
80 PyErr_Format(LapackError,
81 "Expected an array for parameter %s in lapack_lite.%s",
82 obname, funname);
83 return 0;
84 }
85 else if (!PyArray_IS_C_CONTIGUOUS((PyArrayObject *)ob)) {
86 PyErr_Format(LapackError,
87 "Parameter %s is not contiguous in lapack_lite.%s",
88 obname, funname);
89 return 0;
90 }
91 else if (!(PyArray_TYPE((PyArrayObject *)ob) == t)) {
92 PyErr_Format(LapackError,
93 "Parameter %s is not of type %s in lapack_lite.%s",
94 obname, tname, funname);
95 return 0;
96 }
97 else if (PyArray_ISBYTESWAPPED((PyArrayObject *)ob)) {
98 PyErr_Format(LapackError,
99 "Parameter %s has non-native byte order in lapack_lite.%s",
100 obname, funname);
101 return 0;
102 }
103 else {
104 return 1;
105 }
106}
107
108#define CHDATA(p) ((char *) PyArray_DATA((PyArrayObject *)p))
109#define SHDATA(p) ((short int *) PyArray_DATA((PyArrayObject *)p))

Callers 6

lapack_lite_dgelsdFunction · 0.85
lapack_lite_dgeqrfFunction · 0.85
lapack_lite_dorgqrFunction · 0.85
lapack_lite_zgelsdFunction · 0.85
lapack_lite_zgeqrfFunction · 0.85
lapack_lite_zungqrFunction · 0.85

Calls 1

PyArray_TYPEFunction · 0.85

Tested by

no test coverage detected