Post Reply 
(42S) Iterative refinement
07-23-2015, 08:11 AM (This post was last modified: 06-15-2017 01:28 PM by Gene.)
Post: #1
(42S) Iterative refinement
See the article with the same subject. I never know where to post these, so I put them in both :-). And comments are disabled for articles, for some reason.
Quick usage instructions:
Put A and b on the stack, just as you would for a normal solve, so b ENTER A
Then XEQ "/IR" will solve the system and perform a corrective refinement step, leaving the result in X. If you are careful to leave the stack undisturbed (as browsing the result with EDIT, arrows, EXITALL will do), you may execute further refinement steps with R/S.

Code:
                L       X       Y       Z       T
00 { 58-Byte Prgm }
01>LBL "/IR"            A       b
02 X<>Y
03 ENTER
04 TRANS                bt      b       A
05 RCL ST Z             A       bt      b       A
06 STO/ ST Z            A       bt      x       A
07 TRANS
08 EDIT
09 INSR                 0       bt      x       A
10 Rv                   bt      x       A
11 PUTM
12 CLX
13 RCLEL
14 EXITALL
15 TRANS                bA      x       A
16 X<>Y
17>LBL 02               x       bA      A
18 STO ST L     x       x       bA      A
19 EDIT
20 INSR
21 -1
22 EXITALL      x       -1x     bA      A
23 X<> ST L     -1x     x       bA      A
24 RCL ST Y     -1x     bA      x       bA      A
25 RCLx ST L            Ax-b    x       bA      A
26 RCL/ ST T            -dx     x       bA      A
27 -                    x       bA      A
28 RTN
29 GTO 02
30 END

Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
07-23-2015, 09:32 AM
Post: #2
RE: [42S] Iterative refinement
Nicely done. Bravo!
Find all posts by this user
Quote this message in a reply
07-23-2015, 01:14 PM (This post was last modified: 07-23-2015 01:20 PM by Gerald H.)
Post: #3
RE: [42S] Iterative refinement
I have to contradict you - the programme will NOT run the example you give on FREE42.

Line 26 produces a "Dimension Error".
Find all posts by this user
Quote this message in a reply
07-23-2015, 01:39 PM
Post: #4
RE: [42S] Iterative refinement
Yes, a bug in Free42!! I never thought I'd see the day - I never did try it out on Free42 as it is useless anyway, and (for another program under development) I tried and used so many matrix-specific things that all worked perfectly, that I trusted Free42 unconditionally.
But INSR does not disable stack lift as it does on a 42S, hence the error (caused by the -1 not overwriting the 0 put there by INSR, but pushing it on the stack)
I'll post it in the Free42 google group.

Thanks, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
07-25-2015, 05:21 AM
Post: #5
RE: [42S] Iterative refinement
Happily the programme works on the go42S emulator for android.
Find all posts by this user
Quote this message in a reply
07-25-2015, 07:18 AM
Post: #6
RE: [42S] Iterative refinement
Just adding a CLX in front of -1 will make it run on Free42 as well, but it's useless. Free42 does not use more digits when evaluating dot products, (it already uses the maximum available in the Intel Decimal floating-point library), and so we can't improve on the results of the first solve operation.

Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
07-25-2015, 08:30 AM
Post: #7
RE: [42S] Iterative refinement
I dislike the epithet "useless".

Your programme is an economic implementation of the algorithm.

Didactically excellent.

That it doesn't improve the result on free42 shows that free42 is not truly an emulator but rather a fine calculator very closely modelled on the 42s.

The programme found a bug in free42 - surely a useful accomplishment?

Hope the bug will shortly be eradicated in a new free42 version.

As a real emulator I recommend go42S.
Find all posts by this user
Quote this message in a reply
02-29-2016, 08:55 AM
Post: #8
RE: [42S] Iterative refinement
The INSR bug has been fixed on free42 1.5.7 - Bravo!

What do you think of the new action bar?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)