newLISP compute matrix with lapacke and some problems
Posted: Mon Dec 17, 2012 6:44 am
I want to compute a matrix with lapacke.
The example is here http://www.netlib.org/lapack/lapacke.ht ... t_dgels_tt
here is my code:
but the rsult is wrong.
I don't know where is wrong, can anyone give me some advice?
Thank you.
kuan.
The example is here http://www.netlib.org/lapack/lapacke.ht ... t_dgels_tt
here is my code:
Code: Select all
(set 'LAPACKE "/usr/local/lib/liblapacke.so")
(import LAPACKE "LAPACKE_dgels" "int" "int" "char" "int" "int" "int" "void*" "int" "void*" "int")
(set 'a '(1 1 1 2 3 4 3 5 2 4 2 5 5 4 3))
(set 'b '(-10 -3 12 14 14 12 16 16 18 16))
(setq m 5 n 3 nrhs 2 lda 3 ldb 2)
(set 'aptr (pack (dup "lf" (* m n)) a))
(set 'bptr (pack (dup "lf" (* m nrhs)) b))
(set 'info (LAPACKE_dgels 101 78 m n nrhs (address aptr) lda (address bptr) ldb))
Code: Select all
(unpack (dup "lf" (* m nrhs)) bptr)
-> (1380.761318 1380.761318 1.844674407e+17 1.844674407e+17 1.844674407e+17 1.844674407e+17
-1.415684734e+19 -1.415684734e+19 -1.153518066e+19 -1.153518066e+19)
Thank you.
kuan.