Expand SWEEP_LIKE to work for {'t': [0, 1, 3]}
See original GitHub issueCurrently if you make a call like sampler.sample(circuit, params={'t': range(5)})
it doesn’t work, because it expects e.g. a list of dictionaries instead of a dictionary containing lists. For convenience we should just support both cases. Check if the input is a dictionary with list values (and possibly singletons too), and if so take the cartesian product of the various entries and turn it into a sweep.
Test cases:
assert cirq.to_sweeps({'t': [0, 2, 3]}) == (
cirq.to_sweeps([{'t': 0}, {'t': 2}, {'t': 3}]}))
assert cirq.to_sweeps({'t': [0, 1], 's': [2, 3], 'r': 4}) == (
cirq.to_sweeps([
{'t': 0, 's': 2, 'r': 4},
{'t': 0, 's': 3, 'r': 4},
{'t': 1, 's': 2, 'r': 4},
{'t': 1, 's': 3, 'r': 4},
]))
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Sweep-like operations with dplyr/tidyverse - Stack Overflow
I don't think it is important to know given the context, but my data has 77 rows and 1133 columns. Four of the...
Read more >When You Use The Wrong EV Spread on Pokemon ...
When You Use The Wrong EV Spread on Pokemon Showdown...Pokemon Showdown has never seen a sweep like this before :)xImRaptor vs TJ in...
Read more >Distinguishing Between Selective Sweeps and Demography ...
In 2002 Kim and Stephan proposed a promising composite-likelihood method for localizing and estimating the fitness advantage of a recently fixed beneficial ...
Read more >Decay of Solar Wind Turbulence behind Interplanetary Shocks
Solutions of these equations lead to power laws, $E\approx {(t-{t}_{0}) ... and the sweep-like dynamics associated with wave propagation is spread out (Zhou ......
Read more >Amplification of integrated microscopic motions of high-density ...
The pioneering work of rotaxane-based molecular muscle was reported ... On the one hand, the aromatic protons H1 and H3 of B21C7 wheel...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Note that
Sampler.sample
actually does useto_sweeps
, so it does work with this feature. So as it stands, this feature is inconsistently implemented.I think we decided not to do this so that you can resolve list-valued parameters (we have use cases for this internally). Also, there’s an ambiguity if you have multiple parameters; given
{'a': [1, 2], 'b': [3, 4]}
should that do a cartesian product sweep overa
andb
or a zip sweep? Instead you need to make the sweep explicit at the top level, either as[{'t': 0.3}, {'t': 0.5}]
or using actual sweep objects:cirq.Points('t', [0.3, 0.5])
.