1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 1.215 2009/04/07 22:05:21 rtoy Exp $"
3 ;;; "f2cl2.l,v 1.37 2008/02/22 22:19:33 rtoy Exp $"
4 ;;; "f2cl3.l,v 1.6 2008/02/22 22:19:33 rtoy Exp $"
5 ;;; "f2cl4.l,v 1.7 2008/02/22 22:19:34 rtoy Exp $"
6 ;;; "f2cl5.l,v 1.200 2009/01/19 02:38:17 rtoy Exp $"
7 ;;; "f2cl6.l,v 1.48 2008/08/24 00:56:27 rtoy Exp $"
8 ;;; "macros.l,v 1.112 2009/01/08 12:57:19 rtoy Exp $")
10 ;;; Using Lisp CMU Common Lisp 19f (19F)
12 ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls nil)
13 ;;; (:coerce-assigns :as-needed) (:array-type ':array)
14 ;;; (:array-slicing t) (:declare-common nil)
15 ;;; (:float-format double-float))
21 (declare (type (double-float) one
))
22 (defun r1mpyq (m n a lda v w
)
23 (declare (type (array double-float
(*)) w v a
)
24 (type (f2cl-lib:integer4
) lda n m
))
25 (f2cl-lib:with-multi-array-data
26 ((a double-float a-%data% a-%offset%
)
27 (v double-float v-%data% v-%offset%
)
28 (w double-float w-%data% w-%offset%
))
29 (prog ((cos 0.0) (sin 0.0) (temp 0.0) (i 0) (j 0) (nmj 0) (nm1 0))
30 (declare (type (f2cl-lib:integer4
) nm1 nmj j i
)
31 (type (double-float) temp sin cos
))
36 '" given an m by n matrix a, this subroutine computes a*q where"
37 '" q is the product of 2*(n - 1) transformations"
39 '" gv(n-1)*...*gv(1)*gw(1)*...*gw(n-1)"
41 '" and gv(i), gw(i) are givens rotations in the (i,n) plane which"
42 '" eliminate elements in the i-th and n-th planes, respectively."
43 '" q itself is not given, rather the information to recover the"
44 '" gv, gw rotations is supplied."
46 '" the subroutine statement is"
48 '" subroutine r1mpyq(m,n,a,lda,v,w)"
52 '" m is a positive integer input variable set to the number"
55 '" n is a positive integer input variable set to the number"
58 '" a is an m by n array. on input a must contain the matrix"
59 '" to be postmultiplied by the orthogonal matrix q"
60 '" described above. on output a*q has replaced a."
62 '" lda is a positive integer input variable not less than m"
63 '" which specifies the leading dimension of the array a."
65 '" v is an input array of length n. v(i) must contain the"
66 '" information necessary to recover the givens rotation gv(i)"
69 '" w is an input array of length n. w(i) must contain the"
70 '" information necessary to recover the givens rotation gw(i)"
73 '" subroutines called"
75 '" fortran-supplied ... dabs,dsqrt"
77 '" argonne national laboratory. minpack project. march 1980."
78 '" burton s. garbow, kenneth e. hillstrom, jorge j. more"
82 '" apply the first set of givens rotations to a."
84 (setf nm1
(f2cl-lib:int-sub n
1))
85 (if (< nm1
1) (go label50
))
86 (f2cl-lib:fdo
(nmj 1 (f2cl-lib:int-add nmj
1))
89 (setf j
(f2cl-lib:int-sub n nmj
))
91 (> (f2cl-lib:dabs
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
))
94 (/ one
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
))))
96 (> (f2cl-lib:dabs
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
))
98 (setf sin
(f2cl-lib:dsqrt
(- one
(expt cos
2)))))
101 (f2cl-lib:dabs
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
))
103 (setf sin
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
)))
106 (f2cl-lib:dabs
(f2cl-lib:fref v-%data%
(j) ((1 n
)) v-%offset%
))
108 (setf cos
(f2cl-lib:dsqrt
(- one
(expt sin
2)))))
109 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
115 (f2cl-lib:fref a-%data%
120 (f2cl-lib:fref a-%data%
124 (setf (f2cl-lib:fref a-%data%
(i n
) ((1 lda
) (1 n
)) a-%offset%
)
127 (f2cl-lib:fref a-%data%
132 (f2cl-lib:fref a-%data%
136 (setf (f2cl-lib:fref a-%data%
(i j
) ((1 lda
) (1 n
)) a-%offset%
)
141 '" apply the second set of givens rotations to a."
143 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
147 (> (f2cl-lib:dabs
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
))
150 (/ one
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
))))
152 (> (f2cl-lib:dabs
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
))
154 (setf sin
(f2cl-lib:dsqrt
(- one
(expt cos
2)))))
157 (f2cl-lib:dabs
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
))
159 (setf sin
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
)))
162 (f2cl-lib:dabs
(f2cl-lib:fref w-%data%
(j) ((1 n
)) w-%offset%
))
164 (setf cos
(f2cl-lib:dsqrt
(- one
(expt sin
2)))))
165 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
171 (f2cl-lib:fref a-%data%
176 (f2cl-lib:fref a-%data%
180 (setf (f2cl-lib:fref a-%data%
(i n
) ((1 lda
) (1 n
)) a-%offset%
)
183 (f2cl-lib:fref a-%data%
188 (f2cl-lib:fref a-%data%
192 (setf (f2cl-lib:fref a-%data%
(i j
) ((1 lda
) (1 n
)) a-%offset%
)
199 '" last card of subroutine r1mpyq."
202 (return (values nil nil nil nil nil nil
))))))
204 (in-package #:cl-user
)
205 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
206 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
207 (setf (gethash 'fortran-to-lisp
::r1mpyq
208 fortran-to-lisp
::*f2cl-function-info
*)
209 (fortran-to-lisp::make-f2cl-finfo
210 :arg-types
'((fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
211 (array double-float
(*)) (fortran-to-lisp::integer4
)
212 (array double-float
(*)) (array double-float
(*)))
213 :return-values
'(nil nil nil nil nil nil
)