ALPS MPS Codes
Reference documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Macros | Functions
super_models_none.hpp File Reference
#include <sstream>
#include "dmrg/models/model.h"
#include "dmrg/utils/BaseParameters.h"

Go to the source code of this file.

Classes

class  SuperBoseHubbardNone< Matrix >
 

Macros

#define REGISTER(op, kind)   op ## _tag = tag_handler->register_op(op, kind);
 

Functions

template<class Matrix >
Matrix adjoint_hamiltonian (const Matrix &h)
 
template<class Matrix >
Matrix super_lindblad (const Matrix &l)
 
template<class Matrix >
Matrix super_left (const Matrix &l)
 
template<class Matrix >
Matrix super_right (const Matrix &l)
 
template<class T , class A >
fuse (const A &ind, T d)
 
template<class T , class A >
void unfuse (T fused, T d, A &ind)
 
template<class Matrix >
Matrix reshape_bond2site (const Matrix &a)
 
template<class Op , class Matrix >
std::vector< std::pair< Op, Op > > decompose_bond_super (const Matrix &bondop, const Index< TrivialGroup > &phys)
 

Macro Definition Documentation

#define REGISTER (   op,
  kind 
)    op ## _tag = tag_handler->register_op(op, kind);

Function Documentation

template<class Matrix >
Matrix adjoint_hamiltonian ( const Matrix &  h)

Take a Hamilton operator H and construct its adjoint Hamiltonian superoperator, corresponding to the map ad H: rho -> [H,rho]

Definition at line 72 of file super_models_none.hpp.

73 {
74  const size_t N = num_rows(h);
75  const size_t N2 = N*N;
76  assert( num_cols(h) == N );
77 
78  Matrix adH(N2,N2);
79  for( size_t i = 0; i < N; ++i )
80  {
81  for( size_t j = 0; j < N; ++j )
82  {
83  const size_t n = i + j*N;
84  Matrix phi (N,N); phi(i,j) = 1.; // n'th operator basis state phi
85  Matrix hphi(N,N); gemm(h,phi,hphi); // H.phi
86  Matrix phih(N,N); gemm(phi,h,phih); // phi.H
87  Matrix comm = hphi - phih; // [H,phi]
88 
89  // operator state adH.phi -> n'th column of adH
90  for( size_t ii = 0; ii < N; ++ii )
91  for( size_t jj = 0; jj < N; ++jj )
92  adH(ii+jj*N, n) = comm(ii,jj);
93  }
94  }
95 
96  return adH;
97 }
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:99
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:102
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
template<class Op , class Matrix >
std::vector< std::pair<Op,Op> > decompose_bond_super ( const Matrix &  bondop,
const Index< TrivialGroup > &  phys 
)

Definition at line 254 of file super_models_none.hpp.

255 {
256  Matrix rbond = reshape_bond2site(bondop);
257 
258  Matrix U, V;
259  typename alps::numeric::associated_real_diagonal_matrix<Matrix>::type S, Ssqrt;
260  svd(rbond, U, V, S);
261  Ssqrt = sqrt(S);
262 
264  Op left, right;
265  {
266  Matrix tmp;
267  gemm(U, Ssqrt, tmp);
268  left.insert_block(tmp, C, C);
269  }
270  {
271  Matrix tmp;
272  gemm(Ssqrt, V, tmp);
273  right.insert_block(tmp, C, C);
274  }
275 
276  std::vector<Op> leftops = reshape_right_to_list(phys, left);
277  std::vector<Op> rightops = reshape_left_to_list (phys, right);
278  assert(leftops.size() == rightops.size());
279 
280  // discard terms with no weight
281  std::vector< std::pair<Op,Op> > terms;
282  for( unsigned i = 0; i < num_rows(S) && std::abs(S(i,i)) > 1e-10; ++i )
283  {
284  leftops[i].transpose_inplace();
285  rightops[i].transpose_inplace();
286  terms.push_back(std::pair<Op,Op>( leftops[i], rightops[i] ));
287  }
288  return terms;
289 }
std::vector< block_matrix< Matrix, SymmGroup > > reshape_right_to_list(Index< SymmGroup > const &phys, block_matrix< Matrix, SymmGroup > const &A)
Definition: reshapes.h:498
block_matrix< Matrix, SymmGroup > sqrt(block_matrix< Matrix, SymmGroup > m)
std::vector< block_matrix< Matrix, SymmGroup > > reshape_left_to_list(Index< SymmGroup > const &phys, block_matrix< Matrix, SymmGroup > const &A)
Definition: reshapes.h:562
void svd(block_matrix< Matrix, SymmGroup > const &M, block_matrix< Matrix, SymmGroup > &U, block_matrix< Matrix, SymmGroup > &V, block_matrix< DiagMatrix, SymmGroup > &S)
Matrix reshape_bond2site(const Matrix &a)
static const charge IdentityCharge
Definition: none.h:44
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
template<class T , class A >
T fuse ( const A &  ind,
d 
)

Fuse indices n[i] into one p = n[i] d^i.

Definition at line 200 of file super_models_none.hpp.

201 {
202  T fused = 0;
203  T stride = 1;
204  for( T i = 0; i < ind.size(); ++i )
205  {
206  fused += ind[i] * stride;
207  stride *= d;
208  }
209  return fused;
210 }
template<class Matrix >
Matrix reshape_bond2site ( const Matrix &  a)

Definition at line 228 of file super_models_none.hpp.

