question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cirq.X**"text" half works

See original GitHub issue

To my surprise, if you write cirq.X**"text" instead of cirq.X**sympy.Symbol("text"), thing mostly work. For example, you can run a sweep over the circuit with a dictionary mapping "text" to a value and you’ll get samples back. This is because cirq.resolve_parameters treats strings as a shorthand for sympy.Symbol, as a way of removing boilerplate when specifying sweeps.

However, cirq.is_parameterized often does not recognize gates with string parameters as being parameterized. For example it fails on the case I gave above.

I think treating strings as implicitly being symbols is a reasonable idea, and I propose we codify this. Fixing it would involve finding all places with isinstance sympy.Basic checks and replacing them with is_parameterized calls, and then is_parameterized would also handle the string case.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MrSaralcommented, Sep 1, 2020

Hey @balopat , yes I am working on this! Are you on the discord channel?

0reactions
verultcommented, Mar 28, 2022

This is a feature addition and doesn’t require changes to the existing API (exponentiating with symbols), so marking as after-1.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xtext - Language Engineering Made Easy! - Eclipse
Xtext is a framework for development of programming languages and domain-specific languages. With Xtext you define your language using a powerful grammar ...
Read more >
Untitled
Bolgarska vladarska rodbina, Cara memasak rica2 mentok, Solavei phone setup, Mercimek tarifi oktay usta, Lws.exe has stopped working, Bromination of ...
Read more >
Untitled
Half -wave loss, #Sparkasse genthin immobilien, Samurai works, Tuyihimbaze. ... No flaws urban dictionary, Xtext dsl beispiele, Celiny trzebieskie, ...
Read more >
Xtext cross-references work only with an Xtext Java Project?
To get the cross references work you need. A project with xtext nature + builder (that is what convert to xtext project does,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found