# cirq.sample_state_vector¶

cirq.sample_state_vector(state: numpy.ndarray, indices: List[int], repetitions: int = 1) → List[List[bool]][source]

Samples repeatedly from measurements in the computational basis.

Note that this does not modify the passed in state.

Parameters: state – The multi-qubit wavefunction to be sampled. This is an array of 2 to the power of the number of qubit complex numbers, and so state must be of size 2**integer. The state can be a vector of size 2**integer or a tensor of shape (2, 2, ..., 2). indices – Which qubits are measured. The state is assumed to be supplied in big endian order. That is the xth index of v, when expressed as a bitstring, has the largest values that the 0th index. repetitions – The number of times to sample the state. Measurement results with True corresponding to the |1⟩ state. The outer list is for repetitions, and the inner corresponds to measurements ordered by the input indices. ValueError – repetitions is less than one or size of state is not a power of 2. IndexError – An index from indices is out of range, given the number of qubits corresponding to the state.
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.7128496170043945, "perplexity": 800.4128969026854}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-18/segments/1555578586680.51/warc/CC-MAIN-20190423035013-20190423060125-00022.warc.gz"}