permanent of square matrix
|
01-25-2024, 03:49 PM
Post: #11
|
|||
|
|||
RE: permanent of square matrix
(01-24-2024 04:03 PM)John Keith Wrote: This line, v -= 2*d[j]*M[j] results in an array (or list) multiplication in every iteration. I guess it depends on programming language used. Python was using numpy for fast v list update, rewritten it without multiply does not gain much. Note: 2*d[j] is just a number, not a list For LuaJIT, the cost is smaller still (OP 9×9 matrix, speedup under 5%) Array access cost a lot more than multiply. Bit operations cost even more. (this is just relatively speaking ... LuaJIT is FAST!) Below LuaJIT version is the one I kept. Code: function permanent(M) I gave up on the 5% speedup, for cleaner code. Still, for OP 9×9 matrix, its speed is doubled the bitwise version. (post #9) |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)