#NEWLINE# @ jit ( nopython = True ) #NEWLINE# def _generate_a_indptr( num_states , s_indices , out ) : #NEWLINE# #INDENT# '\n    Generate `a_indptr`; stored in `out`. `s_indices` is assumed to be\n    in sorted order.\n\n    Parameters\n    ----------\n    num_states : scalar(int)\n\n    s_indices : ndarray(int, ndim=1)\n\n    out : ndarray(int, ndim=1)\n        Length must be num_states+1.\n\n    ' #NEWLINE# idx = 0 #NEWLINE# out [ 0 ] = 0 #NEWLINE# for s in range ( ( num_states - 1 ) ) : #NEWLINE# #INDENT# while ( s_indices [ idx ] == s ) : #NEWLINE# #INDENT# idx += 1 #NEWLINE# #UNINDENT# out [ ( s + 1 ) ] = idx #NEWLINE# #UNINDENT# out [ num_states ] = len ( s_indices )