; GCL need to be linked against blas and lapack ; to use the following code (clines " extern int dgelsy_(int *m, int *n, int *nrhs, double *a, int *lda, double *b, int *ldb, int * jpvt, double *rcond, int *rank, double *work, int * lwork, int *info); static int dgelsy(int m,int n,int nrhs,object a,int lda,object b,int ldb,object jpvt,object rcond,object rank,object work,int lwork) { int info; printf(\"RCOND is: %f\\n\",rcond->LF.LFVAL); // debug code dgelsy_(&m, &n , &nrhs ,a->lfa.lfa_self , &lda ,b->lfa.lfa_self , &ldb ,jpvt->fixa.fixa_self ,&(rcond->LF.LFVAL) ,&(rank->FIX.FIXVAL) ,work->lfa.lfa_self , &lwork , &info ); printf(\"RANK is: %d\\n\",rank->FIX.FIXVAL); //debug code return (info);} object array_staticp(object x) { return x->a.a_self < heap_end ? Ct : Cnil; } ") (defentry %array-staticp (object) (object "array_staticp")) (defun array-staticp (x) (and (arrayp x) (%array-staticp x))) (defentry %dgelsy (int int int object int object int object object object object int) (int "dgelsy")) ; Automatically generated code (defun dgelsy (m n nrhs a lda b ldb jpvt rcond rank work lwork) (and (or (typep a '(array long-float)) (error "dgelsy: a is not an array of long-float")) (or (eql 2 (array-rank a)) (error "dgelsy: a is not an array of rank 2")) (or (array-staticp a) (error "dgelsy: a is not a static array")) (or (typep b '(array long-float)) (error "dgelsy: b is not an array of long-float")) (or (eql 2 (array-rank b)) (error "dgelsy: b is not an array of rank 2")) (or (array-staticp b) (error "dgelsy: b is not a static array")) (or (typep jpvt '(array (signed-byte 32))) (error "dgelsy: jpvt is not a (signed-byte 32) array")) (or (array-staticp jpvt) (error "dgelsy: jpvt is not a static array")) (or (typep rcond 'long-float) (error "dgelsy: rcond is not a long-float")) (or (typep rank '(signed-byte 32)) (error "dgelsy: rank is not a (signed-byte 32)")) (or (typep work '(array long-float)) (error "dgelsy: work is not an array of long-float")) (or (array-staticp work) (error "dgelsy: work is not a static array")) (%dgelsy m n nrhs a lda b ldb jpvt rcond rank work lwork))) ; sample code ;(setq a (make-array '(5 5) :element-type 'long-float :static t)) ;(setq b (make-array '(5 5) :element-type 'long-float :static t)) ;(setq jpvt (make-array 5 :element-type '(signed-byte 32) :static t)) ;(setq rcond 0.0001) ;(and (setq work (make-array 591 :element-type 'long-float :static t)) (setq rank 0)) ;; On my machine if a is populated the following causes segfault or undefined behavior of GCL ;(dgelsy 5 5 5 a 5 b 5 jpvt rcond rank work 591)