[SciPy-user] Wrapping geqp3 (Rank revealing QR)

Pearu Peterson pearu at scipy.org
Fri Feb 24 08:33:31 CST 2006



On Fri, 24 Feb 2006, Nils Wagner wrote:

> The next issues are
>
> 1. How do I handle JPVT ?
>
> 2. How do I find the size of LWORK in *geqp3 ?

Read the headers of ?geqp3.f files where the arguments of related 
subroutines are explained.

> I am willing to learn it :-)
> but the contents of flapack_esv.pyf.src is somehow cryptic in many
> places e.g.
>
>     callstatement
> if(irange_capi==Py_None);else{irange[0]++;irange[1]++;}(*f2py_func)((compute_v?"V":"N"),(vrange_capi==Py_None?(irange_capi==Py_None?"A":"I"):"V"),(lower?"L":"U"),&n,a,&n,vrange,vrange+1,irange,irange+1,&atol,&m,w,z,&ldz,isuppz,work,&lwork,<_2=,,rwork\,&lrwork\,,\2>iwork,&liwork,&info);if(irange_capi==Py_None);else{irange[0]--;irange[1]--;}if(vrange_capi==Py_None);else
> {capi_w_tmp-\>dimensions[0]=capi_z_tmp-\>dimensions[1]=m;/*capi_z_tmp-\>strides[0]=m*capi_z_tmp-\>descr-\>elsize;*/}

That is simple C code in one line and takes care of the offset between C 
and Fortran array indices:

if (irange_capi==Py_None)
   ;
else {
   irange[0]++;
   irange[1]++;
}
(*f2py_func)((compute_v?"V":"N"),
              (vrange_capi==Py_None?(irange_capi==Py_None?"A":"I"):"V"),
              (lower?"L":"U"),
              &n,a,&n,vrange,vrange+1,irange,irange+1,&atol,&m,
              w,z,&ldz,isuppz,work,&lwork,
              <_2=,,rwork\,&lrwork\,,\2>iwork,&liwork,&info);
if (irange_capi==Py_None)
   ;
else {
   irange[0]--;
   irange[1]--;
}
if (vrange_capi==Py_None)
   ;
else {
   capi_w_tmp-\>dimensions[0]=capi_z_tmp-\>dimensions[1]=m;
   /*capi_z_tmp-\>strides[0]=m*capi_z_tmp-\>descr-\>elsize;*/
}

See also numpy.distutils.from_template.__doc__.

Pearu



More information about the SciPy-user mailing list