4
See umfpack.py for more information.
6
Created by: Robert Cimrman
11
#include "numpy/arrayobject.h"
14
%feature("autodoc", "1");
24
Appends @a what to @a where. On input, @a where need not to be a tuple, but on
27
@par Revision history:
30
PyObject *helper_appendToTuple( PyObject *where, PyObject *what ) {
33
if ((!where) || (where == Py_None)) {
36
if (!PyTuple_Check( where )) {
38
where = PyTuple_New( 1 );
39
PyTuple_SetItem( where, 0, o2 );
41
o3 = PyTuple_New( 1 );
42
PyTuple_SetItem( o3, 0, what );
44
where = PySequence_Concat( o2, o3 );
52
Gets PyArrayObject from a PyObject.
54
@par Revision history:
61
PyArrayObject *helper_getCArrayObject( PyObject *input, int type,
62
int minDim, int maxDim ) {
65
if (PyArray_Check( input )) {
66
obj = (PyArrayObject *) input;
67
if (!PyArray_ISCARRAY( obj )) {
68
PyErr_SetString( PyExc_TypeError, "not a C array" );
71
obj = (PyArrayObject *)
72
PyArray_ContiguousFromAny( input, type, minDim, maxDim );
73
if (!obj) return NULL;
75
PyErr_SetString( PyExc_TypeError, "not an array" );
83
Use for arrays as input arguments. Could be also used for changing an array
86
@a rtype ... return this C data type
87
@a ctype ... C data type of the C function
88
@a atype ... PyArray_* suffix
90
@par Revision history:
93
#define ARRAY_IN( rtype, ctype, atype ) \
94
%typemap( python, in ) (ctype *array) { \
96
obj = helper_getCArrayObject( $input, PyArray_##atype, 1, 1 ); \
97
if (!obj) return NULL; \
98
$1 = (rtype *) obj->data; \
103
@par Revision history:
106
#define CONF_IN( arSize ) \
107
%typemap( python, in ) (double conf [arSize]) { \
108
PyArrayObject *obj; \
109
obj = helper_getCArrayObject( $input, PyArray_DOUBLE, 1, 1 ); \
110
if (!obj) return NULL; \
111
if ((obj->nd != 1) || (obj->dimensions[0] != arSize)) { \
112
PyErr_SetString( PyExc_ValueError, "wrong Control/Info array size" ); \
116
$1 = (double *) obj->data; \
120
@par Revision history:
124
#define OPAQUE_ARGOUT( ttype ) \
125
%typemap( python, in, numinputs=0 ) ttype* opaque_argout( ttype tmp ) { \
128
%typemap( python, argout ) ttype* opaque_argout { \
130
obj = SWIG_NewPointerObj( (ttype) (*$1), $*1_descriptor, 1 ); \
131
$result = helper_appendToTuple( $result, obj ); \
135
@par Revision history:
138
#define OPAQUE_ARGINOUT( ttype ) \
139
%typemap( python, in ) ttype* opaque_arginout( ttype tmp ) { \
140
if ((SWIG_ConvertPtr( $input,(void **) &tmp, $*1_descriptor, \
141
SWIG_POINTER_EXCEPTION)) == -1) return NULL; \
144
%typemap( python, argout ) ttype* opaque_arginout { \
146
obj = SWIG_NewPointerObj( (ttype) (*$1), $*1_descriptor, 1 ); \
147
$result = helper_appendToTuple( $result, obj ); \
150
ARRAY_IN( int, const int, INT )
151
%apply const int *array {
156
ARRAY_IN( long, const long, LONG )
157
%apply const long *array {
162
ARRAY_IN( double, const double, DOUBLE )
163
%apply const double *array {
171
ARRAY_IN( double, double, DOUBLE )
172
%apply double *array {
178
CONF_IN( UMFPACK_CONTROL )
179
%apply (double conf [UMFPACK_CONTROL]) {
183
CONF_IN( UMFPACK_INFO )
184
%apply double conf [UMFPACK_INFO] {
189
%include <umfpack_solve.h>
190
%include <umfpack_defaults.h>
191
%include <umfpack_triplet_to_col.h>
192
%include <umfpack_col_to_triplet.h>
193
%include <umfpack_transpose.h>
194
%include <umfpack_scale.h>
196
%include <umfpack_report_symbolic.h>
197
%include <umfpack_report_numeric.h>
198
%include <umfpack_report_info.h>
199
%include <umfpack_report_control.h>
202
The order is important below!
205
OPAQUE_ARGOUT( void * )
206
%apply void ** opaque_argout {
211
%include <umfpack_symbolic.h>
212
%include <umfpack_numeric.h>
215
OPAQUE_ARGINOUT( void * )
216
%apply void ** opaque_arginout {
221
%include <umfpack_free_symbolic.h>
222
%include <umfpack_free_numeric.h>
227
* wnbell - attempt to get L,U,P,Q out
229
%include "typemaps.i"
237
%apply long *OUTPUT {
244
%include <umfpack_get_lunz.h>
247
ARRAY_IN( double, double, DOUBLE )
248
%apply double *array {
258
ARRAY_IN( int, int, INT )
267
%apply int *OUTPUT { int *do_recip};
268
%include <umfpack_get_numeric.h>