Hello, all.

I want to call a sparse direct solver called SuperLU from CMUCL.  There is
a Debian package with SuperLU which I have installed.  Now I have written
stuff like the following (translating definitions from
/usr/include/superlu/supermatrix.h, util.h, dsp_defs.h).


---------------------------------------------------------------------------
(defpackage "SUPERLU" (:use "COMMON-LISP" "ALIEN" "C-CALL"))

(in-package "SUPERLU")

(load-foreign "/usr/lib/libsuperlu.so")

(def-alien-type yes_no_t (enum yes_no_t :NO :YES))
(def-alien-type fact_t (enum fact_t :DOFACT :SamePattern 
:SamePattern_SameRowPerm :FACTORED))
(def-alien-type rowperm_t (enum rowperm_t :NOROWPERM :LargeDiag :MY_PERMR))
(def-alien-type colperm_t (enum :NATURAL :MMD_ATA :MMD_AT_PLUS_A :COLAMD 
:MY_PERMC))
(def-alien-type trans_t (enum trans_t :NOTRANS :TRANS :CONJ))
(def-alien-type DiagScale_t (enum DiagScale_t :NOEQUIL :ROW :COL :BOTH))
(def-alien-type IterRefine_t (enum IterRefine_t :NOREFINE :SINGLE=1 :DOUBLE 
:EXTRA))
(def-alien-type MemType (enum MemType :LUSUP :UCOL :LSUB :USUB))
(def-alien-type stack_end_t (enum stack_end_t :HEAD :TAIL))
(def-alien-type LU_space_t (enum LU_space_t :SYSTEM :USER))

(def-alien-type nil
    (struct superlu_options_t
     (Fact fact_t)
     (Equil yes_no_t)
     (ColPerm colperm_t)
     (Trans trans_t)
     (IterRefine IterRefine_t)
     (PrintStat yes_no_t)
     (SymmetricMode yes_no_t)
     (DiagPivotThresh double)
     (PivotGrowth yes_no_t)
     (ConditionNumber yes_no_t)
     (RowPerm rowperm_t)
     (ReplaceTinyPivot yes_no_t)
     (SolveInitialized yes_no_t)
     (RefineInitialized yes_no_t)
     ))

(def-alien-routine "set_default_options" void
  (options (* (struct superlu_options_t))))

(with-alien ((options (struct superlu_options_t)))
  (set-default-options (addr options)))

---------------------------------------------------------------------------
  
Unfortunately, not even this first step works.  I assume that I am doing
something simple wrong.

Can anyone help?  Also, I would be interested if there is a automatic
translation of C header files in CMUCL ffi code (maybe along the lines
Matlisp works for Fortran routines).

Thank you very much,

Nicolas.

Reply via email to