NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ set_matrixelement() [3/6]

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

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

Purpose

Sets the (sub-) matrix elements (i1,i2) of all components at time step tstp to the matrix elements (j1,j2) of the corresponding componentof a given herm_matrix_timestep.

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_timestep of a matrix type from which the time step is copied.

j1

First index for submatrix of g.

j2

Second index for submatrix of g.

Definition at line 2313 of file cntr_herm_matrix_impl.hpp.

2315  {
2316  int i, sij = i1 * size2_ + i2, tij = j1 * g.size2() + j2;
2317  assert(tstp == g.tstp_ && tstp <= nt_ && "tstp == g.tstp_ && tstp <= nt_");
2318  assert(0 <= i1 && i1 < size1_ && 0 <= i2 && i2 < size2_ && "0 <= i1 && i1 < size1_ && 0 <= i2 && i2 < size2_");
2319  assert(0 <= j1 && j1 < g.size1() && 0 <= j2 && j2 < g.size1()
2320  && "0 <= j1 && j1 < g.size1() && 0 <= j2 && j2 < g.size1()");
2321  if (tstp == -1) {
2322  for (i = 0; i <= ntau_; i++)
2323  matptr(i)[sij] = g.matptr(i)[tij];
2324  } else {
2325  for (i = 0; i <= tstp; i++)
2326  retptr(tstp, i)[sij] = g.retptr(i)[tij];
2327  for (i = 0; i <= ntau_; i++)
2328  tvptr(tstp, i)[sij] = g.tvptr(i)[tij];
2329  for (i = 0; i <= tstp; i++)
2330  lesptr(i, tstp)[sij] = g.lesptr(i)[tij];
2331  }
2332 }