Пример #1
0
    def calc_x(self,
               n,
               Vsh,
               sqrt_l,
               sqrt_r,
               sqrt_l_inv,
               sqrt_r_inv,
               right=True):
        """Calculate the parameter matrix x* giving the desired B.

        This is equivalent to eqn. (49) of arXiv:1103.0936v2 [cond-mat.str-el] except
        that, here, norm-preservation is not enforced, such that the optimal
        parameter matrices x*_n (for the parametrization of B) are given by the
        derivative w.r.t. x_n of <Phi[B, A]|Ĥ|Psi[A]>, rather than
        <Phi[B, A]|Ĥ - H|Psi[A]> (with H = <Psi|Ĥ|Psi>).

        Direct dependencies:
            - A[n - 1], A[n], A[n + 1]
            - r[n], r[n + 1], l[n - 2], l[n - 1]
            - C[n], C[n - 1]
            - K[n + 1]
            - V[n]
        """
        if n > 0:
            lm2 = self.get_l(n - 2)
        else:
            lm2 = None

        if n < self.N + 1:
            C = self.C[n]
        else:
            C = None

        if right:
            x = tm.calc_x(self.K[n + 1], C, self.C[n - 1], self.r[n + 1], lm2,
                          self.get_A(n - 1), self.A[n], self.get_A(n + 1),
                          sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
        else:
            x = tm.calc_x_l(self.K_l[n - 1], C, self.C[n - 1],
                            self.r[n + 1], lm2, self.get_A(n - 1), self.A[n],
                            self.get_A(n + 1), sqrt_l, sqrt_l_inv, sqrt_r,
                            sqrt_r_inv, Vsh)

        return x
Пример #2
0
    def calc_x(self, n, Vsh, sqrt_l, sqrt_r, sqrt_l_inv, sqrt_r_inv, right=True):
        """Calculate the parameter matrix x* giving the desired B.

        This is equivalent to eqn. (49) of arXiv:1103.0936v2 [cond-mat.str-el] except
        that, here, norm-preservation is not enforced, such that the optimal
        parameter matrices x*_n (for the parametrization of B) are given by the
        derivative w.r.t. x_n of <Phi[B, A]|Ĥ|Psi[A]>, rather than
        <Phi[B, A]|Ĥ - H|Psi[A]> (with H = <Psi|Ĥ|Psi>).

        Direct dependencies:
            - A[n - 1], A[n], A[n + 1]
            - r[n], r[n + 1], l[n - 2], l[n - 1]
            - C[n], C[n - 1]
            - K[n + 1]
            - V[n]
        """
        if n > 0:
            lm2 = self.get_l(n - 2)
        else:
            lm2 = None
            
        if n < self.N + 1:
            C = self.C[n]
        else:
            C = None
        
        if right:
            x = tm.calc_x(self.K[n + 1], C, self.C[n - 1], self.r[n + 1],
                          lm2, self.A[n - 1], self.A[n], self.A[n + 1],
                          sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
        else:
            x = tm.calc_x_l(self.K_l[n - 1], C, self.C[n - 1], self.r[n + 1],
                          lm2, self.A[n - 1], self.A[n], self.A[n + 1],
                          sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)

        return x
Пример #3
0
 def calc_x(self, n, Vsh, sqrt_l, sqrt_r, sqrt_l_inv, sqrt_r_inv):
     """Calculates the matrix x* that results in the TDVP tangent vector B.
     
     This is equivalent to eqn. (49) of arXiv:1103.0936v2 [cond-mat.str-el] except 
     that, here, norm-preservation is not enforced, such that the optimal 
     parameter matrices x*_n (for the parametrization of B) are given by the 
     derivative w.r.t. x_n of <Phi[B, A]|Ĥ|Psi[A]>, rather than 
     <Phi[B, A]|Ĥ - H|Psi[A]> (with H = <Psi|Ĥ|Psi>).
     
     An additional sum was added for the single-site hamiltonian.
     
     Some multiplications have been pulled outside of the sums for efficiency.
     
     Direct dependencies: 
         - A[n - 1], A[n], A[n + 1]
         - r[n], r[n + 1], l[n - 2], l[n - 1]
         - C[n], C[n - 1]
         - K[n + 1]
         - V[n]
     """
     if n > 1:
         lm2 = self.l[n - 2]
         Cm1 = self.C[n - 1]
         Am1 = self.A[n - 1]
     else:
         lm2 = None
         Cm1 = None
         Am1 = None
         
     if n > 2:
         lm3 = self.l[n - 3]
         Cm2 = self.C[n - 2]
         Am2Am1 = self.AA[n - 2]
     else:
         lm3 = None
         Cm2 = None
         Am2Am1 = None
         
     if n <= self.N - self.ham_sites + 1:
         C = self.C[n]            
     else:
         C = None
         
     if n + 1 <= self.N - self.ham_sites + 1:
         Kp1 = self.K[n + 1]            
     else:
         Kp1 = None
         
     if n < self.N - 1:
         Ap1Ap2 = self.AA[n + 1]
         rp2 = self.r[n + 2]
     else:
         Ap1Ap2 = None
         rp2 = None
         
     if n < self.N:
         rp1 = self.r[n + 1]
         Ap1 = self.A[n + 1]
     else:
         rp1 = None
         Ap1 = None
     
     if self.ham_sites == 2:
         x = tm.calc_x(Kp1, C, Cm1, rp1,
                       lm2, Am1, self.A[n], Ap1,
                       sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
     else:
         x = tm.calc_x_3s(Kp1, C, Cm1, Cm2, rp1, rp2, lm2, 
                          lm3, Am2Am1, Am1, self.A[n], Ap1, Ap1Ap2,
                          sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
             
     return x
Пример #4
0
 def calc_x(self, n, Vsh, sqrt_l, sqrt_r, sqrt_l_inv, sqrt_r_inv):
     """Calculates the matrix x* that results in the TDVP tangent vector B.
     
     This is equivalent to eqn. (49) of arXiv:1103.0936v2 [cond-mat.str-el] except 
     that, here, norm-preservation is not enforced, such that the optimal 
     parameter matrices x*_n (for the parametrization of B) are given by the 
     derivative w.r.t. x_n of <Phi[B, A]|Ĥ|Psi[A]>, rather than 
     <Phi[B, A]|Ĥ - H|Psi[A]> (with H = <Psi|Ĥ|Psi>).
     
     An additional sum was added for the single-site hamiltonian.
     
     Some multiplications have been pulled outside of the sums for efficiency.
     
     Direct dependencies: 
         - A[n - 1], A[n], A[n + 1]
         - r[n], r[n + 1], l[n - 2], l[n - 1]
         - C[n], C[n - 1]
         - K[n + 1]
         - V[n]
     """
     if n > 1:
         lm2 = self.l[n - 2]
         Cm1 = self.C[n - 1]
         Am1 = self.A[n - 1]
     else:
         lm2 = None
         Cm1 = None
         Am1 = None
         
     if n > 2:
         lm3 = self.l[n - 3]
         Cm2 = self.C[n - 2]
         Am2 = self.A[n - 2]
     else:
         lm3 = None
         Cm2 = None
         Am2 = None
         
     if n <= self.N - self.ham_sites + 1:
         C = self.C[n]            
     else:
         C = None
         
     if n + 1 <= self.N - self.ham_sites + 1:
         Kp1 = self.K[n + 1]            
     else:
         Kp1 = None
         
     if n < self.N - 1:
         Ap2 = self.A[n + 2]
         rp2 = self.r[n + 2]
     else:
         Ap2 = None
         rp2 = None
         
     if n < self.N:
         rp1 = self.r[n + 1]
         Ap1 = self.A[n + 1]
     else:
         rp1 = None
         Ap1 = None
     
     if self.ham_sites == 2:
         x = tm.calc_x(Kp1, C, Cm1, rp1,
                       lm2, Am1, self.A[n], Ap1,
                       sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
     else:
         x = tm.calc_x_3s(Kp1, C, Cm1, Cm2, rp1, rp2, lm2, 
                          lm3, Am2, Am1, self.A[n], Ap1, Ap2,
                          sqrt_l, sqrt_l_inv, sqrt_r, sqrt_r_inv, Vsh)
             
     return x