def make_ar_transition_matrix(coefficients):
top_row = tf.expand_dims(coefficients, -<NUM_LIT:2>)<EOL>coef_shape = dist_util.prefer_static_shape(coefficients)<EOL>batch_shape, order = coef_shape[:-<NUM_LIT:1>], coef_shape[-<NUM_LIT:1>]<EOL>remaining_rows = tf.concat([<EOL>tf.eye(order - <NUM_LIT:1>, dtype=coefficients.dtype, batch_shape=batch_shape),<EOL>tf.zeros(tf.concat([batch_shape, (order - <NUM_LIT:1>, <NUM_LIT:1>)], axis=<NUM_LIT:0>),<EOL>dtype=coefficients.dtype)<EOL>], axis=-<NUM_LIT:1>)<EOL>ar_matrix = tf.concat([top_row, remaining_rows], axis=-<NUM_LIT:2>)<EOL>return ar_matrix<EOL>
Build transition matrix for an autoregressive StateSpaceModel.

    When applied to a vector of previous values, this matrix computes
    the expected new value (summing the previous states according to the
    autoregressive coefficients) in the top dimension of the state space,
    and moves all previous values down by one dimension, 'forgetting' the
    final (least recent) value. That is, it looks like this:

    ```
    ar_matrix = [ coefs[0], coefs[1], ..., coefs[order]
                  1.,       0 ,       ..., 0.
                  0.,       1.,       ..., 0.
                  ...
                  0.,       0.,  ..., 1.,  0.            ]
    ```

    Args:
      coefficients: float `Tensor` of shape `concat([batch_shape, [order]])`.

    Returns:
      ar_matrix: float `Tensor` with shape `concat([batch_shape,
      [order, order]])`.