def rotate(pos, vel, matrix):
    """
    Rotate.

    Applies the rotation `matrix` to a set of particles positions `pos` and
    velocities `vel`

    Parameters
    ----------
    pos : `np.ndarray`, shape = (N_part, 3)
        Positions of particles
    vel : `np.ndarray`, shape = (N_part, 3)
        Velocities of particles
    matrix : `np.ndarray`
        Rotation matrix, with shape (3, 3)

    Returns
    -------
    pos_rot : `np.ndarray`, shape = (N_part, 3)
        Rotated, positions of particles
    vel_rot : `np.ndarray`, shape = (N_part, 3)
        Rotated, velocities of particles
    """
    pos_rot = pos @ matrix
    vel_rot = vel @ matrix

    return pos_rot, vel_rot