Post Reply 
RPL mini-challenge: Create an anti-Identity Matrix
05-13-2018, 08:54 AM (This post was last modified: 05-13-2018 09:27 AM by pier4r.)
Post: #17
RE: RPL mini-challenge: Create an anti-Identity Matrix
First and foremost I would like to write some opinions.

I learned in some threads of this forum that variety is really nice and healthy, so I am really happy to see different solutions, and not only those that are "fast" (or in many other threads "short").
Also I like when a problem lead to solutions of related problems or topics that do not solve the original problem, but are nonetheless valuable.

My first approach is already covered by 3298 in short:

Make a constant matrix, then subtract the identity matrix.

With fixed values just for testing
Code:

\<<
30 IDN
{ 30 30 } 1 CON
-
\>>

This is 2.49 seconds on my 50g. Although the creation of the two matrix themselves is quite fast (0.6 seconds or so) so it is the subtraction that takes time.


PS: I recently checked on youtube a video from the HHC 2011, about speed comparisons between the 15c and the 15c LE. Namir did them.
Well it is an interesting approach that can be done for userRPL (or in general) too. Putting single commands in a loop, at least the most common ones, and see how much time they take.
Although such endeavor would be quite time consuming, but highly informative.

update1: now I am attemping to use AXL (I will also use some libraries to go out of the box and have a comparison, as I wrote. Variety is nice).

Code:

@first make an identity matrix, transform in list, apply the NOT, back to matrix. 
@In newRPL can be done directly on a matrix. 
@ With MAP as Joe wrote, can be done directly too, but I don't want to change the approx mode.
\<< 30. IDN AXL 1.
  \<< 1.
    \<< NOT
    \>> DOSUBS
  \>> DOSUBS AXL
\>>
@ 5.23 secs
@ the AXL costs a bit


Code:

@ pack several lists, then AXL
@ 10.3 seconds
@ AXL here is quite quick, is the resto of the code that takes 10 seconds.
@ likely the repeated IFT
\<< 1. 30.
  FOR iter 1. 30. NDUPN \->LIST 1.
    \<< NSUB iter == NOT IFT
    \>> DOSUBS
  NEXT 30. \->LIST AXL
\>>

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL mini-challenge: Create an anti-Identity Matrix - pier4r - 05-13-2018 08:54 AM



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