Post Reply 
[VA] SRC #014 - HP-15C & clones: Accurate NxN Determinants
02-20-2024, 03:43 PM (This post was last modified: 02-20-2024 04:40 PM by J-F Garnier.)
Post: #5
RE: [VA] SRC #014 - HP-15C & clones: Accurate NxN Determinants
I spent more time to play with this program and have a few more comments on Valentin's SRC #014:

This algorithm is fast, it is much faster than the expansion by minor (illustrated by the XDET program from Valentin), and its speed is actually of the same order of magnitude as the LU-decomposition method used by the HP standard DET functions. Of course, in this implementation, a part of the processing is done as user code so not as fast as it could be in microcode.

However, a characteristic of this algorithm and others is that the values of intermediate iterative calculations grow exponentially in magnitude.
We should remember that the exact representation of integer numbers is quite limited on our Classic machines: 1E10 for the 15c , 1E12 for the 71B (resp. 1E13 and 1E15 in internal calculations).

This SRC is a great illustration of a recent algorithm, but it works on the 15c (or the 71B) only if the input matrix elements are small enough to avoid any integer overflow in the intermediate calculations.
As a rule of the thumb, the elements of a 7x7 or 8x8 matrix should not have more than 2 digits. I found examples with numbers of 3 digits that still work well, but others don't.

For instance:

| 274 213 400 322 341 308 446 |
| 202 210 383 295 360 295 450 |
| 154 175 332 175 322 361 413 |
| 176 147 265 272 328 277 351 |
| 111 131 249 182 324 296 340 |
| 155 179 329 218 381 399 444 |
| 147 127 229 174 245 258 297 |


The exact determinant of this matrix is 1, as can be checked on a symbolic system, or just Free42.
Valentin's 15c program indeed gives exactly 1 (the 15c built-in DET gives -571)

On the contrary, with this matrix:

| 477 389 402 515 358 409 289 |
| 302 273 282 322 280 283 205 |
| 278 231 339 319 343 254 214 |
| 432 360 406 502 391 359 319 |
| 475 316 509 649 543 393 288 |
| 299 304 351 369 459 346 221 |
| 526 561 442 441 371 491 445 |


Valentin's 15c program gives 7269230 instead of 1 (the buit-in DET gives a hardly better -1337 value, with the wrong sign)

This SRC achieved its goal, as far as I'm concerned: learn new (even recent) methods for computing determinants, such as the Bareiss and Bird algorithms, and understand (a little bit) how they are working as well as their limitations on our machines.

J-F
Visit this user's website 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 - J-F Garnier - 02-20-2024 03:43 PM



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