Hello folks
(the following is not a showstopper, but I am just curious).
I am trying to define a closure (still doing LU decompositions and matrix
solutions), and would like to keep some of the variables around for further
processing. Here is one example
(defun parallel-plate-equilibrium (eps0 T0 eps1- eps1+ eps2 T2
&key (q1 0d0))
(letm ((dim 5)
(mat (make-array (list dim dim)
:element-type 'double-float
:initial-contents
(list (list 1d0 (1- eps0) 0d0 0d0 0d0)
(list (1- eps1-) 1d0 0d0 0d0 (0- eps1-))
(list 0d0 0d0 1d0 (1- eps1+) (0- eps1+))
(list 0d0 0d0 (1- eps2) 1d0 0d0)
(list (0- eps1-) 0d0 0d0 (0- eps1+) (+ eps1- eps1+)))))
(mmat (matrix-double-float mat))
;; (mmat0 mmat)
(rhs (make-array dim
:element-type 'double-float
:initial-contents (list (st4 T0 eps0) 0d0 0d0
(st4 T2 eps2) q1)))
(mrhs (vector-double-float rhs))
(per (permutation dim))
(res (vector-double-float dim))
(0-vec (vector-double-float (make-array dim
:initial-element 0d0)))
(x (vector-double-float dim)))
(lu-decomp mmat per)
(lu-solve mmat per mrhs x)
(data x)
(lambda (command)
(case command
;; these two will fail because mmat, mrhs, mmat0 are nil
;; (:solve (lu-solve mmat per mrhs x))
;; (:check (gemv :notrans 1d0 mmat0 x 0d0 0-vec))
(:mat mat)
(:rhs rhs)
(:temp (expt (/ (aref (data x) 4)
+sigma+)
0.25))
(:fluxes (data x))))))
However, it seems that gsll's variables are discarded once the letm form is
done (as per documentation, and also with macroexpansion). But the code for
letm mentions some "freers", which gave me hope that I can specify the freer
as NIL. But I could not figure that one out quite yet. So, is it possible
to save some of gsll's variables for later use?
Thanks,
Mirko