Post Reply 
Seeking Your Suggested Matrix Test Program for the HP-15C
08-04-2023, 04:39 PM
Post: #4
RE: Seeking Your Suggested Matrix Test Program for the HP-15C
  
Hi, Bob,

(08-03-2023 08:09 PM)rprosperi Wrote:  Stay tuned another day or two Namir, I believe the program that Valentin is polishing now will be the best candidate for such detailed performance testing [...]

Thanks for your appreciation re my program being ideal for Namir's purposes but in this particular case, I beg to differ.

Namir's needs would be best served using this little 20-step HP-15C routine I've just written for him right now, which takes the number of loops to perform from the X stack register and repeatedly executes any desired function(s). In this case it creates a 7x7 matrix, populates it with random values, and computes its inverse, rinse and repeat. The [1/x] at step 17, which computes the inverse, can be replaced by other functions or even call (GSB) some program.

Here's the commented listing and pertinent Notes:

  01  LBL E        assumes the number of loops is in the display
  02  STO I        store # of loops in RI, the indez register
  03   1           specify R1 as the last data register ...
  04  DIM (i)      ... so allocating all the memory to the common pool
  05  MATRIX 0     redimension all five matrices to 0x0
  06   7           7 in stack X
  07  ENTER        7 in stack Y too
  08  DIM A        dimension A to 7x7 (8x8 wouldn't fit in the original 15C)
  09  MATRIX 1     reset the row/col indexes to the first element of A

  10  LBL 0        loop to fill up A with random values
  11    RAN#       generate a random number [0..1)
  12u   STO A      store it in A's current element and update indexes
  13  GTO 0        if still not at the last element, loop for more

  14  RESULT A     all elements filled up, A will be the result matrix
  15  RCL MATRIX A recall matrix A to the X stack register

  16  LBL 1        loop to perform some matrix operation(s) repeatedly
  17    1/x        in this case, the matrix operation is inverting A
  18    DSE I      decrement the loop counter
  19  GTO 1        if not done with the loops, go loop once again

  20  RTN          all loops done, end program

Run it like this: #loops, GSB E (or just E in User mode).

Notes:
  • You can specify a smaller matrix by changing the 7 al step 6 by a lower value
  • you can replace the 1/x at step 17 with one or more operations of your choice or even call some program if you know what you're doing (they will be repeated in every loop)
  • the STO at step 12 *must* be entered in User mode (uSTO)
  • if repeatability is desired, initialize the RNG with: (some seed), STO RAN#
  • take into account the particular 15C version when specifiying the number of loops, as the original HP-15C is quite slow. These timings are typical when inverting a matrix using it:

         1x1: 0.5", 2x2: 1.8", 3x3: 5.3", 4x4: 12", 5x5: 22", 6x6: 36", 7x7: 55"

    and 8x8 would take 80" but specifying such big matrix would leave no memory at all for any program. Other 15C versions are much faster and usually have significantly more memory, from 1.5x (CE/96) to 3x (CE/192) to 3.58x (DM15/M1B). On the other hand, the CE takes less than 0.5" to invert a 7x7 matrix.
Hope this helps. Now back to finish the documentation for my incoming programs on the double, so very busy.  Smile

Best regards.
V.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Seeking Your Suggested Matrix Test Program for the HP-15C - Valentin Albillo - 08-04-2023 04:39 PM



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