Skip to main content
10 events
when toggle format what by license comment
Jan 12, 2018 at 14:46 comment added CiaPan Additionally, as you're 'manually' multiply matrices instead of using some general, three-loop routine or matrix multiplication, you can get rid of a 2×2 matrix and use a 3–items vector instead, which could save some overhead on a second dimension indexing operations.
Jan 12, 2018 at 13:52 comment added CiaPan By recursion (or mathematical induction) all your matrices are symmetric, so you can save approximately 1/4 of work by not calculating the item at [1][0] and using item [0][1] instead.
Jan 12, 2018 at 13:41 vote accept coderodde
Jan 12, 2018 at 13:36 answer added Eric Duminil timeline score: 1
Jan 12, 2018 at 11:40 comment added coderodde @EricDuminil I have already rolled the Java port, but be my guest.
Jan 12, 2018 at 11:35 comment added coderodde @EricDuminil That's a nice result!
Jan 12, 2018 at 11:03 comment added coderodde @EricDuminil You are wrong. My solution performs \$\Theta(\log N)\$ multiplications of a \$2 \times 2\$ matrices, and the one in the link \$\Theta(N)\$ additions. For instance, my version computes the millionth Fibonacci number in half a second; the one behind the link takes almost 40 seconds.
Jan 12, 2018 at 1:47 answer added greybeard timeline score: 0
Apr 13, 2017 at 12:40 history edited CommunityBot
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Nov 1, 2015 at 7:58 history asked coderodde CC BY-SA 3.0