I am trying to convert this matlab code to python which uses circshift on sparse matrix :
W = [W_A;circshift(W_B, m,2);circshift(W_N, 2*m,2)];
where W_B is a sparse matrix of dim 103 by 309 and looks like this
(1,1) 10
(2,1) -10
(1,2) -10
(2,2) 20
.............
W_A and W_N are sparse matrices of same dim 103 by 309 but with different values. The output W is a sparse matrix of 309 by 309 which looks something like this :
(1,1) 10
(2,1) -10
(1,2) -10
................
and m =103
This my python code for the matlab syntax :
W = np.array([W_A_check, np.roll(W_B_check, m-1, 2), np.roll(W_N_check, 2*m-1, 2)])
I am not sure if this is the correct converted syntax as I am looking for the same kind of output like matlab . Also, the numpy roll function is giving me the axis error below :
axis 2 is out of bounds for array of dimension 0
How can I use numpy roll correctly to get the same output as matlab. Any sugesstions