add diag and set_diag