NESSi  v1.0.2 The NonEquilibrium Systems Simulation Library

## ◆ set_matrixelement() [2/6]

template<typename T >
 void cntr::herm_matrix< T >::set_matrixelement ( int tstp, int i1, int i2, herm_matrix< T > & g )

Sets given matrix elements of all components at time step tstp to the components of a given herm_matrix of scaler type.

Purpose

Sets the (sub-) matrix elements (i1,i2) of all components at time step tstp to the components at time step tstp of a given herm_matrix.

Parameters
 tstp The time step at which the components are set. i1 First index for submatrix. i2 Second index for submatrix. g The herm_matrix from which the time step is copied.

Definition at line 2264 of file cntr_herm_matrix_impl.hpp.

2265  {
2266  int i, sij = i1 * size2_ + i2;
2267  assert(tstp <= g.nt() && tstp <= nt_ && "tstp <= g.nt() && tstp <= nt_");
2268  assert(0 <= i1 && i1 < size1_ && 0 <= i2 && i2 < size2_ && g.size1() == 1
2269  && "0 <= i1 && i1 < size1_ && 0 <= i2 && i2 < size2_ && g.size1() == 1");
2270  if (tstp == -1) {
2271  for (i = 0; i <= ntau_; i++)
2272  matptr(i)[sij] = *(g.matptr(i));
2273  } else {
2274  for (i = 0; i <= tstp; i++)
2275  retptr(tstp, i)[sij] = *(g.retptr(tstp, i));
2276  for (i = 0; i <= ntau_; i++)
2277  tvptr(tstp, i)[sij] = *(g.tvptr(tstp, i));
2278  for (i = 0; i <= tstp; i++)
2279  lesptr(i, tstp)[sij] = *(g.lesptr(i, tstp));
2280  }
2281 }