-
Notifications
You must be signed in to change notification settings - Fork 2
/
_expokitmodule.c
1680 lines (1594 loc) · 60.2 KB
/
_expokitmodule.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* File: _expokitmodule.c
* This file is auto-generated with f2py (version:2).
* f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
* written by Pearu Peterson <[email protected]>.
* See http://cens.ioc.ee/projects/f2py2e/
* Generation date: Mon Feb 13 14:58:51 2017
* $Revision:$
* $Date:$
* Do not edit this file directly unless you know what you are doing!!!
*/
#ifdef __cplusplus
extern "C" {
#endif
/*********************** See f2py2e/cfuncs.py: includes ***********************/
#include "Python.h"
#include <stdarg.h>
#include "fortranobject.h"
#include <string.h>
#include <setjmp.h>
#include <math.h>
/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/
static PyObject *_expokit_error;
static PyObject *_expokit_module;
/*********************** See f2py2e/cfuncs.py: typedefs ***********************/
typedef signed char signed_char;
typedef struct {double r,i;} complex_double;
/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/
typedef void(*cb_matvec_in___user__routines_complex_typedef)(int *,complex_double *,complex_double *);
typedef void(*cb_matvec_in___user__routines_real_typedef)(int *,double *,double *);
/********************** See f2py2e/cfuncs.py: cppmacros **********************/
#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a < b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a < b) ? (a) : (b))
#endif
#define PRINTPYOBJERR(obj)\
fprintf(stderr,"_expokit.error is related to ");\
PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\
fprintf(stderr,"\n");
\
#define FAILNULL(p) do { \
if ((p) == NULL) { \
PyErr_SetString(PyExc_MemoryError, "NULL pointer found"); \
goto capi_fail; \
} \
} while (0)
#define MEMCOPY(to,from,n)\
do { FAILNULL(to); FAILNULL(from); (void)memcpy(to,from,n); } while (0)
#define pyobj_from_int1(v) (PyInt_FromLong(v))
#ifdef DEBUGCFUNCS
#define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess);
#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \
PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\
fprintf(stderr,"\n");
#else
#define CFUNCSMESS(mess)
#define CFUNCSMESSPY(mess,obj)
#endif
#if defined(PREPEND_FORTRAN)
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F
#else
#define F_FUNC(f,F) _##f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F##_
#else
#define F_FUNC(f,F) _##f##_
#endif
#endif
#else
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif
#endif
#if defined(UNDERSCORE_G77)
#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)
#else
#define F_FUNC_US(f,F) F_FUNC(f,F)
#endif
#define rank(var) var ## _Rank
#define shape(var,dim) var ## _Dims[dim]
#define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp)))
#define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim)
#define fshape(var,dim) shape(var,rank(var)-dim-1)
#define len(var) shape(var,0)
#define flen(var) fshape(var,0)
#define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp))
/* #define index(i) capi_i ## i */
#define slen(var) capi_ ## var ## _len
#define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1)
#define CHECKARRAY(check,tcheck,name) \
if (!(check)) {\
PyErr_SetString(_expokit_error,"("tcheck") failed for "name);\
/*goto capi_fail;*/\
} else
#define SWAP(a,b,t) {\
t *c;\
c = a;\
a = b;\
b = c;}
/************************ See f2py2e/cfuncs.py: cfuncs ************************/
static int f2py_size(PyArrayObject* var, ...)
{
npy_int sz = 0;
npy_int dim;
npy_int rank;
va_list argp;
va_start(argp, var);
dim = va_arg(argp, npy_int);
if (dim==-1)
{
sz = PyArray_SIZE(var);
}
else
{
rank = PyArray_NDIM(var);
if (dim>=1 && dim<=rank)
sz = PyArray_DIM(var, dim-1);
else
fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank);
}
va_end(argp);
return sz;
}
static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) {
PyObject* tmp = NULL;
if (PyInt_Check(obj)) {
*v = (int)PyInt_AS_LONG(obj);
return 1;
}
tmp = PyNumber_Int(obj);
if (tmp) {
*v = PyInt_AS_LONG(tmp);
Py_DECREF(tmp);
return 1;
}
if (PyComplex_Check(obj))
tmp = PyObject_GetAttrString(obj,"real");
else if (PyString_Check(obj) || PyUnicode_Check(obj))
/*pass*/;
else if (PySequence_Check(obj))
tmp = PySequence_GetItem(obj,0);
if (tmp) {
PyErr_Clear();
if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
Py_DECREF(tmp);
}
{
PyObject* err = PyErr_Occurred();
if (err==NULL) err = _expokit_error;
PyErr_SetString(err,errmess);
}
return 0;
}
static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) {
PyObject* tmp = NULL;
if (PyFloat_Check(obj)) {
#ifdef __sgi
*v = PyFloat_AsDouble(obj);
#else
*v = PyFloat_AS_DOUBLE(obj);
#endif
return 1;
}
tmp = PyNumber_Float(obj);
if (tmp) {
#ifdef __sgi
*v = PyFloat_AsDouble(tmp);
#else
*v = PyFloat_AS_DOUBLE(tmp);
#endif
Py_DECREF(tmp);
return 1;
}
if (PyComplex_Check(obj))
tmp = PyObject_GetAttrString(obj,"real");
else if (PyString_Check(obj) || PyUnicode_Check(obj))
/*pass*/;
else if (PySequence_Check(obj))
tmp = PySequence_GetItem(obj,0);
if (tmp) {
PyErr_Clear();
if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
Py_DECREF(tmp);
}
{
PyObject* err = PyErr_Occurred();
if (err==NULL) err = _expokit_error;
PyErr_SetString(err,errmess);
}
return 0;
}
static int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) {
PyObject *tmp = NULL;
PyObject *tmp_fun = NULL;
int tot,opt,ext,siz,i,di=0;
CFUNCSMESS("create_cb_arglist\n");
tot=opt=ext=siz=0;
/* Get the total number of arguments */
if (PyFunction_Check(fun))
tmp_fun = fun;
else {
di = 1;
if (PyObject_HasAttrString(fun,"im_func")) {
tmp_fun = PyObject_GetAttrString(fun,"im_func");
}
else if (PyObject_HasAttrString(fun,"__call__")) {
tmp = PyObject_GetAttrString(fun,"__call__");
if (PyObject_HasAttrString(tmp,"im_func"))
tmp_fun = PyObject_GetAttrString(tmp,"im_func");
else {
tmp_fun = fun; /* built-in function */
tot = maxnofargs;
if (xa != NULL)
tot += PyTuple_Size((PyObject *)xa);
}
Py_XDECREF(tmp);
}
else if (PyFortran_Check(fun) || PyFortran_Check1(fun)) {
tot = maxnofargs;
if (xa != NULL)
tot += PyTuple_Size((PyObject *)xa);
tmp_fun = fun;
}
else if (F2PyCapsule_Check(fun)) {
tot = maxnofargs;
if (xa != NULL)
ext = PyTuple_Size((PyObject *)xa);
if(ext>0) {
fprintf(stderr,"extra arguments tuple cannot be used with CObject call-back\n");
goto capi_fail;
}
tmp_fun = fun;
}
}
if (tmp_fun==NULL) {
fprintf(stderr,"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\n",(fun==NULL?"NULL":Py_TYPE(fun)->tp_name));
goto capi_fail;
}
#if PY_VERSION_HEX >= 0x03000000
if (PyObject_HasAttrString(tmp_fun,"__code__")) {
if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,"__code__"),"co_argcount"))
#else
if (PyObject_HasAttrString(tmp_fun,"func_code")) {
if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,"func_code"),"co_argcount"))
#endif
tot = PyInt_AsLong(PyObject_GetAttrString(tmp,"co_argcount")) - di;
Py_XDECREF(tmp);
}
/* Get the number of optional arguments */
#if PY_VERSION_HEX >= 0x03000000
if (PyObject_HasAttrString(tmp_fun,"__defaults__")) {
if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,"__defaults__")))
#else
if (PyObject_HasAttrString(tmp_fun,"func_defaults")) {
if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,"func_defaults")))
#endif
opt = PyTuple_Size(tmp);
Py_XDECREF(tmp);
}
/* Get the number of extra arguments */
if (xa != NULL)
ext = PyTuple_Size((PyObject *)xa);
/* Calculate the size of call-backs argument list */
siz = MIN(maxnofargs+ext,tot);
*nofargs = MAX(0,siz-ext);
#ifdef DEBUGCFUNCS
fprintf(stderr,"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\n",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs);
#endif
if (siz<tot-opt) {
fprintf(stderr,"create_cb_arglist: Failed to build argument list (siz) with enough arguments (tot-opt) required by user-supplied function (siz,tot,opt=%d,%d,%d).\n",siz,tot,opt);
goto capi_fail;
}
/* Initialize argument list */
*args = (PyTupleObject *)PyTuple_New(siz);
for (i=0;i<*nofargs;i++) {
Py_INCREF(Py_None);
PyTuple_SET_ITEM((PyObject *)(*args),i,Py_None);
}
if (xa != NULL)
for (i=(*nofargs);i<siz;i++) {
tmp = PyTuple_GetItem((PyObject *)xa,i-(*nofargs));
Py_INCREF(tmp);
PyTuple_SET_ITEM(*args,i,tmp);
}
CFUNCSMESS("create_cb_arglist-end\n");
return 1;
capi_fail:
if ((PyErr_Occurred())==NULL)
PyErr_SetString(_expokit_error,errmess);
return 0;
}
/********************* See f2py2e/cfuncs.py: userincludes *********************/
/*need_userincludes*/
/********************* See f2py2e/capi_rules.py: usercode *********************/
/* See f2py2e/rules.py */
extern void F_FUNC(dsexpv,DSEXPV)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*);
extern void F_FUNC(dgexpv,DGEXPV)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*);
extern void F_FUNC(zhexpv,ZHEXPV)(int*,int*,double*,complex_double*,complex_double*,double*,double*,complex_double*,int*,int*,int*,cb_matvec_in___user__routines_complex_typedef,int*,int*);
extern void F_FUNC(zgexpv,ZGEXPV)(int*,int*,double*,complex_double*,complex_double*,double*,double*,complex_double*,int*,int*,int*,cb_matvec_in___user__routines_complex_typedef,int*,int*);
/*eof externroutines*/
/******************** See f2py2e/capi_rules.py: usercode1 ********************/
/******************* See f2py2e/cb_rules.py: buildcallback *******************/
/********************* cb_matvec_in___user__routines_real *********************/
PyObject *cb_matvec_in___user__routines_real_capi = NULL;/*was Py_None*/
PyTupleObject *cb_matvec_in___user__routines_real_args_capi = NULL;
int cb_matvec_in___user__routines_real_nofargs = 0;
jmp_buf cb_matvec_in___user__routines_real_jmpbuf;
/*typedef void(*cb_matvec_in___user__routines_real_typedef)(int *,double *,double *);*/
static void cb_matvec_in___user__routines_real (int *n_cb_capi,double *x,double *y) {
PyTupleObject *capi_arglist = cb_matvec_in___user__routines_real_args_capi;
PyObject *capi_return = NULL;
PyObject *capi_tmp = NULL;
int capi_j,capi_i = 0;
int capi_longjmp_ok = 1;
/*decl*/
int n=(*n_cb_capi);
npy_intp x_Dims[1] = {-1};
npy_intp y_Dims[1] = {-1};
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_start_clock();
#endif
CFUNCSMESS("cb:Call-back function cb_matvec_in___user__routines_real (maxnofargs=2(-1))\n");
CFUNCSMESSPY("cb:cb_matvec_in___user__routines_real_capi=",cb_matvec_in___user__routines_real_capi);
if (cb_matvec_in___user__routines_real_capi==NULL) {
capi_longjmp_ok = 0;
cb_matvec_in___user__routines_real_capi = PyObject_GetAttrString(_expokit_module,"matvec");
}
if (cb_matvec_in___user__routines_real_capi==NULL) {
PyErr_SetString(_expokit_error,"cb: Callback matvec not defined (as an argument or module _expokit attribute).\n");
goto capi_fail;
}
if (F2PyCapsule_Check(cb_matvec_in___user__routines_real_capi)) {
cb_matvec_in___user__routines_real_typedef cb_matvec_in___user__routines_real_cptr;
cb_matvec_in___user__routines_real_cptr = F2PyCapsule_AsVoidPtr(cb_matvec_in___user__routines_real_capi);
(*cb_matvec_in___user__routines_real_cptr)(n_cb_capi,x,y);
return;
}
if (capi_arglist==NULL) {
capi_longjmp_ok = 0;
capi_tmp = PyObject_GetAttrString(_expokit_module,"matvec_extra_args");
if (capi_tmp) {
capi_arglist = (PyTupleObject *)PySequence_Tuple(capi_tmp);
if (capi_arglist==NULL) {
PyErr_SetString(_expokit_error,"Failed to convert _expokit.matvec_extra_args to tuple.\n");
goto capi_fail;
}
} else {
PyErr_Clear();
capi_arglist = (PyTupleObject *)Py_BuildValue("()");
}
}
if (capi_arglist == NULL) {
PyErr_SetString(_expokit_error,"Callback matvec argument list is not set.\n");
goto capi_fail;
}
/*setdims*/
x_Dims[0]=n;
y_Dims[0]=n;
/*pyobjfrom*/
if (cb_matvec_in___user__routines_real_nofargs>capi_i) {
PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,x_Dims,NPY_DOUBLE,NULL,(char*)x,0,NPY_ARRAY_FARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */
if (tmp_arr==NULL)
goto capi_fail;
if (PyTuple_SetItem((PyObject *)capi_arglist,capi_i++,(PyObject *)tmp_arr))
goto capi_fail;
}
if (cb_matvec_in___user__routines_real_nofargs>capi_i)
if (PyTuple_SetItem((PyObject *)capi_arglist,capi_i++,pyobj_from_int1(n)))
goto capi_fail;
CFUNCSMESSPY("cb:capi_arglist=",capi_arglist);
CFUNCSMESS("cb:Call-back calling Python function matvec.\n");
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_start_call_clock();
#endif
capi_return = PyObject_CallObject(cb_matvec_in___user__routines_real_capi,(PyObject *)capi_arglist);
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_stop_call_clock();
#endif
CFUNCSMESSPY("cb:capi_return=",capi_return);
if (capi_return == NULL) {
fprintf(stderr,"capi_return is NULL\n");
goto capi_fail;
}
if (capi_return == Py_None) {
Py_DECREF(capi_return);
capi_return = Py_BuildValue("()");
}
else if (!PyTuple_Check(capi_return)) {
capi_return = Py_BuildValue("(N)",capi_return);
}
capi_j = PyTuple_Size(capi_return);
capi_i = 0;
/*frompyobj*/
if (capi_j>capi_i) {
PyArrayObject *rv_cb_arr = NULL;
if ((capi_tmp = PyTuple_GetItem(capi_return,capi_i++))==NULL) goto capi_fail;
rv_cb_arr = array_from_pyobj(NPY_DOUBLE,y_Dims,1,F2PY_INTENT_IN
,capi_tmp);
if (rv_cb_arr == NULL) {
fprintf(stderr,"rv_cb_arr is NULL\n");
goto capi_fail;
}
MEMCOPY(y,PyArray_DATA(rv_cb_arr),PyArray_NBYTES(rv_cb_arr));
if (capi_tmp != (PyObject *)rv_cb_arr) {
Py_DECREF(rv_cb_arr);
}
}
CFUNCSMESS("cb:cb_matvec_in___user__routines_real:successful\n");
Py_DECREF(capi_return);
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_stop_clock();
#endif
goto capi_return_pt;
capi_fail:
fprintf(stderr,"Call-back cb_matvec_in___user__routines_real failed.\n");
Py_XDECREF(capi_return);
if (capi_longjmp_ok)
longjmp(cb_matvec_in___user__routines_real_jmpbuf,-1);
capi_return_pt:
;
return;
}
/***************** end of cb_matvec_in___user__routines_real *****************/
/******************* cb_matvec_in___user__routines_complex *******************/
PyObject *cb_matvec_in___user__routines_complex_capi = NULL;/*was Py_None*/
PyTupleObject *cb_matvec_in___user__routines_complex_args_capi = NULL;
int cb_matvec_in___user__routines_complex_nofargs = 0;
jmp_buf cb_matvec_in___user__routines_complex_jmpbuf;
/*typedef void(*cb_matvec_in___user__routines_complex_typedef)(int *,complex_double *,complex_double *);*/
static void cb_matvec_in___user__routines_complex (int *n_cb_capi,complex_double *x,complex_double *y) {
PyTupleObject *capi_arglist = cb_matvec_in___user__routines_complex_args_capi;
PyObject *capi_return = NULL;
PyObject *capi_tmp = NULL;
int capi_j,capi_i = 0;
int capi_longjmp_ok = 1;
/*decl*/
int n=(*n_cb_capi);
npy_intp x_Dims[1] = {-1};
npy_intp y_Dims[1] = {-1};
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_start_clock();
#endif
CFUNCSMESS("cb:Call-back function cb_matvec_in___user__routines_complex (maxnofargs=2(-1))\n");
CFUNCSMESSPY("cb:cb_matvec_in___user__routines_complex_capi=",cb_matvec_in___user__routines_complex_capi);
if (cb_matvec_in___user__routines_complex_capi==NULL) {
capi_longjmp_ok = 0;
cb_matvec_in___user__routines_complex_capi = PyObject_GetAttrString(_expokit_module,"matvec");
}
if (cb_matvec_in___user__routines_complex_capi==NULL) {
PyErr_SetString(_expokit_error,"cb: Callback matvec not defined (as an argument or module _expokit attribute).\n");
goto capi_fail;
}
if (F2PyCapsule_Check(cb_matvec_in___user__routines_complex_capi)) {
cb_matvec_in___user__routines_complex_typedef cb_matvec_in___user__routines_complex_cptr;
cb_matvec_in___user__routines_complex_cptr = F2PyCapsule_AsVoidPtr(cb_matvec_in___user__routines_complex_capi);
(*cb_matvec_in___user__routines_complex_cptr)(n_cb_capi,x,y);
return;
}
if (capi_arglist==NULL) {
capi_longjmp_ok = 0;
capi_tmp = PyObject_GetAttrString(_expokit_module,"matvec_extra_args");
if (capi_tmp) {
capi_arglist = (PyTupleObject *)PySequence_Tuple(capi_tmp);
if (capi_arglist==NULL) {
PyErr_SetString(_expokit_error,"Failed to convert _expokit.matvec_extra_args to tuple.\n");
goto capi_fail;
}
} else {
PyErr_Clear();
capi_arglist = (PyTupleObject *)Py_BuildValue("()");
}
}
if (capi_arglist == NULL) {
PyErr_SetString(_expokit_error,"Callback matvec argument list is not set.\n");
goto capi_fail;
}
/*setdims*/
x_Dims[0]=n;
y_Dims[0]=n;
/*pyobjfrom*/
if (cb_matvec_in___user__routines_complex_nofargs>capi_i) {
PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,x_Dims,NPY_CDOUBLE,NULL,(char*)x,0,NPY_ARRAY_FARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */
if (tmp_arr==NULL)
goto capi_fail;
if (PyTuple_SetItem((PyObject *)capi_arglist,capi_i++,(PyObject *)tmp_arr))
goto capi_fail;
}
if (cb_matvec_in___user__routines_complex_nofargs>capi_i)
if (PyTuple_SetItem((PyObject *)capi_arglist,capi_i++,pyobj_from_int1(n)))
goto capi_fail;
CFUNCSMESSPY("cb:capi_arglist=",capi_arglist);
CFUNCSMESS("cb:Call-back calling Python function matvec.\n");
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_start_call_clock();
#endif
capi_return = PyObject_CallObject(cb_matvec_in___user__routines_complex_capi,(PyObject *)capi_arglist);
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_stop_call_clock();
#endif
CFUNCSMESSPY("cb:capi_return=",capi_return);
if (capi_return == NULL) {
fprintf(stderr,"capi_return is NULL\n");
goto capi_fail;
}
if (capi_return == Py_None) {
Py_DECREF(capi_return);
capi_return = Py_BuildValue("()");
}
else if (!PyTuple_Check(capi_return)) {
capi_return = Py_BuildValue("(N)",capi_return);
}
capi_j = PyTuple_Size(capi_return);
capi_i = 0;
/*frompyobj*/
if (capi_j>capi_i) {
PyArrayObject *rv_cb_arr = NULL;
if ((capi_tmp = PyTuple_GetItem(capi_return,capi_i++))==NULL) goto capi_fail;
rv_cb_arr = array_from_pyobj(NPY_CDOUBLE,y_Dims,1,F2PY_INTENT_IN
,capi_tmp);
if (rv_cb_arr == NULL) {
fprintf(stderr,"rv_cb_arr is NULL\n");
goto capi_fail;
}
MEMCOPY(y,PyArray_DATA(rv_cb_arr),PyArray_NBYTES(rv_cb_arr));
if (capi_tmp != (PyObject *)rv_cb_arr) {
Py_DECREF(rv_cb_arr);
}
}
CFUNCSMESS("cb:cb_matvec_in___user__routines_complex:successful\n");
Py_DECREF(capi_return);
#ifdef F2PY_REPORT_ATEXIT
f2py_cb_stop_clock();
#endif
goto capi_return_pt;
capi_fail:
fprintf(stderr,"Call-back cb_matvec_in___user__routines_complex failed.\n");
Py_XDECREF(capi_return);
if (capi_longjmp_ok)
longjmp(cb_matvec_in___user__routines_complex_jmpbuf,-1);
capi_return_pt:
;
return;
}
/**************** end of cb_matvec_in___user__routines_complex ****************/
/*********************** See f2py2e/rules.py: buildapi ***********************/
/*********************************** dsexpv ***********************************/
static char doc_f2py_rout__expokit_dsexpv[] = "\
w,tol,iflag = dsexpv(m,t,v,tol,anorm,wsp,iwsp,matvec,itrace,[matvec_extra_args])\n\nWrapper for ``dsexpv``.\
\n\nParameters\n----------\n"
"m : input int\n"
"t : input float\n"
"v : input rank-1 array('d') with bounds (n)\n"
"tol : input float\n"
"anorm : input float\n"
"wsp : input rank-1 array('d') with bounds (*)\n"
"iwsp : input rank-1 array('i') with bounds (*)\n"
"matvec : call-back function\n"
"itrace : input int\n"
"\nOther Parameters\n----------------\n"
"matvec_extra_args : input tuple, optional\n Default: ()\n"
"\nReturns\n-------\n"
"w : rank-1 array('d') with bounds (n)\n"
"tol : float\n"
"iflag : int\n"
"\nNotes\n-----\nCall-back functions::\n\n"
" def matvec(x,[n]): return y\n\
Required arguments:\n"
" x : input rank-1 array('d') with bounds (n)\n"
" Optional arguments:\n"
" n : input int, optional\n Default: len(x)\n"
" Return objects:\n"
" y : rank-1 array('d') with bounds (n)";
/* extern void F_FUNC(dsexpv,DSEXPV)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*); */
static PyObject *f2py_rout__expokit_dsexpv(const PyObject *capi_self,
PyObject *capi_args,
PyObject *capi_keywds,
void (*f2py_func)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*)) {
PyObject * volatile capi_buildvalue = NULL;
volatile int f2py_success = 1;
/*decl*/
int n = 0;
int m = 0;
PyObject *m_capi = Py_None;
double t = 0;
PyObject *t_capi = Py_None;
double *v = NULL;
npy_intp v_Dims[1] = {-1};
const int v_Rank = 1;
PyArrayObject *capi_v_tmp = NULL;
int capi_v_intent = 0;
PyObject *v_capi = Py_None;
double *w = NULL;
npy_intp w_Dims[1] = {-1};
const int w_Rank = 1;
PyArrayObject *capi_w_tmp = NULL;
int capi_w_intent = 0;
double tol = 0;
PyObject *tol_capi = Py_None;
double anorm = 0;
PyObject *anorm_capi = Py_None;
double *wsp = NULL;
npy_intp wsp_Dims[1] = {-1};
const int wsp_Rank = 1;
PyArrayObject *capi_wsp_tmp = NULL;
int capi_wsp_intent = 0;
PyObject *wsp_capi = Py_None;
int lwsp = 0;
int *iwsp = NULL;
npy_intp iwsp_Dims[1] = {-1};
const int iwsp_Rank = 1;
PyArrayObject *capi_iwsp_tmp = NULL;
int capi_iwsp_intent = 0;
PyObject *iwsp_capi = Py_None;
int liwsp = 0;
PyObject *matvec_capi = Py_None;
PyTupleObject *matvec_xa_capi = NULL;
PyTupleObject *matvec_args_capi = NULL;
int matvec_nofargs_capi = 0;
cb_matvec_in___user__routines_real_typedef matvec_cptr;
int itrace = 0;
PyObject *itrace_capi = Py_None;
int iflag = 0;
static char *capi_kwlist[] = {"m","t","v","tol","anorm","wsp","iwsp","matvec","itrace","matvec_extra_args",NULL};
/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
"OOOOOOOOO|O!:_expokit.dsexpv",\
capi_kwlist,&m_capi,&t_capi,&v_capi,&tol_capi,&anorm_capi,&wsp_capi,&iwsp_capi,&matvec_capi,&itrace_capi,&PyTuple_Type,&matvec_xa_capi))
return NULL;
/*frompyobj*/
/* Processing variable itrace */
f2py_success = int_from_pyobj(&itrace,itrace_capi,"_expokit.dsexpv() 9th argument (itrace) can't be converted to int");
if (f2py_success) {
/* Processing variable wsp */
;
capi_wsp_intent |= F2PY_INTENT_IN;
capi_wsp_tmp = array_from_pyobj(NPY_DOUBLE,wsp_Dims,wsp_Rank,capi_wsp_intent,wsp_capi);
if (capi_wsp_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 6th argument `wsp' of _expokit.dsexpv to C/Fortran array" );
} else {
wsp = (double *)(PyArray_DATA(capi_wsp_tmp));
CHECKARRAY(len(wsp)>=7+n*(m+2)+5*(m+2)*(m+2),"len(wsp)>=7+n*(m+2)+5*(m+2)*(m+2)","6th argument wsp") {
/* Processing variable m */
f2py_success = int_from_pyobj(&m,m_capi,"_expokit.dsexpv() 1st argument (m) can't be converted to int");
if (f2py_success) {
/* Processing variable iwsp */
;
capi_iwsp_intent |= F2PY_INTENT_IN;
capi_iwsp_tmp = array_from_pyobj(NPY_INT,iwsp_Dims,iwsp_Rank,capi_iwsp_intent,iwsp_capi);
if (capi_iwsp_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 7th argument `iwsp' of _expokit.dsexpv to C/Fortran array" );
} else {
iwsp = (int *)(PyArray_DATA(capi_iwsp_tmp));
CHECKARRAY(len(iwsp)>=m+2,"len(iwsp)>=m+2","7th argument iwsp") {
/* Processing variable iflag */
/* Processing variable tol */
f2py_success = double_from_pyobj(&tol,tol_capi,"_expokit.dsexpv() 4th argument (tol) can't be converted to double");
if (f2py_success) {
/* Processing variable t */
f2py_success = double_from_pyobj(&t,t_capi,"_expokit.dsexpv() 2nd argument (t) can't be converted to double");
if (f2py_success) {
/* Processing variable anorm */
f2py_success = double_from_pyobj(&anorm,anorm_capi,"_expokit.dsexpv() 5th argument (anorm) can't be converted to double");
if (f2py_success) {
/* Processing variable v */
;
capi_v_intent |= F2PY_INTENT_IN;
capi_v_tmp = array_from_pyobj(NPY_DOUBLE,v_Dims,v_Rank,capi_v_intent,v_capi);
if (capi_v_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 3rd argument `v' of _expokit.dsexpv to C/Fortran array" );
} else {
v = (double *)(PyArray_DATA(capi_v_tmp));
/* Processing variable matvec */
if(F2PyCapsule_Check(matvec_capi)) {
matvec_cptr = F2PyCapsule_AsVoidPtr(matvec_capi);
} else {
matvec_cptr = cb_matvec_in___user__routines_real;
}
matvec_nofargs_capi = cb_matvec_in___user__routines_real_nofargs;
if (create_cb_arglist(matvec_capi,matvec_xa_capi,2,1,&cb_matvec_in___user__routines_real_nofargs,&matvec_args_capi,"failed in processing argument list for call-back matvec.")) {
jmp_buf matvec_jmpbuf;
CFUNCSMESS("Saving jmpbuf for `matvec`.\n");
SWAP(matvec_capi,cb_matvec_in___user__routines_real_capi,PyObject);
SWAP(matvec_args_capi,cb_matvec_in___user__routines_real_args_capi,PyTupleObject);
memcpy(&matvec_jmpbuf,&cb_matvec_in___user__routines_real_jmpbuf,sizeof(jmp_buf));
/* Processing variable lwsp */
lwsp = len(wsp);
/* Processing variable n */
n = len(v);
/* Processing variable liwsp */
liwsp = len(iwsp);
/* Processing variable w */
w_Dims[0]=n;
capi_w_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
capi_w_tmp = array_from_pyobj(NPY_DOUBLE,w_Dims,w_Rank,capi_w_intent,Py_None);
if (capi_w_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting hidden `w' of _expokit.dsexpv to C/Fortran array" );
} else {
w = (double *)(PyArray_DATA(capi_w_tmp));
/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
if ((setjmp(cb_matvec_in___user__routines_real_jmpbuf))) {
f2py_success = 0;
} else {
(*f2py_func)(&n,&m,&t,v,w,&tol,&anorm,wsp,&lwsp,iwsp,&liwsp,matvec_cptr,&itrace,&iflag);
}
if (PyErr_Occurred())
f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
CFUNCSMESS("Building return value.\n");
capi_buildvalue = Py_BuildValue("Ndi",capi_w_tmp,tol,iflag);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
} /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
} /*if (capi_w_tmp == NULL) ... else of w*/
/* End of cleaning variable w */
/* End of cleaning variable liwsp */
/* End of cleaning variable n */
/* End of cleaning variable lwsp */
CFUNCSMESS("Restoring jmpbuf for `matvec`.\n");
cb_matvec_in___user__routines_real_capi = matvec_capi;
Py_DECREF(cb_matvec_in___user__routines_real_args_capi);
cb_matvec_in___user__routines_real_args_capi = matvec_args_capi;
cb_matvec_in___user__routines_real_nofargs = matvec_nofargs_capi;
memcpy(&cb_matvec_in___user__routines_real_jmpbuf,&matvec_jmpbuf,sizeof(jmp_buf));
}
/* End of cleaning variable matvec */
if((PyObject *)capi_v_tmp!=v_capi) {
Py_XDECREF(capi_v_tmp); }
} /*if (capi_v_tmp == NULL) ... else of v*/
/* End of cleaning variable v */
} /*if (f2py_success) of anorm*/
/* End of cleaning variable anorm */
} /*if (f2py_success) of t*/
/* End of cleaning variable t */
} /*if (f2py_success) of tol*/
/* End of cleaning variable tol */
/* End of cleaning variable iflag */
} /*CHECKARRAY(len(iwsp)>=m+2)*/
if((PyObject *)capi_iwsp_tmp!=iwsp_capi) {
Py_XDECREF(capi_iwsp_tmp); }
} /*if (capi_iwsp_tmp == NULL) ... else of iwsp*/
/* End of cleaning variable iwsp */
} /*if (f2py_success) of m*/
/* End of cleaning variable m */
} /*CHECKARRAY(len(wsp)>=7+n*(m+2)+5*(m+2)*(m+2))*/
if((PyObject *)capi_wsp_tmp!=wsp_capi) {
Py_XDECREF(capi_wsp_tmp); }
} /*if (capi_wsp_tmp == NULL) ... else of wsp*/
/* End of cleaning variable wsp */
} /*if (f2py_success) of itrace*/
/* End of cleaning variable itrace */
/*end of cleanupfrompyobj*/
if (capi_buildvalue == NULL) {
/*routdebugfailure*/
} else {
/*routdebugleave*/
}
CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
return capi_buildvalue;
}
/******************************* end of dsexpv *******************************/
/*********************************** dgexpv ***********************************/
static char doc_f2py_rout__expokit_dgexpv[] = "\
w,tol,iflag = dgexpv(m,t,v,tol,anorm,wsp,iwsp,matvec,itrace,[matvec_extra_args])\n\nWrapper for ``dgexpv``.\
\n\nParameters\n----------\n"
"m : input int\n"
"t : input float\n"
"v : input rank-1 array('d') with bounds (n)\n"
"tol : input float\n"
"anorm : input float\n"
"wsp : input rank-1 array('d') with bounds (*)\n"
"iwsp : input rank-1 array('i') with bounds (*)\n"
"matvec : call-back function\n"
"itrace : input int\n"
"\nOther Parameters\n----------------\n"
"matvec_extra_args : input tuple, optional\n Default: ()\n"
"\nReturns\n-------\n"
"w : rank-1 array('d') with bounds (n)\n"
"tol : float\n"
"iflag : int\n"
"\nNotes\n-----\nCall-back functions::\n\n"
" def matvec(x,[n]): return y\n\
Required arguments:\n"
" x : input rank-1 array('d') with bounds (n)\n"
" Optional arguments:\n"
" n : input int, optional\n Default: len(x)\n"
" Return objects:\n"
" y : rank-1 array('d') with bounds (n)";
/* extern void F_FUNC(dgexpv,DGEXPV)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*); */
static PyObject *f2py_rout__expokit_dgexpv(const PyObject *capi_self,
PyObject *capi_args,
PyObject *capi_keywds,
void (*f2py_func)(int*,int*,double*,double*,double*,double*,double*,double*,int*,int*,int*,cb_matvec_in___user__routines_real_typedef,int*,int*)) {
PyObject * volatile capi_buildvalue = NULL;
volatile int f2py_success = 1;
/*decl*/
int n = 0;
int m = 0;
PyObject *m_capi = Py_None;
double t = 0;
PyObject *t_capi = Py_None;
double *v = NULL;
npy_intp v_Dims[1] = {-1};
const int v_Rank = 1;
PyArrayObject *capi_v_tmp = NULL;
int capi_v_intent = 0;
PyObject *v_capi = Py_None;
double *w = NULL;
npy_intp w_Dims[1] = {-1};
const int w_Rank = 1;
PyArrayObject *capi_w_tmp = NULL;
int capi_w_intent = 0;
double tol = 0;
PyObject *tol_capi = Py_None;
double anorm = 0;
PyObject *anorm_capi = Py_None;
double *wsp = NULL;
npy_intp wsp_Dims[1] = {-1};
const int wsp_Rank = 1;
PyArrayObject *capi_wsp_tmp = NULL;
int capi_wsp_intent = 0;
PyObject *wsp_capi = Py_None;
int lwsp = 0;
int *iwsp = NULL;
npy_intp iwsp_Dims[1] = {-1};
const int iwsp_Rank = 1;
PyArrayObject *capi_iwsp_tmp = NULL;
int capi_iwsp_intent = 0;
PyObject *iwsp_capi = Py_None;
int liwsp = 0;
PyObject *matvec_capi = Py_None;
PyTupleObject *matvec_xa_capi = NULL;
PyTupleObject *matvec_args_capi = NULL;
int matvec_nofargs_capi = 0;
cb_matvec_in___user__routines_real_typedef matvec_cptr;
int itrace = 0;
PyObject *itrace_capi = Py_None;
int iflag = 0;
static char *capi_kwlist[] = {"m","t","v","tol","anorm","wsp","iwsp","matvec","itrace","matvec_extra_args",NULL};
/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
"OOOOOOOOO|O!:_expokit.dgexpv",\
capi_kwlist,&m_capi,&t_capi,&v_capi,&tol_capi,&anorm_capi,&wsp_capi,&iwsp_capi,&matvec_capi,&itrace_capi,&PyTuple_Type,&matvec_xa_capi))
return NULL;
/*frompyobj*/
/* Processing variable itrace */
f2py_success = int_from_pyobj(&itrace,itrace_capi,"_expokit.dgexpv() 9th argument (itrace) can't be converted to int");
if (f2py_success) {
/* Processing variable wsp */
;
capi_wsp_intent |= F2PY_INTENT_IN;
capi_wsp_tmp = array_from_pyobj(NPY_DOUBLE,wsp_Dims,wsp_Rank,capi_wsp_intent,wsp_capi);
if (capi_wsp_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 6th argument `wsp' of _expokit.dgexpv to C/Fortran array" );
} else {
wsp = (double *)(PyArray_DATA(capi_wsp_tmp));
CHECKARRAY(len(wsp)>=7+n*(m+2)+5*(m+2)*(m+2),"len(wsp)>=7+n*(m+2)+5*(m+2)*(m+2)","6th argument wsp") {
/* Processing variable m */
f2py_success = int_from_pyobj(&m,m_capi,"_expokit.dgexpv() 1st argument (m) can't be converted to int");
if (f2py_success) {
/* Processing variable iwsp */
;
capi_iwsp_intent |= F2PY_INTENT_IN;
capi_iwsp_tmp = array_from_pyobj(NPY_INT,iwsp_Dims,iwsp_Rank,capi_iwsp_intent,iwsp_capi);
if (capi_iwsp_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 7th argument `iwsp' of _expokit.dgexpv to C/Fortran array" );
} else {
iwsp = (int *)(PyArray_DATA(capi_iwsp_tmp));
CHECKARRAY(len(iwsp)>=m+2,"len(iwsp)>=m+2","7th argument iwsp") {
/* Processing variable iflag */
/* Processing variable tol */
f2py_success = double_from_pyobj(&tol,tol_capi,"_expokit.dgexpv() 4th argument (tol) can't be converted to double");
if (f2py_success) {
/* Processing variable t */
f2py_success = double_from_pyobj(&t,t_capi,"_expokit.dgexpv() 2nd argument (t) can't be converted to double");
if (f2py_success) {
/* Processing variable anorm */
f2py_success = double_from_pyobj(&anorm,anorm_capi,"_expokit.dgexpv() 5th argument (anorm) can't be converted to double");
if (f2py_success) {
/* Processing variable v */
;
capi_v_intent |= F2PY_INTENT_IN;
capi_v_tmp = array_from_pyobj(NPY_DOUBLE,v_Dims,v_Rank,capi_v_intent,v_capi);
if (capi_v_tmp == NULL) {
if (!PyErr_Occurred())
PyErr_SetString(_expokit_error,"failed in converting 3rd argument `v' of _expokit.dgexpv to C/Fortran array" );
} else {
v = (double *)(PyArray_DATA(capi_v_tmp));
/* Processing variable matvec */
if(F2PyCapsule_Check(matvec_capi)) {
matvec_cptr = F2PyCapsule_AsVoidPtr(matvec_capi);
} else {
matvec_cptr = cb_matvec_in___user__routines_real;
}
matvec_nofargs_capi = cb_matvec_in___user__routines_real_nofargs;
if (create_cb_arglist(matvec_capi,matvec_xa_capi,2,1,&cb_matvec_in___user__routines_real_nofargs,&matvec_args_capi,"failed in processing argument list for call-back matvec.")) {
jmp_buf matvec_jmpbuf;
CFUNCSMESS("Saving jmpbuf for `matvec`.\n");
SWAP(matvec_capi,cb_matvec_in___user__routines_real_capi,PyObject);
SWAP(matvec_args_capi,cb_matvec_in___user__routines_real_args_capi,PyTupleObject);
memcpy(&matvec_jmpbuf,&cb_matvec_in___user__routines_real_jmpbuf,sizeof(jmp_buf));
/* Processing variable lwsp */
lwsp = len(wsp);