NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library

◆ operator=() [1/2]

template<typename T >
herm_matrix< T > & cntr::herm_matrix< T >::operator= ( const herm_matrix< T > &  g)

Definition at line 187 of file cntr_herm_matrix_impl.hpp.

187  {
188  if (this == &g)
189  return *this;
190  sig_ = g.sig_;
191  if (nt_ != g.nt_ || ntau_ != g.ntau_ || size1_ != g.size1_) {
192  delete[] les_;
193  delete[] ret_;
194  delete[] tv_;
195  delete[] mat_;
196  nt_ = g.nt_;
197  ntau_ = g.ntau_;
198  size1_ = g.size1_;
199  size2_ = g.size1_;
200  element_size_ = size1_ * size1_;
201  if (size1_ > 0) {
202  mat_ = new cplx[(ntau_ + 1) * element_size_];
203  } else {
204  mat_ = 0;
205  }
206  if (size1_ > 0 && nt_ >= 0) {
207  les_ = new cplx[((nt_ + 1) * (nt_ + 2)) / 2 * element_size_];
208  ret_ = new cplx[((nt_ + 1) * (nt_ + 2)) / 2 * element_size_];
209  tv_ = new cplx[(nt_ + 1) * (ntau_ + 1) * element_size_];
210  } else {
211  les_ = 0;
212  ret_ = 0;
213  tv_ = 0;
214  }
215  }
216  if (size1_ > 0) {
217  memcpy(mat_, g.mat_, sizeof(cplx) * (ntau_ + 1) * element_size_);
218  if (nt_ >= 0) {
219  memcpy(les_, g.les_, sizeof(cplx) * ((nt_ + 1) * (nt_ + 2)) / 2 *
220  element_size_);
221  memcpy(ret_, g.ret_, sizeof(cplx) * ((nt_ + 1) * (nt_ + 2)) / 2 *
222  element_size_);
223  memcpy(tv_, g.tv_,
224  sizeof(cplx) * (nt_ + 1) * (ntau_ + 1) * element_size_);
225  }
226  }
227  return *this;
228 }
std::complex< T > cplx