title: How to implement Circular Permutation (left and right shift) of CSR_Matrix in Scipy Python Sparse Matrices?
body: <p>I am using Scipy sparse matrix <code>csr_matrix</code> to be used as context vectors in word-context vectors. My <code>csr_matrix</code> is a <code>(1, 300)</code> shape so it is a 1-dimensional vector.</p>
  
  <p>I need to use permutation (circular right shift or circular left shift) on the sparse vector (for showing left context and right context).</p>
  
  <p>example:
  i have <code>[1, 2, 3, 4]</code> and i want to create right and left permutations as follow:</p>
  
  <p>right permutation: <code>[4, 1, 2, 3]</code><br>
  left permutation:  <code>[2, 3, 4, 1]</code></p>
  
  <p>In csr matrices i can't access to column indices so i can not just change the column indices.</p>
  
  <p>Is there any efficient high performance solution for row permutations in <code>csr_matrix</code> or am i missing something?</p>
  
  <p>runnable code:</p>
  
  <pre><code>from scipy.sparse import csr_matrix
  rows = [0, 0, 0]
  columns = [100, 47, 150]
  data = [-1, +1, -1]
  contextMatrix = csr_matrix( (data,(rows, columns)), shape=(1, 300) )
  </code></pre>
  
  <p>it means that i have a 300-column vector whose columns 100, 47, 150 all from row 0 are non-zero valued and their value is in data list respectively.</p>
  
  <p>now what i want is a permutation which means i want the columns array be changed into
  [101, 48, 151] for right permutation and [99, 46, 149] for left permutation.</p>
  
  <p>It should be noted that permutations are circular which means if column 299 has non-zero data, using a right permutation the data will be moved to column 0.</p>