Thanks for the response. I'm glad that it isn't something trivial that I missed (although unfortunately that means that following this response will be the beginning of a potentiall long guessing game).
If I make progress, I will provide an update. On Friday, September 19, 2014 1:44:26 PM UTC-4, Jiahao Chen wrote: > > This is a tricky cfunction to write and I don't really know the right > answer. (I hope others will correct me if I get anything wrong.) But as I > understand it: > > 1. The LAPACK calls Julia uses are actually to the CLAPACK wrappers. > BLAS.gges! calls the CLAPACK function ?gges and you want to pass it a C > function pointer to the selctg argument. > > http://www.netlib.org/clapack/CLAPACK-3.1.1/SRC/dgges.c > > 2. Ordinarily you would give it a cfunction of the appropriate type > signature. However, the type signature cannot simply be the obvious Bool or > Cint. First, Bool is a Julia type whose underlying size is not guaranteed > to be platform independent. Second, Fortran is pass-by-reference, so the > return type of the cfunction should be a pointer of some sort. > > 3. The issue here is that the return type of the SELCTG function is L_fp > (logical fortran pointer?) which appears to be an internal f2c type. The > correct type signature of cfunctions like order_eigs_c is whatever that > type actually is. I don't know the answer, but it is probably something > like Ptr{Cchar} (in the worst case you can play the guessing game with > integers of various sizes). > > In general you can diagnose segfaults with Julia built in debug mode with > 'make debug' (there are many more options) and you can run the resulting > julia-debug binary in a debugger. > > Thanks, > > Jiahao Chen > Staff Research Scientist > MIT Computer Science and Artificial Intelligence Laboratory > > On Fri, Sep 19, 2014 at 12:49 AM, Chase Coleman <cc7...@gmail.com > <javascript:>> wrote: > >> Hi, >> >> The function (`?gges`) being called in `schurfact` from LAPACK accepts an >> argument for sorting the eigenvalues according to a logical/boolean >> function. I am currently working on some code that would be valuable for >> me to sort eigenvalues into explosive and nonexplosive (modulus bounded by >> unity). Are there plans to accept the arguments for sorting to the gges >> wrapper? I started working on one, but 1) haven't had a chance to quite >> finish debugging and 2) am not sure that I have the proper skill level to >> finish debugging it. My fork <https://github.com/cc7768/julia> of julia >> has a branch called "sort_gen_eig" where I add "sort" and "selctg" as >> arguments to gges and the appropriate schurfact calls. For a quicker look, >> I have a temporary file called test_sort.jl >> <https://github.com/cc7768/julia/blob/sort_gen_eig/base/linalg/test_sort.jl> >> that >> can be used to test what I would like to accomplish. >> >> When I run the code in test_sort.jl, I get segmentation errors. Could >> anyone help me with this? >> >> For additional background information: Scipy has attempted to include the >> sort function in their call to ?gges, but had some issues with windows >> machines (here >> <https://github.com/scipy/scipy/blob/1507874c9f266f6687829bba3ee28ea7a696b657/scipy/linalg/_decomp_qz.py#L18> >> is >> code and here <https://github.com/scipy/scipy/pull/3107> is issue). >> > >