229 {
230  typedef typename Matrix::size_type size_type;
231  size_type d4 = num_rows(a);
232  size_type d = sqrt(sqrt(double(d4)));
233  assert( d4 == num_cols(a) );
234  assert( d4 == d*d*d*d );
235 
236  Matrix b(d4,d4);
237  boost::array<size_type,4> ii, jj, kk, ll;
238  for( size_type i = 0; i < d4; ++i )
239  {
240  unfuse(i,d,ii);
241  for( size_type j = 0; j < d4; ++j )
242  {
243  unfuse(j,d,jj);
244  kk[0] = ii[0]; kk[1] = ii[2]; kk[2] = jj[0]; kk[3] = jj[2];
245  ll[0] = ii[1]; ll[1] = ii[3]; ll[2] = jj[1]; ll[3] = jj[3];
246  b(fuse(kk,d),fuse(ll,d)) = a(i,j);
247  }
248  }
249  return b;
250 }
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:99
block_matrix< Matrix, SymmGroup > sqrt(block_matrix< Matrix, SymmGroup > m)
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:102
void unfuse(T fused, T d, A &ind)
T fuse(const A &ind, T d)
Fuse indices n[i] into one p = n[i] d^i.
template<class Matrix >
Matrix super_left ( const Matrix &  l)

Take a Lindblad operator L and construct the map corresponding to left multiplication with L rho -> L rho

Definition at line 141 of file super_models_none.hpp.

142 {
143  const size_t N = num_rows(l);
144  const size_t N2 = N*N;
145  assert( num_cols(l) == N );
146 
147  Matrix superL(N2,N2);
148 
149  for( size_t i = 0; i < N; ++i )
150  {
151  for( size_t j = 0; j < N; ++j )
152  {
153  const size_t n = i + j*N;
154  Matrix phi(N,N); phi(i,j) = 1.; // n'th operator basis state phi
155 
156  // phi -> L.phi
157  Matrix lphi(N,N); gemm(l,phi,lphi);
158  for( size_t ii = 0; ii < N; ++ii )
159  for( size_t jj = 0; jj < N; ++jj )
160  superL(ii+jj*N, n) = lphi(ii,jj);
161  }
162  }
163 
164  return superL;
165 }
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:99
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:102
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
template<class Matrix >
Matrix super_lindblad ( const Matrix &  l)

Take a Lindblad operator L and construct its contribution to the Liouville superoperator, i.e. the map lind L: rho -> 2 L rho L^ - L^ L rho - rho L^ L

Definition at line 103 of file super_models_none.hpp.

104 {
105  const size_t N = num_rows(l);
106  const size_t N2 = N*N;
107  assert( num_cols(l) == N );
108 
109  Matrix ldag = transpose(conj(l)); // L^\dag
110  Matrix ldagl(N,N); gemm(ldag,l,ldagl); // L^\dag L
111  Matrix lindL(N2,N2);
112 
113  for( size_t i = 0; i < N; ++i )
114  {
115  for( size_t j = 0; j < N; ++j )
116  {
117  const size_t n = i + j*N;
118  Matrix phi (N,N); phi(i,j) = 1.; // n'th operator basis state phi
119 
120  // phi -> lindL.phi = 2*l.phi.ldag - ldag.l.phi - phi.ldag.l
121  Matrix lphi (N,N); gemm(l,phi,lphi);
122  Matrix lphildag(N,N); gemm(lphi,ldag,lphildag);
123  Matrix ldaglphi(N,N); gemm(ldag,lphi,ldaglphi);
124  Matrix phildagl(N,N); gemm(phi,ldagl,phildagl);
125  Matrix ll = 2*lphildag - ldaglphi - phildagl;
126 
127  // operator state lindL.phi -> n'th column of lindL
128  for( size_t ii = 0; ii < N; ++ii )
129  for( size_t jj = 0; jj < N; ++jj )
130  lindL(ii+jj*N, n) = ll(ii,jj);
131  }
132  }
133 
134  return lindL;
135 }
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:99
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:102
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
block_matrix< typename maquis::traits::transpose_view< Matrix >::type, SymmGroup > transpose(block_matrix< Matrix, SymmGroup > const &m)
template<class Matrix >
Matrix super_right ( const Matrix &  l)

Take a Lindblad operator L and construct the map corresponding to right multiplication with L rho -> rho L

Definition at line 171 of file super_models_none.hpp.

172 {
173  const size_t N = num_rows(l);
174  const size_t N2 = N*N;
175  assert( num_cols(l) == N );
176 
177  Matrix superL(N2,N2);
178 
179  for( size_t i = 0; i < N; ++i )
180  {
181  for( size_t j = 0; j < N; ++j )
182  {
183  const size_t n = i + j*N;
184  Matrix phi (N,N); phi(i,j) = 1.; // n'th operator basis state phi
185 
186  // phi -> phi.L
187  Matrix phil(N,N); gemm(phi,l,phil);
188  for( size_t ii = 0; ii < N; ++ii )
189  for( size_t jj = 0; jj < N; ++jj )
190  superL(ii+jj*N, n) = phil(ii,jj);
191  }
192  }
193 
194  return superL;
195 }
std::size_t num_rows(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:99
std::size_t num_cols(maquis::dmrg::one_matrix< T > const &m)
Definition: one_matrix.hpp:102
void gemm(block_matrix< Matrix1, SymmGroup > const &A, block_matrix< Matrix2, SymmGroup > const &B, block_matrix< Matrix3, SymmGroup > &C)
template<class T , class A >
void unfuse ( fused,
d,
A &  ind 
)

Definition at line 214 of file super_models_none.hpp.

215 {
216  for( T i = 0; i < ind.size(); ++i )
217  {
218  ind[i] = fused % d;
219  fused /= d;
220  }
221  assert( fused == 0 );
222 }