Skip to content

Commit

Permalink
Change diagrams to use ascii math (#993)
Browse files Browse the repository at this point in the history
Fixes: #263
  • Loading branch information
dstrain115 authored May 28, 2024
1 parent 75bbaba commit a12c685
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions qualtran/bloqs/arithmetic/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ def wire_symbol(self, reg: Optional[Register], idx: Tuple[int, ...] = tuple()) -
if reg is None:
return Text('')
if reg.name == 'mu':
return TextBox(r'$\mu$')
return TextBox(')
elif reg.name == 'nu':
return TextBox(r'$\mu$')
return TextBox(r'ν')
else:
text = r'$\oplus\nu(\nu-1)/2+\mu$'
text = r'⊕ν(ν-1)/2+μ'
return TextBox(text)

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
Expand Down
2 changes: 1 addition & 1 deletion qualtran/bloqs/chemistry/df/double_factorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return '$B[H_1]$'
return 'B[H_1]'

def build_composite_bloq(
self,
Expand Down
12 changes: 6 additions & 6 deletions qualtran/bloqs/chemistry/pbc/first_quantization/prepare_nu.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'PREP $\sqrt{2^\mu}|\mu\rangle$'
return r'PREP √(2^μ)|μ⟩'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
return {(Toffoli(), (self.num_bits_p - 1))}
Expand Down Expand Up @@ -104,7 +104,7 @@ def adjoint(self) -> 'Bloq':
return evolve(self, is_adjoint=not self.is_adjoint)

def pretty_name(self) -> str:
return r'PREP $2^{-\mu}|\mu\rangle|\nu\rangle$'
return r'PREP (2^-μ)|μ⟩|ν⟩'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
# controlled hadamards which cannot be inverted at zero Toffoli cost.
Expand Down Expand Up @@ -141,7 +141,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'$\nu\ne -0$'
return r'ν≠−0'

def adjoint(self) -> 'Bloq':
return evolve(self, is_adjoint=not self.is_adjoint)
Expand Down Expand Up @@ -190,7 +190,7 @@ def adjoint(self) -> 'Bloq':
return evolve(self, is_adjoint=not self.is_adjoint)

def pretty_name(self) -> str:
return r'$\nu < 2^{\mu-2}$'
return r'ν<2^(μ−2)'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
if self.is_adjoint:
Expand Down Expand Up @@ -258,7 +258,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'$(2^{\mu-2})^2\mathcal{M} > m \nu^2 $'
return r'(2^(μ-2))^2 M > m ν^2'

def adjoint(self) -> 'Bloq':
return evolve(self, is_adjoint=not self.is_adjoint)
Expand Down Expand Up @@ -340,7 +340,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r"PREP $\frac{1}{\lVert \nu \rVert} |\nu\rangle $"
return r"PREP 1/‖ν‖ ∣ν⟩"

def build_composite_bloq(
self, bb: BloqBuilder, mu: SoquetT, nu: SoquetT, m: SoquetT, flag_nu: SoquetT
Expand Down
4 changes: 2 additions & 2 deletions qualtran/bloqs/chemistry/pbc/first_quantization/prepare_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def signature(self) -> Signature:
return Signature.build(r=self.bitsize)

def pretty_name(self) -> str:
return r'PREP $2^{r/2} |r\rangle$'
return r'PREP 2^(r/2) |r'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
return {(Toffoli(), (self.bitsize - 2))}
Expand Down Expand Up @@ -102,7 +102,7 @@ def signature(self) -> Signature:
return Signature.build(w=2, r=self.num_bits_p, s=self.num_bits_p)

def pretty_name(self) -> str:
return r'PREP $T$'
return r'PREP T'

def build_composite_bloq(
self, bb: BloqBuilder, w: SoquetT, r: SoquetT, s: SoquetT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'PREP $UV$'
return r'PREP UV'

def build_composite_bloq(
self, bb: BloqBuilder, mu: SoquetT, nu: SoquetT, m: SoquetT, l: SoquetT, flag_nu: SoquetT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'PREP $UV$'
return r'PREP UV'

def build_composite_bloq(
self, bb: BloqBuilder, mu: SoquetT, nu: SoquetT, m: SoquetT, l: SoquetT, flag_nu: SoquetT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'SEL $T$'
return r'SEL T'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
# Modification of the SEL T costs from the first quantized bloq with n_p replace with n_n.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'SEL $T$'
return r'SEL T'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
# Cost is $5(n_{p} - 1) + 2$ which comes from copying each $w$ component of $p$
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def signature(self) -> Signature:
)

def pretty_name(self) -> str:
return r'$-e^{-k_\nu\cdot R_l$'
return r'-e^(-k_ν⋅R_l)'

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> Set['BloqCountT']:
n_p = self.num_bits_p
Expand Down

0 comments on commit a12c685

Please sign in to comment.