Пример #1
0
    def __init__(self, left_site, right_site=None, left_block=None, right_block=None):
        """Creates the system with the specified sites.

	Exactly that. If you don't provide all the arguments, the missing
	blocks or sites are created from the `left_site` single site
	argument.

	Parameters
	----------
	left_site : a Site object.
	    The site you want to use as a single site at the left.
	right_site : a Site object (optional).
	    The site you want to use as a single site at the right.
	left_block : a Block object (optional).
	    The block you want to use as a single block at the left.
	right_block : a Block object (optional).
	    The block you want to use as a single block at the right.
	"""
    	super(System, self).__init__()
	self.left_site = left_site

	if right_site is not None:
	    self.right_site = right_site
	else:
	    self.right_site = left_site

	if left_block is not None:
	    self.left_block = left_block
	else:
	    self.left_block = make_block_from_site(left_site)

	if right_block is not None:
	    self.right_block = right_block
	else:
	    self.right_block = make_block_from_site(left_site)

	self.h = CompositeOperator(self.get_left_dim(), self.get_right_dim())
	self.operators_to_add_to_block = {}
	self.old_left_blocks = []
	self.old_right_blocks = []
	# 
	# start growing on the left, which may look as random as start
	# growing on the right, but however the latter will ruin the
	# *whole* thing.
	#
	self.set_growing_side('left')
	self.number_of_sites = None
	self.model = None
Пример #2
0
    def turn_around(self, new_growing_side):
	"""Turns around in the finite algorithm.

	When you reach the smallest possible size for your shriking block,
	you must turn around and start sweeping in the other direction.
	This is just done by setting the to be growing side, which
	currently is skrinking, to be made up of a single site, and by
	setting the to be shrinking side, which now is growing to be the
	current growing block.

	Parameters
	----------
	new_growing_side : a string.
	    The side that will start growing.
	"""
	if new_growing_side == 'left':
	    self.left_block = make_block_from_site(self.left_site)
	    self.old_left_blocks = []
	else:
	    self.right_block = make_block_from_site(self.right_site)
	    self.old_right_blocks = []