[Bio] / Numeric / Src / lapack_litemodule.c Repository:
ViewVC logotype

Annotation of /Numeric/Src/lapack_litemodule.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (view) (download) (as text)

1 : efrank 1.1 /*This module contributed by Doug Heisterkamp
2 :     Modified by Jim Hugunin
3 :     More modifications by Jeff Whitaker
4 :     */
5 :    
6 :    
7 :     #include"Python.h"
8 :     #include"Numeric/arrayobject.h"
9 :    
10 :     typedef struct { float r, i; } f2c_complex;
11 :     typedef struct { double r, i; } f2c_doublecomplex;
12 :     /* typedef long int (*L_fp)(); */
13 :    
14 :     static PyObject *ErrorObject;
15 :    
16 :     static PyObject *LapackError()
17 :     { if (! ErrorObject)
18 :     ErrorObject = PyString_FromString("LapackError");
19 :     Py_INCREF(ErrorObject);
20 :     return ErrorObject;
21 :     }
22 :    
23 :     static PyObject *ErrorReturn(char *mes)
24 :     { if (!ErrorObject)
25 :     ErrorObject = PyString_FromString("LapackError");
26 :     PyErr_SetString(ErrorObject,mes);
27 :     return NULL;
28 :     }
29 :    
30 :     #define TRY(E) if( ! (E)) return NULL
31 :    
32 :     static int lapack_lite_CheckObject(PyObject *ob, int t, char *obname,
33 :     char *tname, char *funname)
34 :     { char buf[255];
35 :     if (! PyArray_Check(ob))
36 :     { sprintf(buf,"Expected an array for parameter %s in lapack_dge.%s",obname, funname);
37 :     ErrorReturn(buf);
38 :     return 0;
39 :     }
40 :     if (!(((PyArrayObject *)ob)->flags & CONTIGUOUS))
41 :     { sprintf(buf,"Parameter %s is not contiguous in lapack_dge.%s",obname, funname);
42 :     ErrorReturn(buf);
43 :     return 0;
44 :     }
45 :     if (!(((PyArrayObject *)ob)->descr->type_num == t))
46 :     { sprintf(buf,"Parameter %s is not of type %s in lapack_lite.%s",obname,tname, funname);
47 :     ErrorReturn(buf);
48 :     return 0;
49 :     }
50 :     return 1;
51 :     }
52 :    
53 :     #define CHDATA(p) ((char *) (((PyArrayObject *)p)->data))
54 :     #define SHDATA(p) ((short int *) (((PyArrayObject *)p)->data))
55 :     #define DDATA(p) ((double *) (((PyArrayObject *)p)->data))
56 :     #define FDATA(p) ((float *) (((PyArrayObject *)p)->data))
57 :     #define CDATA(p) ((f2c_complex *) (((PyArrayObject *)p)->data))
58 :     #define ZDATA(p) ((f2c_doublecomplex *) (((PyArrayObject *)p)->data))
59 :     #define IDATA(p) ((int *) (((PyArrayObject *)p)->data))
60 :    
61 :    
62 :    
63 :     static PyObject *lapack_lite_dgeev(PyObject *self, PyObject *args)
64 :     {
65 :     int lapack_lite_status__;
66 :     char jobvl;
67 :     char jobvr;
68 :     int n;
69 :     PyObject *a;
70 :     int lda;
71 :     PyObject *wr;
72 :     PyObject *wi;
73 :     PyObject *vl;
74 :     int ldvl;
75 :     PyObject *vr;
76 :     int ldvr;
77 :     PyObject *work;
78 :     int lwork;
79 :     int info;
80 :     TRY(PyArg_ParseTuple(args,"cciOiOOOiOiOii",&jobvl,&jobvr,&n,&a,&lda,&wr,&wi,&vl,&ldvl,&vr,&ldvr,&work,&lwork,&info));
81 :    
82 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dgeev"));
83 :     TRY(lapack_lite_CheckObject(wr,PyArray_DOUBLE,"wr","PyArray_DOUBLE","dgeev"));
84 :     TRY(lapack_lite_CheckObject(wi,PyArray_DOUBLE,"wi","PyArray_DOUBLE","dgeev"));
85 :     TRY(lapack_lite_CheckObject(vl,PyArray_DOUBLE,"vl","PyArray_DOUBLE","dgeev"));
86 :     TRY(lapack_lite_CheckObject(vr,PyArray_DOUBLE,"vr","PyArray_DOUBLE","dgeev"));
87 :     TRY(lapack_lite_CheckObject(work,PyArray_DOUBLE,"work","PyArray_DOUBLE","dgeev"));
88 :    
89 :    
90 :     #if defined(NO_APPEND_FORTRAN)
91 :     lapack_lite_status__ = dgeev(&jobvl,&jobvr,&n,DDATA(a),&lda,DDATA(wr),DDATA(wi),DDATA(vl),&ldvl,DDATA(vr),&ldvr,DDATA(work),&lwork,&info);
92 :     #else
93 :     lapack_lite_status__ = dgeev_(&jobvl,&jobvr,&n,DDATA(a),&lda,DDATA(wr),DDATA(wi),DDATA(vl),&ldvl,DDATA(vr),&ldvr,DDATA(work),&lwork,&info);
94 :     #endif
95 :    
96 :     return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","dgeev_",lapack_lite_status__,"jobvl",jobvl,"jobvr",jobvr,"n",n,"lda",lda,"ldvl",ldvl,"ldvr",ldvr,"lwork",lwork,"info",info);
97 :     }
98 :    
99 :    
100 :    
101 :     static PyObject *lapack_lite_dsyevd(PyObject *self, PyObject *args)
102 :     {
103 :     /* Arguments */
104 :     /* ========= */
105 :    
106 :     char jobz;
107 :     /* JOBZ (input) CHARACTER*1 */
108 :     /* = 'N': Compute eigenvalues only; */
109 :     /* = 'V': Compute eigenvalues and eigenvectors. */
110 :    
111 :     char uplo;
112 :     /* UPLO (input) CHARACTER*1 */
113 :     /* = 'U': Upper triangle of A is stored; */
114 :     /* = 'L': Lower triangle of A is stored. */
115 :    
116 :     int n;
117 :     /* N (input) INTEGER */
118 :     /* The order of the matrix A. N >= 0. */
119 :    
120 :     PyObject *a;
121 :     /* A (input/output) DOUBLE PRECISION array, dimension (LDA, N) */
122 :     /* On entry, the symmetric matrix A. If UPLO = 'U', the */
123 :     /* leading N-by-N upper triangular part of A contains the */
124 :     /* upper triangular part of the matrix A. If UPLO = 'L', */
125 :     /* the leading N-by-N lower triangular part of A contains */
126 :     /* the lower triangular part of the matrix A. */
127 :     /* On exit, if JOBZ = 'V', then if INFO = 0, A contains the */
128 :     /* orthonormal eigenvectors of the matrix A. */
129 :     /* If JOBZ = 'N', then on exit the lower triangle (if UPLO='L') */
130 :     /* or the upper triangle (if UPLO='U') of A, including the */
131 :     /* diagonal, is destroyed. */
132 :    
133 :     int lda;
134 :     /* LDA (input) INTEGER */
135 :     /* The leading dimension of the array A. LDA >= max(1,N). */
136 :    
137 :     PyObject *w;
138 :     /* W (output) DOUBLE PRECISION array, dimension (N) */
139 :     /* If INFO = 0, the eigenvalues in ascending order. */
140 :    
141 :     PyObject *work;
142 :     /* WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK) */
143 :     /* On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
144 :    
145 :     int lwork;
146 :     /* LWORK (input) INTEGER */
147 :     /* The length of the array WORK. LWORK >= max(1,3*N-1). */
148 :     /* For optimal efficiency, LWORK >= (NB+2)*N, */
149 :     /* where NB is the blocksize for DSYTRD returned by ILAENV. */
150 :    
151 :     PyObject *iwork;
152 :     int liwork;
153 :    
154 :     int info;
155 :     /* INFO (output) INTEGER */
156 :     /* = 0: successful exit */
157 :     /* < 0: if INFO = -i, the i-th argument had an illegal value */
158 :     /* > 0: if INFO = i, the algorithm failed to converge; i */
159 :     /* off-diagonal elements of an intermediate tridiagonal */
160 :     /* form did not converge to zero. */
161 :    
162 :    
163 :    
164 :    
165 :     int lapack_lite_status__;
166 :    
167 :    
168 :    
169 :     TRY(PyArg_ParseTuple(args,"cciOiOOiOii",&jobz,&uplo,&n,&a,&lda,&w,&work,&lwork,&iwork,&liwork,&info));
170 :    
171 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dsyevd"));
172 :     TRY(lapack_lite_CheckObject(w,PyArray_DOUBLE,"w","PyArray_DOUBLE","dsyevd"));
173 :     TRY(lapack_lite_CheckObject(work,PyArray_DOUBLE,"work","PyArray_DOUBLE","dsyevd"));
174 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","dsyevd"));
175 :    
176 :    
177 :     #if defined(NO_APPEND_FORTRAN)
178 :     lapack_lite_status__ = dsyevd(&jobz,&uplo,&n,DDATA(a),&lda,DDATA(w),DDATA(work),&lwork,IDATA(iwork),&liwork,&info);
179 :     #else
180 :     lapack_lite_status__ = dsyevd_(&jobz,&uplo,&n,DDATA(a),&lda,DDATA(w),DDATA(work),&lwork,IDATA(iwork),&liwork,&info);
181 :     #endif
182 :    
183 :     return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i}","dsyevd_",lapack_lite_status__,"jobz",jobz,"uplo",uplo,"n",n,"lda",lda,"lwork",lwork,"liwork",liwork,"info",info);
184 :    
185 :    
186 :     }
187 :    
188 :     static PyObject *lapack_lite_zheevd(PyObject *self, PyObject *args)
189 :     {
190 :     /* Arguments */
191 :     /* ========= */
192 :    
193 :     char jobz;
194 :     /* JOBZ (input) CHARACTER*1 */
195 :     /* = 'N': Compute eigenvalues only; */
196 :     /* = 'V': Compute eigenvalues and eigenvectors. */
197 :    
198 :     char uplo;
199 :     /* UPLO (input) CHARACTER*1 */
200 :     /* = 'U': Upper triangle of A is stored; */
201 :     /* = 'L': Lower triangle of A is stored. */
202 :    
203 :     int n;
204 :     /* N (input) INTEGER */
205 :     /* The order of the matrix A. N >= 0. */
206 :    
207 :     PyObject *a;
208 :     /* A (input/output) COMPLEX*16 array, dimension (LDA, N) */
209 :     /* On entry, the Hermitian matrix A. If UPLO = 'U', the */
210 :     /* leading N-by-N upper triangular part of A contains the */
211 :     /* upper triangular part of the matrix A. If UPLO = 'L', */
212 :     /* the leading N-by-N lower triangular part of A contains */
213 :     /* the lower triangular part of the matrix A. */
214 :     /* On exit, if JOBZ = 'V', then if INFO = 0, A contains the */
215 :     /* orthonormal eigenvectors of the matrix A. */
216 :     /* If JOBZ = 'N', then on exit the lower triangle (if UPLO='L') */
217 :     /* or the upper triangle (if UPLO='U') of A, including the */
218 :     /* diagonal, is destroyed. */
219 :    
220 :     int lda;
221 :     /* LDA (input) INTEGER */
222 :     /* The leading dimension of the array A. LDA >= max(1,N). */
223 :    
224 :     PyObject *w;
225 :     /* W (output) DOUBLE PRECISION array, dimension (N) */
226 :     /* If INFO = 0, the eigenvalues in ascending order. */
227 :    
228 :     PyObject *work;
229 :     /* WORK (workspace/output) COMPLEX*16 array, dimension (LWORK) */
230 :     /* On exit, if INFO = 0, WORK(1) returns the optimal LWORK. */
231 :    
232 :     int lwork;
233 :     /* LWORK (input) INTEGER */
234 :     /* The length of the array WORK. LWORK >= max(1,3*N-1). */
235 :     /* For optimal efficiency, LWORK >= (NB+2)*N, */
236 :     /* where NB is the blocksize for DSYTRD returned by ILAENV. */
237 :    
238 :     PyObject *rwork;
239 :     /* RWORK (workspace) DOUBLE PRECISION array, dimension (max(1, 3*N-2)) */
240 :     int lrwork;
241 :    
242 :     PyObject *iwork;
243 :     int liwork;
244 :    
245 :     int info;
246 :     /* INFO (output) INTEGER */
247 :     /* = 0: successful exit */
248 :     /* < 0: if INFO = -i, the i-th argument had an illegal value */
249 :     /* > 0: if INFO = i, the algorithm failed to converge; i */
250 :     /* off-diagonal elements of an intermediate tridiagonal */
251 :     /* form did not converge to zero. */
252 :    
253 :    
254 :    
255 :    
256 :     int lapack_lite_status__;
257 :    
258 :    
259 :    
260 :     TRY(PyArg_ParseTuple(args,"cciOiOOiOiOii",&jobz,&uplo,&n,&a,&lda,&w,&work,&lwork,&rwork,&lrwork,&iwork,&liwork,&info));
261 :    
262 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zheevd"));
263 :     TRY(lapack_lite_CheckObject(w,PyArray_DOUBLE,"w","PyArray_DOUBLE","zheevd"));
264 :     TRY(lapack_lite_CheckObject(work,PyArray_CDOUBLE,"work","PyArray_CDOUBLE","zheevd"));
265 :     TRY(lapack_lite_CheckObject(w,PyArray_DOUBLE,"rwork","PyArray_DOUBLE","zheevd"));
266 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","zheevd"));
267 :    
268 :    
269 :     #if defined(NO_APPEND_FORTRAN)
270 :     lapack_lite_status__ = zheevd(&jobz,&uplo,&n,DDATA(a),&lda,DDATA(w),DDATA(work),&lwork,DDATA(rwork),&lrwork,IDATA(iwork),&liwork,&info);
271 :     #else
272 :     lapack_lite_status__ = zheevd_(&jobz,&uplo,&n,DDATA(a),&lda,DDATA(w),DDATA(work),&lwork,DDATA(rwork),&lrwork,IDATA(iwork),&liwork,&info);
273 :     #endif
274 :    
275 :     return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","zheevd_",lapack_lite_status__,"jobz",jobz,"uplo",uplo,"n",n,"lda",lda,"lwork",lwork,"lrwork",lrwork,"liwork",liwork,"info",info);
276 :    
277 :    
278 :     }
279 :    
280 :    
281 :     static PyObject *lapack_lite_dgelsd(PyObject *self, PyObject *args)
282 :     {
283 :     int lapack_lite_status__;
284 :     int m;
285 :     int n;
286 :     int nrhs;
287 :     PyObject *a;
288 :     int lda;
289 :     PyObject *b;
290 :     int ldb;
291 :     PyObject *s;
292 :     double rcond;
293 :     int rank;
294 :     PyObject *work;
295 :     PyObject *iwork;
296 :     int lwork;
297 :     int info;
298 :     TRY(PyArg_ParseTuple(args,"iiiOiOiOdiOiOi",&m,&n,&nrhs,&a,&lda,&b,&ldb,&s,&rcond,&rank,&work,&lwork,&iwork,&info));
299 :    
300 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dgelsd"));
301 :     TRY(lapack_lite_CheckObject(b,PyArray_DOUBLE,"b","PyArray_DOUBLE","dgelsd"));
302 :     TRY(lapack_lite_CheckObject(s,PyArray_DOUBLE,"s","PyArray_DOUBLE","dgelsd"));
303 :     TRY(lapack_lite_CheckObject(work,PyArray_DOUBLE,"work","PyArray_DOUBLE","dgelsd"));
304 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","dgelsd"));
305 :    
306 :    
307 :     #if defined(NO_APPEND_FORTRAN)
308 :     lapack_lite_status__ = dgelsd(&m,&n,&nrhs,DDATA(a),&lda,DDATA(b),&ldb,DDATA(s),&rcond,&rank,DDATA(work),&lwork,IDATA(iwork),&info);
309 :     #else
310 :     lapack_lite_status__ = dgelsd_(&m,&n,&nrhs,DDATA(a),&lda,DDATA(b),&ldb,DDATA(s),&rcond,&rank,DDATA(work),&lwork,IDATA(iwork),&info);
311 :     #endif
312 :    
313 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:d,s:i,s:i,s:i}","dgelsd_",lapack_lite_status__,"m",m,"n",n,"nrhs",nrhs,"lda",lda,"ldb",ldb,"rcond",rcond,"rank",rank,"lwork",lwork,"info",info);
314 :     }
315 :    
316 :    
317 :    
318 :    
319 :    
320 :     static PyObject *lapack_lite_dgesv(PyObject *self, PyObject *args)
321 :     {
322 :     int lapack_lite_status__;
323 :     int n;
324 :     int nrhs;
325 :     PyObject *a;
326 :     int lda;
327 :     PyObject *ipiv;
328 :     PyObject *b;
329 :     int ldb;
330 :     int info;
331 :     TRY(PyArg_ParseTuple(args,"iiOiOOii",&n,&nrhs,&a,&lda,&ipiv,&b,&ldb,&info));
332 :    
333 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dgesv"));
334 :     TRY(lapack_lite_CheckObject(ipiv,PyArray_INT,"ipiv","PyArray_INT","dgesv"));
335 :     TRY(lapack_lite_CheckObject(b,PyArray_DOUBLE,"b","PyArray_DOUBLE","dgesv"));
336 :    
337 :    
338 :     #if defined(NO_APPEND_FORTRAN)
339 :     lapack_lite_status__ = dgesv(&n,&nrhs,DDATA(a),&lda,IDATA(ipiv),DDATA(b),&ldb,&info);
340 :     #else
341 :     lapack_lite_status__ = dgesv_(&n,&nrhs,DDATA(a),&lda,IDATA(ipiv),DDATA(b),&ldb,&info);
342 :     #endif
343 :    
344 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","dgesv_",lapack_lite_status__,"n",n,"nrhs",nrhs,"lda",lda,"ldb",ldb,"info",info);
345 :     }
346 :    
347 :    
348 :    
349 :    
350 :    
351 :     static PyObject *lapack_lite_dgesdd(PyObject *self, PyObject *args)
352 :     {
353 :     int lapack_lite_status__;
354 :     char jobz;
355 :     int m;
356 :     int n;
357 :     PyObject *a;
358 :     int lda;
359 :     PyObject *s;
360 :     PyObject *u;
361 :     int ldu;
362 :     PyObject *vt;
363 :     int ldvt;
364 :     PyObject *work;
365 :     int lwork;
366 :     PyObject *iwork;
367 :     int info;
368 :     TRY(PyArg_ParseTuple(args,"ciiOiOOiOiOiOi",&jobz,&m,&n,&a,&lda,&s,&u,&ldu,&vt,&ldvt,&work,&lwork,&iwork,&info));
369 :    
370 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dgesdd"));
371 :     TRY(lapack_lite_CheckObject(s,PyArray_DOUBLE,"s","PyArray_DOUBLE","dgesdd"));
372 :     TRY(lapack_lite_CheckObject(u,PyArray_DOUBLE,"u","PyArray_DOUBLE","dgesdd"));
373 :     TRY(lapack_lite_CheckObject(vt,PyArray_DOUBLE,"vt","PyArray_DOUBLE","dgesdd"));
374 :     TRY(lapack_lite_CheckObject(work,PyArray_DOUBLE,"work","PyArray_DOUBLE","dgesdd"));
375 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","dgesdd"));
376 :    
377 :    
378 :     #if defined(NO_APPEND_FORTRAN)
379 :     lapack_lite_status__ = dgesdd(&jobz,&m,&n,DDATA(a),&lda,DDATA(s),DDATA(u),&ldu,DDATA(vt),&ldvt,DDATA(work),&lwork,&iwork,&info);
380 :     #else
381 :     lapack_lite_status__ = dgesdd_(&jobz,&m,&n,DDATA(a),&lda,DDATA(s),DDATA(u),&ldu,DDATA(vt),&ldvt,DDATA(work),&lwork,IDATA(iwork),&info);
382 :     #endif
383 :    
384 :     return Py_BuildValue("{s:i,s:c,s:i,s:i,s:i,s:i,s:i,s:i,s:i}","dgesdd_",lapack_lite_status__,"jobz",jobz,"m",m,"n",n,"lda",lda,"ldu",ldu,"ldvt",ldvt,"lwork",lwork,"info",info);
385 :     }
386 :    
387 :    
388 :    
389 :     static PyObject *lapack_lite_dgetrf(PyObject *self, PyObject *args)
390 :     {
391 :     int lapack_lite_status__;
392 :     int m;
393 :     int n;
394 :     PyObject *a;
395 :     int lda;
396 :     PyObject *ipiv;
397 :     int info;
398 :     TRY(PyArg_ParseTuple(args,"iiOiOi",&m,&n,&a,&lda,&ipiv,&info));
399 :    
400 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dgetrf"));
401 :     TRY(lapack_lite_CheckObject(ipiv,PyArray_INT,"ipiv","PyArray_INT","dgetrf"));
402 :    
403 :    
404 :     #if defined(NO_APPEND_FORTRAN)
405 :     lapack_lite_status__ = dgetrf(&m,&n,DDATA(a),&lda,IDATA(ipiv),&info);
406 :     #else
407 :     lapack_lite_status__ = dgetrf_(&m,&n,DDATA(a),&lda,IDATA(ipiv),&info);
408 :     #endif
409 :    
410 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i}","dgetrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"info",info);
411 :     }
412 :    
413 :     static PyObject *lapack_lite_dpotrf(PyObject *self, PyObject *args)
414 :     {
415 :     int lapack_lite_status__;
416 :     int n;
417 :     PyObject *a;
418 :     int lda;
419 :     char uplo;
420 :     int info;
421 :    
422 :     TRY(PyArg_ParseTuple(args,"ciOii",&uplo,&n,&a,&lda,&info));
423 :     TRY(lapack_lite_CheckObject(a,PyArray_DOUBLE,"a","PyArray_DOUBLE","dpotrf"));
424 :    
425 :     #if defined(NO_APPEND_FORTRAN)
426 :     lapack_lite_status__ = dpotrf(&uplo,&n,DDATA(a),&lda,&info);
427 :     #else
428 :     lapack_lite_status__ = dpotrf_(&uplo,&n,DDATA(a),&lda,&info);
429 :     #endif
430 :    
431 :     return Py_BuildValue("{s:i,s:i,s:i,s:i}","dpotrf_",lapack_lite_status__,"n",n,"lda",lda,"info",info);
432 :     }
433 :    
434 :     static PyObject *lapack_lite_zgeev(PyObject *self, PyObject *args)
435 :     {
436 :     int lapack_lite_status__;
437 :     char jobvl;
438 :     char jobvr;
439 :     int n;
440 :     PyObject *a;
441 :     int lda;
442 :     PyObject *w;
443 :     PyObject *vl;
444 :     int ldvl;
445 :     PyObject *vr;
446 :     int ldvr;
447 :     PyObject *work;
448 :     int lwork;
449 :     PyObject *rwork;
450 :     int info;
451 :     TRY(PyArg_ParseTuple(args,"cciOiOOiOiOiOi",&jobvl,&jobvr,&n,&a,&lda,&w,&vl,&ldvl,&vr,&ldvr,&work,&lwork,&rwork,&info));
452 :    
453 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zgeev"));
454 :     TRY(lapack_lite_CheckObject(w,PyArray_CDOUBLE,"w","PyArray_CDOUBLE","zgeev"));
455 :     TRY(lapack_lite_CheckObject(vl,PyArray_CDOUBLE,"vl","PyArray_CDOUBLE","zgeev"));
456 :     TRY(lapack_lite_CheckObject(vr,PyArray_CDOUBLE,"vr","PyArray_CDOUBLE","zgeev"));
457 :     TRY(lapack_lite_CheckObject(work,PyArray_CDOUBLE,"work","PyArray_CDOUBLE","zgeev"));
458 :     TRY(lapack_lite_CheckObject(rwork,PyArray_DOUBLE,"rwork","PyArray_DOUBLE","zgeev"));
459 :    
460 :    
461 :     #if defined(NO_APPEND_FORTRAN)
462 :     lapack_lite_status__ = zgeev(&jobvl,&jobvr,&n,ZDATA(a),&lda,ZDATA(w),ZDATA(vl),&ldvl,ZDATA(vr),&ldvr,ZDATA(work),&lwork,DDATA(rwork),&info);
463 :     #else
464 :     lapack_lite_status__ = zgeev_(&jobvl,&jobvr,&n,ZDATA(a),&lda,ZDATA(w),ZDATA(vl),&ldvl,ZDATA(vr),&ldvr,ZDATA(work),&lwork,DDATA(rwork),&info);
465 :     #endif
466 :    
467 :     return Py_BuildValue("{s:i,s:c,s:c,s:i,s:i,s:i,s:i,s:i,s:i}","zgeev_",lapack_lite_status__,"jobvl",jobvl,"jobvr",jobvr,"n",n,"lda",lda,"ldvl",ldvl,"ldvr",ldvr,"lwork",lwork,"info",info);
468 :     }
469 :    
470 :    
471 :    
472 :    
473 :     static PyObject *lapack_lite_zgelsd(PyObject *self, PyObject *args)
474 :     {
475 :     int lapack_lite_status__;
476 :     int m;
477 :     int n;
478 :     int nrhs;
479 :     PyObject *a;
480 :     int lda;
481 :     PyObject *b;
482 :     int ldb;
483 :     PyObject *s;
484 :     double rcond;
485 :     int rank;
486 :     PyObject *work;
487 :     int lwork;
488 :     PyObject *rwork;
489 :     PyObject *iwork;
490 :     int info;
491 :     TRY(PyArg_ParseTuple(args,"iiiOiOiOdiOiOOi",&m,&n,&nrhs,&a,&lda,&b,&ldb,&s,&rcond,&rank,&work,&lwork,&rwork,&iwork,&info));
492 :    
493 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zgelsd"));
494 :     TRY(lapack_lite_CheckObject(b,PyArray_CDOUBLE,"b","PyArray_CDOUBLE","zgelsd"));
495 :     TRY(lapack_lite_CheckObject(s,PyArray_DOUBLE,"s","PyArray_DOUBLE","zgelsd"));
496 :     TRY(lapack_lite_CheckObject(work,PyArray_CDOUBLE,"work","PyArray_CDOUBLE","zgelsd"));
497 :     TRY(lapack_lite_CheckObject(rwork,PyArray_DOUBLE,"rwork","PyArray_DOUBLE","zgelsd"));
498 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","zgelsd"));
499 :    
500 :    
501 :     #if defined(NO_APPEND_FORTRAN)
502 :     lapack_lite_status__ = zgelsd(&m,&n,&nrhs,ZDATA(a),&lda,ZDATA(b),&ldb,DDATA(s),&rcond,&rank,ZDATA(work),&lwork,DDATA(rwork),IDATA(iwork),&info);
503 :     #else
504 :     lapack_lite_status__ = zgelsd_(&m,&n,&nrhs,ZDATA(a),&lda,ZDATA(b),&ldb,DDATA(s),&rcond,&rank,ZDATA(work),&lwork,DDATA(rwork),IDATA(iwork),&info);
505 :     #endif
506 :    
507 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i,s:i}","zgelsd_",lapack_lite_status__,"m",m,"n",n,"nrhs",nrhs,"lda",lda,"ldb",ldb,"rank",rank,"lwork",lwork,"info",info);
508 :     }
509 :    
510 :    
511 :    
512 :     static PyObject *lapack_lite_zgesv(PyObject *self, PyObject *args)
513 :     {
514 :     int lapack_lite_status__;
515 :     int n;
516 :     int nrhs;
517 :     PyObject *a;
518 :     int lda;
519 :     PyObject *ipiv;
520 :     PyObject *b;
521 :     int ldb;
522 :     int info;
523 :     TRY(PyArg_ParseTuple(args,"iiOiOOii",&n,&nrhs,&a,&lda,&ipiv,&b,&ldb,&info));
524 :    
525 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zgesv"));
526 :     TRY(lapack_lite_CheckObject(ipiv,PyArray_INT,"ipiv","PyArray_INT","zgesv"));
527 :     TRY(lapack_lite_CheckObject(b,PyArray_CDOUBLE,"b","PyArray_CDOUBLE","zgesv"));
528 :    
529 :    
530 :     #if defined(NO_APPEND_FORTRAN)
531 :     lapack_lite_status__ = zgesv(&n,&nrhs,ZDATA(a),&lda,IDATA(ipiv),ZDATA(b),&ldb,&info);
532 :     #else
533 :     lapack_lite_status__ = zgesv_(&n,&nrhs,ZDATA(a),&lda,IDATA(ipiv),ZDATA(b),&ldb,&info);
534 :     #endif
535 :    
536 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i,s:i}","zgesv_",lapack_lite_status__,"n",n,"nrhs",nrhs,"lda",lda,"ldb",ldb,"info",info);
537 :     }
538 :    
539 :    
540 :    
541 :    
542 :    
543 :     static PyObject *lapack_lite_zgesdd(PyObject *self, PyObject *args)
544 :     {
545 :     int lapack_lite_status__;
546 :     char jobz;
547 :     int m;
548 :     int n;
549 :     PyObject *a;
550 :     int lda;
551 :     PyObject *s;
552 :     PyObject *u;
553 :     int ldu;
554 :     PyObject *vt;
555 :     int ldvt;
556 :     PyObject *work;
557 :     int lwork;
558 :     PyObject *rwork;
559 :     PyObject *iwork;
560 :     int info;
561 :     TRY(PyArg_ParseTuple(args,"ciiOiOOiOiOiOOi",&jobz,&m,&n,&a,&lda,&s,&u,&ldu,&vt,&ldvt,&work,&lwork,&rwork,&iwork,&info));
562 :    
563 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zgesdd"));
564 :     TRY(lapack_lite_CheckObject(s,PyArray_DOUBLE,"s","PyArray_DOUBLE","zgesdd"));
565 :     TRY(lapack_lite_CheckObject(u,PyArray_CDOUBLE,"u","PyArray_CDOUBLE","zgesdd"));
566 :     TRY(lapack_lite_CheckObject(vt,PyArray_CDOUBLE,"vt","PyArray_CDOUBLE","zgesdd"));
567 :     TRY(lapack_lite_CheckObject(work,PyArray_CDOUBLE,"work","PyArray_CDOUBLE","zgesdd"));
568 :     TRY(lapack_lite_CheckObject(rwork,PyArray_DOUBLE,"rwork","PyArray_DOUBLE","zgesdd"));
569 :     TRY(lapack_lite_CheckObject(iwork,PyArray_INT,"iwork","PyArray_INT","zgesdd"));
570 :    
571 :    
572 :     #if defined(NO_APPEND_FORTRAN)
573 :     lapack_lite_status__ = zgesdd(&jobz,&m,&n,ZDATA(a),&lda,DDATA(s),ZDATA(u),&ldu,ZDATA(vt),&ldvt,ZDATA(work),&lwork,DDATA(rwork),IDATA(iwork),&info);
574 :     #else
575 :     lapack_lite_status__ = zgesdd_(&jobz,&m,&n,ZDATA(a),&lda,DDATA(s),ZDATA(u),&ldu,ZDATA(vt),&ldvt,ZDATA(work),&lwork,DDATA(rwork),IDATA(iwork),&info);
576 :     #endif
577 :    
578 :     return Py_BuildValue("{s:i,s:c,s:i,s:i,s:i,s:i,s:i,s:i,s:i}","zgesdd_",lapack_lite_status__,"jobz",jobz,"m",m,"n",n,"lda",lda,"ldu",ldu,"ldvt",ldvt,"lwork",lwork,"info",info);
579 :     }
580 :    
581 :    
582 :    
583 :    
584 :     static PyObject *lapack_lite_zgetrf(PyObject *self, PyObject *args)
585 :     {
586 :     int lapack_lite_status__;
587 :     int m;
588 :     int n;
589 :     PyObject *a;
590 :     int lda;
591 :     PyObject *ipiv;
592 :     int info;
593 :     TRY(PyArg_ParseTuple(args,"iiOiOi",&m,&n,&a,&lda,&ipiv,&info));
594 :    
595 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zgetrf"));
596 :     TRY(lapack_lite_CheckObject(ipiv,PyArray_INT,"ipiv","PyArray_INT","zgetrf"));
597 :    
598 :    
599 :     #if defined(NO_APPEND_FORTRAN)
600 :     lapack_lite_status__ = zgetrf(&m,&n,ZDATA(a),&lda,IDATA(ipiv),&info);
601 :     #else
602 :     lapack_lite_status__ = zgetrf_(&m,&n,ZDATA(a),&lda,IDATA(ipiv),&info);
603 :     #endif
604 :    
605 :     return Py_BuildValue("{s:i,s:i,s:i,s:i,s:i}","zgetrf_",lapack_lite_status__,"m",m,"n",n,"lda",lda,"info",info);
606 :     }
607 :    
608 :     static PyObject *lapack_lite_zpotrf(PyObject *self, PyObject *args)
609 :     {
610 :     int lapack_lite_status__;
611 :     int n;
612 :     PyObject *a;
613 :     int lda;
614 :     char uplo;
615 :     int info;
616 :    
617 :     TRY(PyArg_ParseTuple(args,"ciOii",&uplo,&n,&a,&lda,&info));
618 :     TRY(lapack_lite_CheckObject(a,PyArray_CDOUBLE,"a","PyArray_CDOUBLE","zpotrf"));
619 :    
620 :     #if defined(NO_APPEND_FORTRAN)
621 :     lapack_lite_status__ = zpotrf(&uplo,&n,ZDATA(a),&lda,&info);
622 :     #else
623 :     lapack_lite_status__ = zpotrf_(&uplo,&n,ZDATA(a),&lda,&info);
624 :     #endif
625 :    
626 :     return Py_BuildValue("{s:i,s:i,s:i,s:i}","zpotrf_",lapack_lite_status__,"n",n,"lda",lda,"info",info);
627 :     }
628 :    
629 :     static struct PyMethodDef lapack_lite_module_methods[] = {
630 :     {"zheevd",lapack_lite_zheevd,1},
631 :     {"dsyevd",lapack_lite_dsyevd,1},
632 :     {"dgeev",lapack_lite_dgeev,1},
633 :     {"dgelsd",lapack_lite_dgelsd,1},
634 :     {"dgesv",lapack_lite_dgesv,1},
635 :     {"dgesdd",lapack_lite_dgesdd,1},
636 :     {"dgetrf",lapack_lite_dgetrf,1},
637 :     {"dpotrf",lapack_lite_dpotrf,1},
638 :     {"zgeev",lapack_lite_zgeev,1},
639 :     {"zgelsd",lapack_lite_zgelsd,1},
640 :     {"zgesv",lapack_lite_zgesv,1},
641 :     {"zgesdd",lapack_lite_zgesdd,1},
642 :     {"zgetrf",lapack_lite_zgetrf,1},
643 :     {"zpotrf",lapack_lite_zpotrf,1},
644 :     { NULL,NULL,0}
645 :     };
646 :    
647 :    
648 :     static PyObject *lapack_liteError;
649 :    
650 :     DL_EXPORT(void) initlapack_lite()
651 :     { PyObject *m,*d;
652 :     m = Py_InitModule("lapack_lite",lapack_lite_module_methods);
653 :     import_array();
654 :     d = PyModule_GetDict(m);
655 :     ErrorObject = LapackError();
656 :     PyDict_SetItemString(d,"LapackError",ErrorObject);
657 :     }
658 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3