function [ state ] = ij_state( i,j,m )
    state = (i-1) * m + j;
end

