[r-t] Delta-based transposition representation

Alexander Holroyd holroyd at math.ubc.ca
Tue Jun 14 23:25:06 UTC 2016


I used something related in Inpact. 
(http://www.math.ubc.ca/~holroyd/ringing.html)
When it was written (in 2000 or so), it was vitally important to apply 
place notations very fast, so that a peal could be reproved instantly 
whenever the user makes a change.

I found a way to do this using bit operations.  A row r on up to 16 bells 
is represented as a 64-bit word, with 4 bits per place.  A change c is 
represented by 3 64-bit masks, representing the positions of bells that 
move up, down, or make a place.

E.g. the change 14 on 6 bells would be:
down 	= 0000 1111 0000 0000 1111 0000
up	= 0000 0000 1111 0000 0000 1111
place	= 1111 0000 0000 1111 0000 0000

We can apply this to row r in just 7 operations:

  (r>>4)&down | (r<<4)&up | r&place

where <<,>> are bit shift operators, and &,| are bitwise and and or.

Ironically it was just after finishing writing this that I became 
interested in ringing on more than 16...

Ander

On Thu, 9 Jun 2016, Alan Burlison wrote:

> A while ago I wrote some code to expand place notation to the corresponding 
> blue line numbers. One thing that I did to make my life easier was to 
> describe the difference between two rows as deltas. For example the change 
> between the following two rows:
>
> A  1 2 3 4 5 6
> B  2 1 4 3 6 5
>
> would be:
>
> +1 -1 +1 -1 +1 -1
>
> Between the two ends of a sequence of rows:
>
> A  2 6 4 1 5 3
> :
> N  5 3 6 2 1 4
>
> +3 +1 +3 +1 -4 -4
>
> i.e. the bell in place 1 (#2) has moved +3 places to place 4. the bell in 
> place 6 (#3) has moved -4 places to place 2.
>
> Applying a change to ma row is very simple - just add the deltas to the 
> current bell positions. It's easy to create the inverse of a change by simply 
> reversing the signs of the deltas, and you trivially know if a change is 
> valid by summing the deltas - the result must be 0. It's also easy to check 
> for other validity errors, for example the first colunm must be either 0 or 1 
> as the bell can't move off the end of the row and so forth.
>
> I haven't seen changes described this way anywhere else which puzzles me a 
> bit, because to me it's the blindingly obvious way of doing it, rather than 
> the position-based notation I've seen used elsewhere.
>
> -- 
> Alan Burlison
> --
>
> _______________________________________________
> ringing-theory mailing list
> ringing-theory at bellringers.net
> http://bellringers.net/mailman/listinfo/ringing-theory_bellringers.net
>




More information about the ringing-theory mailing list