Post Reply 
[VA] SRC #014 - HP-15C & clones: Accurate NxN Determinants
03-06-2024, 06:18 PM (This post was last modified: 03-06-2024 06:22 PM by Werner.)
Post: #11
RE: [VA] SRC #014 - HP-15C & clones: Accurate NxN Determinants
Shorter, and a bit slower (still marginally faster than Valentin's original)
  • 50 lines, 56 bytes (8 registers) (including RTN ;-)
  • a 10x10 matrix takes only about 5 seconds on the 15CE
  • registers used I012, so needs 2 DIM (i) setting at least
  • order n needs n^2+3*n matrix elements
  • total memory needed, not counting I01: n^2+3*n+9

max. orders possible:
  • 15C/64: 6x6
  • 15CE/192: 12x12
  • DM15L/229: 13x13
#  Program produced by JRPN 15C. (https://jrpn.jovial.com/run15/index.html)
#  Generated 2024-3-6 11:35 Central European Standard Time.

   000 {          } 
   001 { 42 21 14 } f LBL D
   002 {        1 } 1
   003 {    44  0 } STO 0
   004 { 45 23 11 } RCL DIM A
   005 {    44 25 } STO I
   006 {    43 35 } g CLx
   007 { 42 23 14 } f DIM D     -- erase D
   008 {       33 } Rv
   009 { 42 23 14 } f DIM D     -- D,E 1xn
   010 { 42 23 15 } f DIM E
   011 { 42 26 12 } f RESULT B
   012 { 42 21  1 } f LBL 1     -- for i=n to 1 step -1
   013 { 45 23 11 } RCL DIM A
   014 {       16 } CHS
   015 {    45 25 } RCL I
   016 {    44  1 } STO 1
   017 {       40 } +
   018 {    44  2 } STO 2       -- nj := -(n-i);
   019 {    43 35 } g CLx
   020 { 44 16 15 } STO MATRIX E
   021 { 42  5 15 } f DSE E     -- E := -ei;
   022 { 42 21  2 } f LBL 2     -- for nj=i-n..0
   023 { 45 16 15 } RCL MATRIX E
   024 { 45 16 11 } RCL MATRIX A
   025 {       20 } *
   026 {       16 } CHS         -- B := -E*A;
   027 {    45 25 } RCL I
   028 { 45 30  2 } RCL - 2
   029 {    44  1 } STO 1       -- j := i - nj;
   030 {    45 14 } RCL D       -- t := D(j);
   031 {        1 } 1
   032 {    45 25 } RCL I
   033 { 45 43 12 } RCL g B
   034 { 44 30 14 } STO - D     -- D(j) := D(j) - B(i);
   035 {    43 35 } g CLx
   036 {        1 } 1
   037 {    45 25 } RCL I
   038 {    44  1 } STO 1
   039 { 44 43 12 } STO g B     -- B(i) := t;
   040 { 42 21  9 } f LBL 9     -- E(k) := B(k); k=i..n
   041 {    45 12 } RCL B
   042 {  44 15 u } u STO E
   043 {    22  9 } GTO 9
   044 { 42  6  2 } f ISG 2     -- next nj;
   045 {    22  2 } GTO 2
   046 { 42  5 25 } f DSE I     -- next i;
   047 {    22  1 } GTO 1
   048 {    45 14 } RCL D
   049 {       16 } CHS
   050 {    43 32 } g RTN


# End.

Cheers, Werner
(that's it, I think. I see no immediate further improvements)
(incidentally, while I used JRPN to produce the above listing, the program does not run on the simulator as-is, as it contains a bug (the simulator, not the program) - insert ENTER just after RCL D in line 030 to make it work on JRPN)

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #014 - HP-15C & clones: Accurate NxN Determinants - Werner - 03-06-2024 06:18 PM



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