Support RETURN-FROM in DEF%TR forms
[maxima.git] / share / colnew / ex1 / prob1.lisp
blob0cd53bde59490d83b60b2bc09e3680c0549bfc81
1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 1.221 2010/05/26 19:25:52 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.204 2010/02/23 05:21:30 rtoy Exp $"
7 ;;; "f2cl6.l,v 1.48 2008/08/24 00:56:27 rtoy Exp $"
8 ;;; "macros.l,v 1.114 2010/05/17 01:42:14 rtoy Exp $")
10 ;;; Using Lisp CMU Common Lisp CVS Head 2010-05-25 18:21:07 (20A Unicode)
11 ;;;
12 ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t)
13 ;;; (:coerce-assigns :as-needed) (:array-type ':array)
14 ;;; (:array-slicing t) (:declare-common nil)
15 ;;; (:float-format double-float))
17 (in-package :colnew)
20 (defun *main* ()
21 (prog ((ispace (make-array 200 :element-type 'f2cl-lib:integer4))
22 (m (make-array 1 :element-type 'f2cl-lib:integer4))
23 (ipar (make-array 11 :element-type 'f2cl-lib:integer4))
24 (ltol (make-array 2 :element-type 'f2cl-lib:integer4))
25 (fspace (make-array 2000 :element-type 'double-float))
26 (zeta (make-array 4 :element-type 'double-float))
27 (tol (make-array 2 :element-type 'double-float))
28 (z (make-array 4 :element-type 'double-float))
29 (u (make-array 4 :element-type 'double-float))
30 (err (make-array 4 :element-type 'double-float)) (j 0) (x 0.0)
31 (iflag 0) (dummy 0.0) (i 0))
32 (declare (type double-float dummy x)
33 (type (f2cl-lib:integer4) i iflag j)
34 (type (array double-float (2)) tol)
35 (type (array double-float (4)) err u z zeta)
36 (type (array double-float (2000)) fspace)
37 (type (array f2cl-lib:integer4 (2)) ltol)
38 (type (array f2cl-lib:integer4 (11)) ipar)
39 (type (array f2cl-lib:integer4 (1)) m)
40 (type (array f2cl-lib:integer4 (200)) ispace))
41 (f2cl-lib:fformat 6
42 ("1" " EXAMPLE OF A SIMPLE PROBLEM SETUP." "~%"
43 " UNIFORML" "Y LOADED BEAM OF VARIABLE STIFFNESS," "~%"
44 " SIMPLY SUPPORTED AT" " BOTH ENDS." "~%" "~%"))
45 (setf (f2cl-lib:fref m (1) ((1 1))) 4)
46 (setf (f2cl-lib:fref zeta (1) ((1 4))) (coerce 1.0f0 'double-float))
47 (setf (f2cl-lib:fref zeta (2) ((1 4))) (coerce 1.0f0 'double-float))
48 (setf (f2cl-lib:fref zeta (3) ((1 4))) (coerce 2.0f0 'double-float))
49 (setf (f2cl-lib:fref zeta (4) ((1 4))) (coerce 2.0f0 'double-float))
50 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
51 ((> i 11) nil)
52 (tagbody (setf (f2cl-lib:fref ipar (i) ((1 11))) 0) label10))
53 (setf (f2cl-lib:fref ipar (3) ((1 11))) 1)
54 (setf (f2cl-lib:fref ipar (4) ((1 11))) 2)
55 (setf (f2cl-lib:fref ipar (5) ((1 11))) 2000)
56 (setf (f2cl-lib:fref ipar (6) ((1 11))) 200)
57 (setf (f2cl-lib:fref ltol (1) ((1 2))) 1)
58 (setf (f2cl-lib:fref ltol (2) ((1 2))) 3)
59 (setf (f2cl-lib:fref tol (1) ((1 2))) (coerce 1.0f-7 'double-float))
60 (setf (f2cl-lib:fref tol (2) ((1 2))) (coerce 1.0f-7 'double-float))
61 (multiple-value-bind
62 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8 var-9 var-10
63 var-11 var-12 var-13 var-14 var-15 var-16)
64 (colsys 1 m 1.0 2.0 zeta ipar ltol tol
65 (make-array 1 :element-type (type-of dummy) :initial-element dummy)
66 ispace fspace iflag #'fsub #'dfsub #'gsub #'dgsub dummy)
67 (declare (ignore var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
68 var-9 var-10 var-12 var-13 var-14 var-15 var-16))
69 (setf iflag var-11))
70 (if (/= iflag 1) (f2cl-lib::stop))
71 (setf x (coerce 1.0f0 'double-float))
72 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
73 ((> i 4) nil)
74 (tagbody
75 (setf (f2cl-lib:fref err (i) ((1 4))) (coerce 0.0f0 'double-float))
76 label20))
77 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
78 ((> j 101) nil)
79 (tagbody
80 (multiple-value-bind (var-0 var-1 var-2 var-3)
81 (appsln x z fspace ispace)
82 (declare (ignore var-1 var-2 var-3))
83 (setf x var-0))
84 (exact x u)
85 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
86 ((> i 4) nil)
87 (tagbody
88 (setf (f2cl-lib:fref err (i) ((1 4)))
89 (f2cl-lib:amax1 (f2cl-lib:fref err (i) ((1 4)))
90 (abs
91 (- (f2cl-lib:fref u (i) ((1 4)))
92 (f2cl-lib:fref z (i) ((1 4)))))))
93 label30))
94 (setf x (+ x 0.01f0))
95 label40))
96 (f2cl-lib:fformat 6
97 ("~%" " ERROR TOLERANCES SATISFIED" "~%" "~%"
98 " THE EXACT ERRORS ARE," "~%" "~7@T" 4
99 (("~12,4,2,0,'*,,'EE")) "~%")
100 (do ((i 1 (f2cl-lib:int-add i 1))
101 (%ret nil))
102 ((> i 4) (nreverse %ret))
103 (declare (type f2cl-lib:integer4 i))
104 (push (f2cl-lib:fref err (i) ((1 4))) %ret)))
105 (f2cl-lib::stop)
106 end_label
107 (return nil)))
109 (in-package #-gcl #:cl-user #+gcl "CL-USER")
110 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
111 (eval-when (:load-toplevel :compile-toplevel :execute)
112 (setf (gethash 'fortran-to-lisp::*main*
113 fortran-to-lisp::*f2cl-function-info*)
114 (fortran-to-lisp::make-f2cl-finfo :arg-types 'nil
115 :return-values 'nil
116 :calls 'nil)))