Most viewed recipes tagged "shift"http://code.activestate.com/recipes/tags/shift/views/2012-06-05T12:38:36-07:00ActiveState Code RecipesA matrix generated by shifting the zeroth row (Python)
2012-06-05T12:38:36-07:00Andrej T.http://code.activestate.com/recipes/users/4182297/http://code.activestate.com/recipes/578149-a-matrix-generated-by-shifting-the-zeroth-row/
<p style="color: grey">
Python
recipe 578149
by <a href="/recipes/users/4182297/">Andrej T.</a>
(<a href="/recipes/tags/matrix/">matrix</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/shift/">shift</a>).
Revision 7.
</p>
<p>ShiftMatrix is a class that generates matrix values by shifting the zeroth row left or right length_of_row times. For example: if you initialize it with sm = ShiftMatrix([1,2,3]), sm[1] will return [3,1,2]. Only the initial list is stored, the other values are generated at runtime.</p>