There seems to be no function in any well-known Julia library to obtain the CS decomposition of a matrix. There is a function `CUNCSD `

in LAPACK, but it is not available in Julia by default. Maybe I can call that function from Julia?

# How can I get the CS decomposition of a matrix?

lapack comes with julia in the module `LinearAlgebra.LAPACK`

, but i can’t find a julia interface to to `CUNCSD`

in particular. in this file are the c calls to the lapack routines:

if you know the conventions of calling directly a lapack routine, maybe you can a direct c call.

Also, this merits an issue on the Julia repo

Why is it actually that Julia doesn’t have an interface for all of LAPACK? The wrappers must be automatically generated, right?

No, they are hand-written. Writing high-level wrappers for a Fortran library like this is non-trivial to automate, especially since there are four variants of every subroutine (real/complex and single/double precision), sometimes with subtly different calling conventions (e.g. different workspace sizes).

Of course, nothing prevents you from adding a wrapper for any LAPACK routine you want using `ccall`

in user code — there’s nothing special about the code in the Julia standard library.

I see. How would a wrapper for `CUNCSD`

look like?

The specification is here: http://www.netlib.org/lapack/explore-html/d3/db9/group__complex_o_t_h_e_rcomputational_ga55ab9c7b1a2bce552037cf519201e950.html

Look at the other wrappers in lapack.jl; adapting one for `*uncsd`

shouldn’t be too hard.

There are a lot in LAPACK that are non-standard, for example, QL, LQ, RQ decompositions, that would be quite a bit of work to wrap.

I’ve set up MatrixFactorizations.jl as a home for other matrix factorizations. At the moment it just includes QL and a version of QR that allows more general types.