Post Reply 
Happy New Year 2024 ... and 2023's last teaser !
01-03-2024, 02:59 PM (This post was last modified: 01-03-2024 03:00 PM by John Keith.)
Post: #24
RE: Happy New Year 2024 ... and 2023's last teaser !
(01-03-2024 12:17 PM)Gerson W. Barbosa Wrote:  Per(M) = Det(M’) - 2p

where

M’ is M with elements of the main diagonal multiplied by -1

and

p is the product of the elements of the main diagonal of M’.

This works for order 3 matrices. For order 2 matrices the sign of the result must be changed.

For example,

M:
[[ -1 3 2 ]
[ 7 -4 5 ]
[ 6 8 9 ]]

M’:
[[ 1 3 2 ]
[ 7 4 5 ]
[ 6 8 -9 ]]

Det(M’) = 267

p = 1×4×(-9) = -36

Per(M) = 267 - 2×(-36) = 339

That is quite interesting. In my (obsolete) program, I compute the 3 x 3 permanent with inline code as follows, requiring 9 multiplications and 5 additions.

Code:

        OBJ\-> DROP                            @ Explode matrix onto stack
        5. PICK OVER * PICK3 6. PICK * +
        9. ROLLD 6. PICK * PICK3 5. ROLL * +
        6. ROLLD 4. ROLL * UNROT * + *
        UNROT * + UNROT * +                    @ 3 * 3 permanent


This may be faster than using DET.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Happy New Year 2024 ... and 2023's last teaser ! - John Keith - 01-03-2024 02:59 PM



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