[SciPy-User] RZ Factorization

Del Citto Francesco francesco.delcitto at sauber-motorsport.com
Wed Sep 3 11:17:00 EDT 2014


Hi!

I'm new to this mailing list, so first of all I'd like to thank all the developers for the great work behind numpy, scipy and all the related tools!

Now, back to the subject of my email.
I'd like to implement in Python a methodology based on an RZ Factorization of an upper trapezoidal matrix, which is actually the "R" matrix of a QR decomposition of a non-squared matrix.
It is something I have already done a few years ago in Fortran, using some dedicated LAPACK functions, namely:

DGEQP3
DTZRZF
DORMRZ
DGELSY

Now, DGEQP3 is already wrapped in SciPy 0.14.0, but the other functions aren't.
(Strictly speaking, DGELSY has nothing to do with the decomposition itself, as it solves an over- or under-determined system using an orthogonal factorization, but it is a function I used in my Fortran code and it is not wrapped)

As I generally install SciPy from sources, I have modified scipy/linalg/flapack.pyf.src adding:

   subroutine <prefix2>tzrzf(m,n,a,tau,work,lwork,info)

   ! tz_a,tau,work,info = tzrzf(a,lwork=3*(n+1),overwrite_a=0)
   ! Compute a QTZ factorization of a real M-by-N matrix A:
   !   A = T * Z = ( R 0 ) * Z.
   ! where Z is an N-by-N orthogonal matrix and R is an M-by-M upper
   ! triangular matrix.

     threadsafe
     callstatement (*f2py_func)(&m,&n,a,&m,tau,work,&lwork,&info)
     callprotoargument int*,int*,<ctype2>*,int*,<ctype2>*,<ctype2>*,int*,int*

     integer intent(hide),depend(a):: m = shape(a,0)
     integer intent(hide),depend(a):: n = shape(a,1)
     <ftype2> dimension(m,n),intent(in,out,copy,out=tz,aligned8) :: a
     <ftype2> dimension(MIN(m,n)),intent(out) :: tau

     integer optional,intent(in),depend(n),check(lwork>=n||lwork==-1) :: lwork=3*(n+1)
     <ftype2> dimension(MAX(lwork,1)),intent(out),depend(lwork) :: work
     integer intent(out) :: info
   end subroutine <prefix2>tzrzf

recompiled and I can now see DTZRZF from Python as scipy.linalg.lapack.dtzrzf, which is great.

I'll do the same for the other two missing functions and expose them to my code, but in any case I'll lose the compatibility with a standard SciPy installation, which is not ideal if you need to install the program somewhere else.

Is there any other way of accessing these functions from a clean SciPy installations?
Are there plans to include the RZ factorization with a high-level wrapper as done for the QR?


Regards,
Francesco


----
Francesco Del Citto
CFD Group
[cid:image002.png at 01CFC79A.DF3B7320]

Sauber Motorsport AG
Wildbachstrasse 9
8340 Hinwil
Switzerland
Tel      +41 44 937 90 00
Direct  +41 44 937 95 10
Fax     +41 44 937 95 01

www.sauberf1team.com<http://www.sauber-motorsport.com/>
This message contains confidential information and is intended only for the individual named herein. If you are not the herein named addressee you should not disseminate, distribute a copy or otherwise make use of this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake, and delete this e-mail from your system.
Please consider the environment before printing this email.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20140903/9f96322a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 4890 bytes
Desc: image002.png
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20140903/9f96322a/attachment.png>


More information about the SciPy-User mailing list