Beispiel #1
0
 def apply_unary_operator(self, opcode, o, i):
     assert len(i.v_obj) == len(o.v_obj)
     assert len(i.v_obj) == (len(self.obj)) ** 0.5
     tmp = gpt.lattice(o)
     o[:] = 0.0
     for m in range(len(i.v_obj)):
         tmp[:] = 0.0
         for n in range(len(i.v_obj)):
             cgpt.apply_fermion_operator(
                 self.obj[n * len(i.v_obj) + m], opcode, i.v_obj[n], tmp.v_obj[m]
             )
             o += tmp
Beispiel #2
0
 def apply_unary_operator(self, opcode, o, i):
     assert len(i.v_obj) == len(o.v_obj)
     assert len(i.v_obj) == (len(self.obj))**0.5
     if len(i.v_obj) == 1:
         cgpt.apply_fermion_operator(self.obj[0], opcode, i.v_obj[0],
                                     o.v_obj[0])
     else:
         tmp = self.tmp if o.checkerboard() is gpt.none else self.tmp_eo
         for n in range(len(i.v_obj)):
             for m in range(len(i.v_obj)):
                 cgpt.apply_fermion_operator(
                     self.obj[n * len(i.v_obj) + m],
                     opcode,
                     i.v_obj[n],
                     o.v_obj[m] if n == 0 else tmp.v_obj[m],
                 )
             if n != 0:
                 o += tmp
Beispiel #3
0
 def apply_unary_operator(self, opcode, o, i):
     assert len(i.v_obj) == 1
     assert len(o.v_obj) == 1
     # Grid has different calling conventions which we adopt in cgpt:
     return cgpt.apply_fermion_operator(self.obj, opcode, i.v_obj[0],
                                        o.v_obj[0])
Beispiel #4
0
 def unary(self, opcode, i, o):
     assert (len(i.v_obj) == 1)
     assert (len(o.v_obj) == 1)
     return cgpt.apply_fermion_operator(self.obj, opcode, i.v_obj[0],
                                        o.v_obj[0])