本文整理汇总了Python中sympy.printing.pretty.stringpict.prettyForm函数的典型用法代码示例。如果您正苦于以下问题:Python prettyForm函数的具体用法?Python prettyForm怎么用?Python prettyForm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prettyForm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _print_contents_pretty
def _print_contents_pretty(self, printer, *args):
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = prettyForm(
*label_pform.parens(left='(', right=')')
)
pform = prettyForm(*pform.right((label_pform)))
return pform
示例2: _pretty
def _pretty(self, printer, *args):
from sympy.printing.pretty.stringpict import prettyForm
pform = printer._print(self.args[0], *args)
if printer._use_unicode:
pform = pform**prettyForm(u'\N{DAGGER}')
else:
pform = pform**prettyForm('+')
return pform
示例3: _pretty
def _pretty(self, printer, *args):
pform_exp = printer._print(self.exp, *args)
if printer._use_unicode:
pform_exp = prettyForm(*pform_exp.left(prettyForm(u'\u2a02')))
else:
pform_exp = prettyForm(*pform_exp.left(prettyForm('x')))
pform_base = printer._print(self.base, *args)
return pform_base**pform_exp
示例4: _print_contents_pretty
def _print_contents_pretty(self, printer, *args):
pform = self._print_label_pretty(printer, *args)
pform = prettyForm(*pform.left((self.lbracket_pretty)))
pform = prettyForm(*pform.right((';')))
nextpform = self._print_time_pretty(printer, *args)
pform = prettyForm(*pform.right((nextpform)))
pform = prettyForm(*pform.right((self.rbracket_pretty)))
return pform
示例5: _pretty
def _pretty(self, printer, *args):
pform = printer._print(self.args[0], *args)
pform = prettyForm(*pform.right((prettyForm(','))))
pform = prettyForm(*pform.right((printer._print(self.args[1], *args))))
a = stringPict(u'\u03b4')
b = pform
top = stringPict(*b.left(' '*a.width()))
bot = stringPict(*a.right(' '*b.width()))
return prettyForm(binding=prettyForm.POW, *bot.below(top))
示例6: _pretty
def _pretty(self, printer, *args):
from sympy.printing.pretty.stringpict import prettyForm
# Get brackets
pform = self._print_contents_pretty(printer, *args)
lbracket, rbracket = self._pretty_brackets(pform.height(), printer._use_unicode)
# Put together state
pform = prettyForm(*pform.left(lbracket))
pform = prettyForm(*pform.right(rbracket))
return pform
示例7: _print_contents_pretty
def _print_contents_pretty(self, printer, *args):
if len(self.label) == 1:
return self._print_label_pretty(printer, *args)
else:
pform = self._print_operator_name_pretty(printer, *args)
label_pform = self._print_label_pretty(printer, *args)
label_pform = prettyForm(*label_pform.parens(left="(", right=")"))
pform = prettyForm(*pform.right((label_pform)))
return pform
示例8: _pretty
def _pretty(self, printer, *args):
from sympy.printing.pretty.stringpict import prettyForm
pform = printer._print(self.args[0], *args)
if printer._use_unicode:
pform = pform ** prettyForm(u("\u2020"))
else:
pform = pform ** prettyForm("+")
return pform
示例9: _print_Poly
def _print_Poly(self, poly):
expr = poly.as_expr()
gens = list(poly.gens)
domain = poly.get_domain()
pform_head = prettyForm('Poly')
pform_tail = self._print_seq([expr] + gens + [domain], '(', ')')
pform = prettyForm(*pform_head.right(pform_tail))
return pform
示例10: _pretty
def _pretty(self, printer, *args):
length = len(self.args)
pform = printer._print("", *args)
for i in range(length):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (Add, Mul)):
next_pform = prettyForm(*next_pform.parens(left="(", right=")"))
pform = prettyForm(*pform.right(next_pform))
if i != length - 1:
pform = prettyForm(*pform.right(u"\u2a02" + u" "))
return pform
示例11: _pretty
def _pretty(self, printer, *args):
length = len(self.args)
pform = printer._print('', *args)
for i in range(length):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (Add, Mul)):
next_pform = prettyForm(
*next_pform.parens(left='(', right=')')
)
pform = prettyForm(*pform.right(next_pform))
if i != length-1:
pform = prettyForm(*pform.right(u'\u2a02' + u' '))
return pform
示例12: _pretty
def _pretty(self, printer, *args):
length = len(self.args)
pform = printer._print('', *args)
for i in range(length):
next_pform = printer._print(self.args[i], *args)
if isinstance(self.args[i], (DirectSumHilbertSpace,
TensorProductHilbertSpace)):
next_pform = prettyForm(
*next_pform.parens(left='(', right=')')
)
pform = prettyForm(*pform.right(next_pform))
if i != length-1:
pform = prettyForm(*pform.right(u' ' + u'\u2295' + u' '))
return pform
示例13: _pretty
def _pretty(self, printer, *args):
# Print state contents
bra = self.bra._print_contents_pretty(printer, *args)
ket = self.ket._print_contents_pretty(printer, *args)
# Print brackets
height = max(bra.height(), ket.height())
use_unicode = printer._use_unicode
lbracket, _ = self.bra._pretty_brackets(height, use_unicode)
cbracket, rbracket = self.ket._pretty_brackets(height, use_unicode)
# Build innerproduct
pform = prettyForm(*bra.left(lbracket))
pform = prettyForm(*pform.right(cbracket))
pform = prettyForm(*pform.right(ket))
pform = prettyForm(*pform.right(rbracket))
return pform
示例14: _print_contents_pretty
def _print_contents_pretty(self, printer, *args):
from sympy.printing.pretty.stringpict import prettyForm
pform = printer._print(self.args[0], *args)
if self.is_annihilation:
return pform
else:
return pform**prettyForm(u('\u2020'))
示例15: _pretty
def _pretty(self, printer, *args):
controls = self._print_sequence_pretty(self.controls, ',', printer, *args)
gate = printer._print(self.gate)
gate_name = stringPict(unicode(self.gate_name))
first = self._print_subscript_pretty(gate_name, controls)
gate = self._print_parens_pretty(gate)
final = prettyForm(*first.right((gate)))
return final