[Qmod core-library function]Initializes a quantum variable in a state corresponding to a given probability distribution:∣out⟩=i=0∑len(probabilities)−1probabilities[i]∣i⟩with i=0,1,2,...,{len(amplitudes)}−1 corresponding to computational basis states.Parameters:
Name
Type
Description
Default
probabilities
CArray[CReal]
The probability distribution to initialize the quantum variable. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Initializes a quantum variable in a state corresponding to the given amplitudes:∣out⟩=i=0∑len(amplitudes)−1amplitudes[i]∣i⟩with i=0,1,2,...,{len(amplitudes)}−1 corresponding to computational basis states.Parameters:
Name
Type
Description
Default
amplitudes
CArray[CReal]
The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |0> to the state per the specified probability distribution
(similar to prepare_state but preformed on an initialized variable).Parameters:
Name
Type
Description
Default
probabilities
CArray[CReal]
The probability distribution corresponding to the quantum variable state. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |0> to the state per the specified amplitudes
(similar to prepare_amplitudes but preformed on an initialized variable).Parameters:
Name
Type
Description
Default
amplitudes
CArray[CReal]
The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).
required
bound
CReal
An error bound, expressed as the L{2} norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.
[Qmod core-library function]Transforms a given quantum variable in the state |n> to e{iphases[n]}|n> for all n, where |n> are the computational basis states.Parameters:
Name
Type
Description
Default
phases
CArray[CReal]
The phases to rotate the quantum variable. Must be a real vector. Must have a valid length (2 to the power of the number of qubits in the target variable).
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Classiq Docs","colors":{"primary":"#119DA4","light":"#119DA4","dark":"#252525"},"logo":{"light":"https://mintcdn.com/classiq/KOIyvRl59wygyHwT/resources/images/ClassiqLogo_black.svg?fit=max\u0026auto=format\u0026n=KOIyvRl59wygyHwT\u0026q=85\u0026s=05c70b0722c0e3ce41855332613b7165","dark":"https://mintcdn.com/classiq/KOIyvRl59wygyHwT/resources/images/ClassiqLogo_yellow.svg?fit=max\u0026auto=format\u0026n=KOIyvRl59wygyHwT\u0026q=85\u0026s=bf01ead39f6725fa4849b7c481d1dff5"},"favicon":"https://mintcdn.com/classiq/sA-J-h8chQJV9OAG/resources/images/ClassiqFavicon.png?fit=max\u0026auto=format\u0026n=sA-J-h8chQJV9OAG\u0026q=85\u0026s=752f5dcd6fdc3563c87e0697e34282b1","appearance":{"default":"dark"},"background":{"color":{"dark":"#191919"}},"footer":{"socials":{"x":"https://x.com/classiqtech","github":"https://github.com/Classiq/classiq-library","linkedin":"https://www.linkedin.com/company/classiq-technologies","youtube":"https://www.youtube.com/c/ClassiqTechnologies","slack":"https://classiq-community.slack.com"}},"seo":{"metatags":{"canonical":"https://docs.classiq.io"}},"fonts":{"heading":{"family":"Lato","weight":500,"source":"https://fonts.gstatic.com/s/lato/v25/S6u9w4BMUTPHh6UVSwiPGQ3q5d0.woff2","format":"woff2"},"body":{"family":"Lato","weight":400,"source":"https://cdn.prod.website-files.com/60000db7a5f449af5e4590ac/67bc6e7dacd49b96fe00e9af_latomedium.woff2","format":"woff2"}},"icons":{"library":"lucide"},"integrations":{"ga4":{"measurementId":"G-FG13SFNT8X"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"classiq","hasAudioNarration":false,"actualSubdomain":"classiq","customDomains":["docs.classiq.io"],"gitSource":{"type":"github","owner":"classiq-technologies","repo":"classiq-docs","deployBranch":"prod","contentDirectory":"classiq","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af2dfc98b1d48fe462fb247","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Library","count":180},{"language":"default","tag":"Applications","count":88},{"language":"default","tag":"User Guide","count":64},{"language":"default","tag":"Tutorials","count":63},{"language":"default","tag":"SDK Reference","count":53},{"language":"default","tag":"Algorithms","count":46},{"language":"default","tag":"Qmod Reference","count":40},{"language":"default","tag":"Qmod","count":30},{"language":"default","tag":"Functions","count":26},{"language":"default","tag":"Execution","count":22}],"searchSettings":{"showContentSnippets":false}},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"css/page_format.css","content":":root{p {\n /* letter-spacing: 0.5px; */\n /* font-weight: 400; */\n /* line-height: 160%; */\n /* font-size: 18px; */\n }\n\n .md-header,\n .md-header__inner,\n .md-header .md-tabs,\n .md-footer .md-footer-meta {\n background-color: #313131 !important;\n }\n\n .md-footer,\n .md-footer__inner {\n background-color: #393939 !important;\n }}[data-md-color-scheme=\"default\"]{--md-default-fg-color: #313131;--md-default-bg-color: #ffffff;--md-primary-fg-color: #119da4;--md-accent-fg-color: #119da4;--md-primary-fg-color--light: #119da4;--md-primary-bg-color--light: #119da4;--md-accent-fg-color--light: #119da4;--md-typeset-color: #1e1e1e;--md-typeset-color--light: #1e1e1e;--md-typeset-a-color: #0c7489;--md-typeset-a-color--light: #0c7489;--md-typeset-a-color--dark: #39ccd3}[data-md-color-scheme=\"slate\"]{--md-default-bg-color: #191919;--md-primary-fg-color: #119da4;--md-accent-fg-color: #119da4;--md-typeset-a-color: #39ccd3}[data-md-color-scheme=\"default\"] .md-search__input{color:rgba(0, 0, 0, 0.87);background-color:#f5f5f5}.md-search__input+.md-search__icon{color:var(--md-default-fg-color--light)}[data-md-color-scheme=\"default\"] .md-search__input::placeholder{color:rgba(0, 0, 0, 0.54)}@media (prefers-color-scheme: dark){.md-header,.md-header__inner,.md-footer .md-footer-meta{background-color:#1e1e1e!important}.md-footer,.md-footer__inner{background-color:#393939!important}}.md-header__topic{display:none}.md-header__source{flex:1;display:flex;justify-content:space-between;max-width:none;width:auto}@media (max-width: 60em){.md-header__source .md-source__repository{display:none}}.md-source__repository{max-width:100%}.doc-buttons{display:flex;justify-content:center;gap:0.2rem;flex-wrap:wrap;margin:1.5em 0}"}],"page":{"pagePath":"sdk-reference/qmod/functions/core_library/allocation","slug":"/sdk-reference/qmod/functions/core_library/allocation","pageMetadata":{"title":"Allocation","icon":"/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/functions/core_library/allocation"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={annotation:`annotation`,code:`code`,em:`em`,math:`math`,mi:`mi`,mn:`mn`,mo:`mo`,mrow:`mrow`,msqrt:`msqrt`,msup:`msup`,mtext:`mtext`,munderover:`munderover`,p:`p`,path:`path`,semantics:`semantics`,span:`span`,strong:`strong`,svg:`svg`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,..._provideComponents(),...props.components},{Heading,Table}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Functions:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Description`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`free`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prepare_state`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`prepare_amplitudes`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`inplace_prepare_state`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`inplace_prepare_amplitudes`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`assign_phase_table`})}),_jsx(_components.td,{children:`[Qmod core-library function].`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`free`,children:`free`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`free(\nin_: Input[QArray[QBit]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsx(_components.p,{children:`Releases the qubits allocated to a quantum variable, allowing them to be reused.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsx(_components.tbody,{children:_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`in_`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Input[QArray[QBit]]`})}),_jsx(_components.td,{children:`The quantum variable that will be freed. Must be initialized before.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`prepare_state`,children:`prepare_state`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`prepare_state(\nprobabilities: CArray[CReal],\nbound: CReal,\nout: Output[QArray[QBit, Literal[‘log(probabilities.len, 2)’]]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsx(_components.p,{children:`Initializes a quantum variable in a state corresponding to a given probability distribution:`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`∣`}),_jsx(_components.mtext,{children:`out`}),_jsx(_components.mo,{fence:`true`,children:`⟩`})]}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.munderover,{children:[_jsx(_components.mo,{children:`∑`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mn,{children:`0`})]}),_jsxs(_components.mrow,{children:[_jsx(_components.mtext,{children:`len(probabilities)`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]})]}),_jsx(_components.msqrt,{children:_jsxs(_components.mrow,{children:[_jsx(_components.mtext,{children:`probabilities`}),_jsx(_components.mo,{stretchy:`false`,children:`[`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{stretchy:`false`,children:`]`})]})}),_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`∣`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{fence:`true`,children:`⟩`})]})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:` \\\\left|\\\\text{out}\\\\right\\\\rangle = \\\\sum_{i=0}^{\\\\text{len(probabilities)}-1} \\\\sqrt{\\\\text{probabilities}[i]} \\\\left|i\\\\right\\\\rangle`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:`∣`}),_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`out`})}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:`⟩`})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`3.2387em`,verticalAlign:`-1.2777em`}}),_jsx(_components.span,{className:`mop op-limits`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.961em`},children:[_jsxs(_components.span,{style:{top:`-1.8723em`,marginLeft:`0em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord mathnormal mtight`,children:`i`}),_jsx(_components.span,{className:`mrel mtight`,children:`=`}),_jsx(_components.span,{className:`mord mtight`,children:`0`})]})})]}),_jsxs(_components.span,{style:{top:`-3.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{children:_jsx(_components.span,{className:`mop op-symbol large-op`,children:`∑`})})]}),_jsxs(_components.span,{style:{top:`-4.386em`,marginLeft:`0em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord text mtight`,children:_jsx(_components.span,{className:`mord mtight`,children:`len(probabilities)`})}),_jsx(_components.span,{className:`mbin mtight`,children:`−`}),_jsx(_components.span,{className:`mord mtight`,children:`1`})]})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`1.2777em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord sqrt`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`0.9839em`},children:[_jsxs(_components.span,{className:`svg-align`,style:{top:`-3.2em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.2em`}}),_jsxs(_components.span,{className:`mord`,style:{paddingLeft:`1em`},children:[_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`probabilities`})}),_jsx(_components.span,{className:`mopen`,children:`[`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mclose`,children:`]`})]})]}),_jsxs(_components.span,{style:{top:`-2.9439em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.2em`}}),_jsx(_components.span,{className:`hide-tail`,style:{minWidth:`1.02em`,height:`1.28em`},children:_jsx(_components.svg,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.28em`,viewBox:`0 0 400000 1296`,preserveAspectRatio:`xMinYMin slice`,children:_jsx(_components.path,{d:`M263,681c0.7,0,18,39.7,52,119\nc34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120\nc340,-704.7,510.7,-1060.3,512,-1067\nl0 -0\nc4.7,-7.3,11,-11,19,-11\nH40000v40H1012.3\ns-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232\nc-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1\ns-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26\nc-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z\nM1001 80h400000v40h-400000z`})})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.2561em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:`∣`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:`⟩`})]})]})]})]})}),`\n`,_jsxs(_components.p,{children:[`with `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mn,{children:`0`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mn,{children:`1`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mtext,{children:`{`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mi,{children:`m`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mo,{stretchy:`false`,children:`)`}),_jsx(_components.mo,{stretchy:`false`,children:`}`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`i = 0, 1, 2, ..., \\\\text\\\\{len(amplitudes)\\\\}-1`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6595em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord`,children:`0`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`...`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`{`})}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`l`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord mathnormal`,children:`am`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`pl`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord mathnormal`,children:`es`}),_jsx(_components.span,{className:`mclose`,children:`)}`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`−`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6444em`}}),_jsx(_components.span,{className:`mord`,children:`1`})]})]})]}),` corresponding to computational basis states.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`probabilities`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CArray[CReal]`})}),_jsx(_components.td,{children:`The probability distribution to initialize the quantum variable. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`bound`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CReal`})}),_jsxs(_components.td,{children:[`An error bound, expressed as the `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`L`}),_jsx(_components.mo,{stretchy:`false`,children:`{`})]}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{stretchy:`false`,children:`}`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`L^\\\\{2\\\\}`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.138em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`L`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.888em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mopen mtight`,children:`{`})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mclose`,children:`}`})]})})]}),` norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.`]}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`out`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Output[QArray[QBit, Literal['log(probabilities.len, 2)']]]`})}),_jsx(_components.td,{children:`The quantum variable that will receive the initialized state. Must be uninitialized.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`prepare_amplitudes`,children:`prepare_amplitudes`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`prepare_amplitudes(\namplitudes: CArray[CReal],\nbound: CReal,\nout: Output[QArray[QBit, Literal[‘log(amplitudes.len, 2)’]]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsx(_components.p,{children:`Initializes a quantum variable in a state corresponding to the given amplitudes:`}),`\n`,_jsx(_components.span,{className:`katex-display`,children:_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,display:`block`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`∣`}),_jsx(_components.mtext,{children:`out`}),_jsx(_components.mo,{fence:`true`,children:`⟩`})]}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.munderover,{children:[_jsx(_components.mo,{children:`∑`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mn,{children:`0`})]}),_jsxs(_components.mrow,{children:[_jsx(_components.mtext,{children:`len(amplitudes)`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]})]}),_jsx(_components.mtext,{children:`amplitudes`}),_jsx(_components.mo,{stretchy:`false`,children:`[`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{stretchy:`false`,children:`]`}),_jsxs(_components.mrow,{children:[_jsx(_components.mo,{fence:`true`,children:`∣`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{fence:`true`,children:`⟩`})]})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:` \\\\left|\\\\text{out}\\\\right\\\\rangle = \\\\sum_{i=0}^{\\\\text{len(amplitudes)}-1} \\\\text{amplitudes}[i] \\\\left|i\\\\right\\\\rangle`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:`∣`}),_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`out`})}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:`⟩`})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`3.2387em`,verticalAlign:`-1.2777em`}}),_jsx(_components.span,{className:`mop op-limits`,children:_jsxs(_components.span,{className:`vlist-t vlist-t2`,children:[_jsxs(_components.span,{className:`vlist-r`,children:[_jsxs(_components.span,{className:`vlist`,style:{height:`1.961em`},children:[_jsxs(_components.span,{style:{top:`-1.8723em`,marginLeft:`0em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord mathnormal mtight`,children:`i`}),_jsx(_components.span,{className:`mrel mtight`,children:`=`}),_jsx(_components.span,{className:`mord mtight`,children:`0`})]})})]}),_jsxs(_components.span,{style:{top:`-3.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{children:_jsx(_components.span,{className:`mop op-symbol large-op`,children:`∑`})})]}),_jsxs(_components.span,{style:{top:`-4.386em`,marginLeft:`0em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3.05em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord text mtight`,children:_jsx(_components.span,{className:`mord mtight`,children:`len(amplitudes)`})}),_jsx(_components.span,{className:`mbin mtight`,children:`−`}),_jsx(_components.span,{className:`mord mtight`,children:`1`})]})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`1.2777em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`amplitudes`})}),_jsx(_components.span,{className:`mopen`,children:`[`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mclose`,children:`]`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsxs(_components.span,{className:`minner`,children:[_jsx(_components.span,{className:`mopen delimcenter`,style:{top:`0em`},children:`∣`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mclose delimcenter`,style:{top:`0em`},children:`⟩`})]})]})]})]})}),`\n`,_jsxs(_components.p,{children:[`with `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`i`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mn,{children:`0`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mn,{children:`1`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mo,{separator:`true`,children:`,`}),_jsx(_components.mtext,{children:`{`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mi,{children:`m`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mi,{children:`l`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`u`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mo,{stretchy:`false`,children:`)`}),_jsx(_components.mo,{stretchy:`false`,children:`}`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`i = 0, 1, 2, ..., \\\\text\\\\{len(amplitudes)\\\\}-1`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6595em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}}),_jsx(_components.span,{className:`mrel`,children:`=`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2778em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord`,children:`0`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord`,children:`...`}),_jsx(_components.span,{className:`mpunct`,children:`,`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mord text`,children:_jsx(_components.span,{className:`mord`,children:`{`})}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`l`}),_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord mathnormal`,children:`am`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0197em`},children:`pl`}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mord mathnormal`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal`,children:`u`}),_jsx(_components.span,{className:`mord mathnormal`,children:`d`}),_jsx(_components.span,{className:`mord mathnormal`,children:`es`}),_jsx(_components.span,{className:`mclose`,children:`)}`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}}),_jsx(_components.span,{className:`mbin`,children:`−`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.2222em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.6444em`}}),_jsx(_components.span,{className:`mord`,children:`1`})]})]})]}),` corresponding to computational basis states.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`amplitudes`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CArray[CReal]`})}),_jsx(_components.td,{children:`The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`bound`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CReal`})}),_jsxs(_components.td,{children:[`An error bound, expressed as the `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`L`}),_jsx(_components.mo,{stretchy:`false`,children:`{`})]}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{stretchy:`false`,children:`}`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`L^\\\\{2\\\\}`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.138em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`L`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.888em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mopen mtight`,children:`{`})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mclose`,children:`}`})]})})]}),` norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.`]}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`out`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Output[QArray[QBit, Literal['log(amplitudes.len, 2)']]]`})}),_jsx(_components.td,{children:`The quantum variable that will receive the initialized state. Must be uninitialized.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`inplace_prepare_state`,children:`inplace_prepare_state`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`inplace_prepare_state(\nprobabilities: CArray[CReal],\nbound: CReal,\ntarget: QArray[QBit, Literal[‘log(probabilities.len, 2)’]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsxs(_components.p,{children:[`Transforms a given quantum variable in the state `,_jsx(_components.code,{children:`|0>`}),` to the state per the specified probability distribution\n(similar to `,_jsx(_components.code,{children:`prepare_state`}),` but preformed on an initialized variable).`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`probabilities`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CArray[CReal]`})}),_jsx(_components.td,{children:`The probability distribution corresponding to the quantum variable state. Must be a valid probability distribution, i.e., a list of non-negative real numbers that sum to 1. Must have a valid length (a power of 2).`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`bound`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CReal`})}),_jsxs(_components.td,{children:[`An error bound, expressed as the `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`L`}),_jsx(_components.mo,{stretchy:`false`,children:`{`})]}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{stretchy:`false`,children:`}`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`L^\\\\{2\\\\}`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.138em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`L`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.888em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mopen mtight`,children:`{`})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mclose`,children:`}`})]})})]}),` norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.`]}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`target`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QArray[QBit, Literal['log(probabilities.len, 2)']]`})}),_jsx(_components.td,{children:`The quantum variable to act upon.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`inplace_prepare_amplitudes`,children:`inplace_prepare_amplitudes`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`inplace_prepare_amplitudes(\namplitudes: CArray[CReal],\nbound: CReal,\ntarget: QArray[QBit, Literal[‘log(amplitudes.len, 2)’]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsxs(_components.p,{children:[`Transforms a given quantum variable in the state `,_jsx(_components.code,{children:`|0>`}),` to the state per the specified amplitudes\n(similar to `,_jsx(_components.code,{children:`prepare_amplitudes`}),` but preformed on an initialized variable).`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`amplitudes`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CArray[CReal]`})}),_jsx(_components.td,{children:`The amplitudes to initialize the quantum variable. Must be a valid real quantum state vector, i.e., the sum of squares should be 1. Must have a valid length (a power of 2).`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`bound`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CReal`})}),_jsxs(_components.td,{children:[`An error bound, expressed as the `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`L`}),_jsx(_components.mo,{stretchy:`false`,children:`{`})]}),_jsx(_components.mn,{children:`2`}),_jsx(_components.mo,{stretchy:`false`,children:`}`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`L^\\\\{2\\\\}`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.138em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`L`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.888em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mopen mtight`,children:`{`})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`2`}),_jsx(_components.span,{className:`mclose`,children:`}`})]})})]}),` norm between the expected and actual distributions. A larger bound can reduce the circuit size at the expense of accuracy. Must be a positive real number.`]}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`target`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QArray[QBit, Literal['log(amplitudes.len, 2)']]`})}),_jsx(_components.td,{children:`The quantum variable to act upon.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`assign_phase_table`,children:`assign_phase_table`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`assign_phase_table(\nphases: CArray[CReal],\ntarget: Const[QArray[QBit, Literal[‘log(phases.len, 2)’]]]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod core-library function]`}),`\n`,_jsxs(_components.p,{children:[`Transforms a given quantum variable in the state `,_jsx(_components.code,{children:`|n>`}),` to `,_jsxs(_components.span,{className:`katex`,children:[_jsx(_components.span,{className:`katex-mathml`,children:_jsx(_components.math,{xmlns:`http://www.w3.org/1998/Math/MathML`,children:_jsxs(_components.semantics,{children:[_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mi,{children:`e`}),_jsx(_components.mo,{stretchy:`false`,children:`{`})]}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mi,{children:`p`}),_jsx(_components.mi,{children:`h`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{children:`e`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mo,{stretchy:`false`,children:`[`}),_jsx(_components.mi,{children:`n`}),_jsx(_components.mo,{stretchy:`false`,children:`]`}),_jsx(_components.mo,{stretchy:`false`,children:`}`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`e^\\\\{i phases[n]\\\\}`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.138em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,children:`e`}),_jsx(_components.span,{className:`msupsub`,children:_jsx(_components.span,{className:`vlist-t`,children:_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.888em`},children:_jsxs(_components.span,{style:{top:`-3.063em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsx(_components.span,{className:`mopen mtight`,children:`{`})})]})})})})})]}),_jsx(_components.span,{className:`mord mathnormal`,children:`i`}),_jsx(_components.span,{className:`mord mathnormal`,children:`p`}),_jsx(_components.span,{className:`mord mathnormal`,children:`ha`}),_jsx(_components.span,{className:`mord mathnormal`,children:`ses`}),_jsx(_components.span,{className:`mopen`,children:`[`}),_jsx(_components.span,{className:`mord mathnormal`,children:`n`}),_jsx(_components.span,{className:`mclose`,children:`]}`})]})})]}),` `,_jsx(_components.code,{children:`|n>`}),` for all n, where `,_jsx(_components.code,{children:`|n>`}),` are the computational basis states.`]}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters:`})}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Name`}),_jsx(_components.th,{children:`Type`}),_jsx(_components.th,{children:`Description`}),_jsx(_components.th,{children:`Default`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`phases`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CArray[CReal]`})}),_jsx(_components.td,{children:`The phases to rotate the quantum variable. Must be a real vector. Must have a valid length (2 to the power of the number of qubits in the target variable).`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`target`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`Const[QArray[QBit, Literal['log(phases.len, 2)']]]`})}),_jsx(_components.td,{children:`The quantum variable to act upon.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Allocation","icon":"/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/functions/core_library/allocation"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"free","slug":"free","depth":3,"children":[]},{"title":"prepare_state","slug":"prepare_state","depth":3,"children":[]},{"title":"prepare_amplitudes","slug":"prepare_amplitudes","depth":3,"children":[]},{"title":"inplace_prepare_state","slug":"inplace_prepare_state","depth":3,"children":[]},{"title":"inplace_prepare_amplitudes","slug":"inplace_prepare_amplitudes","depth":3,"children":[]},{"title":"assign_phase_table","slug":"assign_phase_table","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/classiq/588df4baa9fe4869/javascripts/mathjax.js","/_mintlify/custom/classiq/cdc2514d6b755dcf/javascripts/remove_highlights.js","/_mintlify/custom/classiq/d98eeb06669bf6a7/javascripts/hide-home-search.js"],"subdomain":"classiq","siteName":"Classiq Docs","title":"Allocation - Classiq Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-10T09:11:55.575Z","originalFileLocation":"sdk-reference/qmod/functions/core_library/allocation.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Classiq Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Allocation - Classiq Docs\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Classiq Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://classiq.mintlify.site/_mintlify/api/og/v2?division=Core+Library\u0026amp;title=Allocation\u0026amp;theme=b5df20730ff1884956593856\u0026amp;signature=b859207987a4582553d3e552e124c15772649884f6174cf9df54bc7e5ae4a3f0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Allocation - Classiq Docs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://classiq.mintlify.site/_mintlify/api/og/v2?division=Core+Library\u0026amp;title=Allocation\u0026amp;theme=b5df20730ff1884956593856\u0026amp;signature=b859207987a4582553d3e552e124c15772649884f6174cf9df54bc7e5ae4a3f0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/classiq/Fsuml838IESUxXo8/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Classiq Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#119DA4\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdk-reference/qmod/functions/core_library/allocation.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.classiq.io/#organization\",\"name\":\"Classiq Docs\",\"url\":\"https://docs.classiq.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/classiq/KOIyvRl59wygyHwT/resources/images/ClassiqLogo_black.svg?fit=max\u0026auto=format\u0026n=KOIyvRl59wygyHwT\u0026q=85\u0026s=05c70b0722c0e3ce41855332613b7165\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.classiq.io#website\",\"name\":\"Classiq Docs\",\"url\":\"https://docs.classiq.io\",\"publisher\":{\"@id\":\"https://docs.classiq.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation#webpage\",\"url\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\",\"name\":\"Allocation\",\"dateModified\":\"2026-11-10T09:11:55.575Z\",\"isPartOf\":{\"@id\":\"https://docs.classiq.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Qmod\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/classical-types\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Allocation\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation#article\",\"headline\":\"Allocation\",\"name\":\"Allocation\",\"url\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\",\"mainEntityOfPage\":{\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation#webpage\"},\"dateModified\":\"2026-11-10T09:11:55.575Z\",\"publisher\":{\"@id\":\"https://docs.classiq.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.classiq.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Classiq Docs\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Classiq Docs\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/sdk-reference/qmod/functions/core_library/allocation.md","siteName":"Classiq Docs","nav":{"global":null,"tabs":[{"tab":"Home","pages":[{"title":"Home","href":""}]},{"tab":"Getting Started","pages":[{"title":"Getting Started","href":"/getting-started"}]},{"tab":"User Guide","pages":[{"title":"User Guide","href":"/user-guide"}]},{"tab":"Library","pages":[{"title":"Library","href":"/explore"}]},{"tab":"Qmod Reference","pages":[{"title":"Qmod Reference","href":"/qmod-reference"}]},{"tab":"SDK Reference","pages":[{"title":"Classiq SDK Reference","href":"/sdk-reference"},{"title":"Synthesis","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/synthesis"},{"title":"Execution","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/execution"},{"title":"Error Correction","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/error-correction"},{"title":"Cudaq","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/cudaq"},{"group":"Providers","expanded":false,"pages":[{"title":"Iqm","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/IQM"},{"title":"Index","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/index"},{"title":"Aws","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/AWS"},{"title":"Alice And Bob","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/Alice and Bob"},{"title":"Azure","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/Azure"},{"title":"Braket","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/Braket"},{"title":"C12","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/C12"},{"title":"Classiq","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/Classiq"},{"title":"Simulator Noise","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/simulator-noise"},{"title":"Gcp","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/GCP"},{"title":"Ibm","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/IBM"},{"title":"Ionq","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/IonQ"},{"title":"Oqc","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/providers/OQC"}]},{"group":"Applications","expanded":false,"pages":[{"title":"Block Encoding","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/applications/block_encoding"},{"title":"Iqae","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/applications/IQAE"},{"title":"Qsp","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/applications/QSP"},{"title":"Qsvm","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/applications/QSVM"},{"title":"Chemistry","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/applications/chemistry"}]},{"group":"Qmod","icon":"/icons/bulletsharp.svg","expanded":false,"pages":[{"title":"Classical Types","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/classical-types"},{"group":"Functions","icon":"/icons/bulletsharp.svg","expanded":false,"pages":[{"group":"Core Library","icon":"/icons/bulletsharp.svg","expanded":false,"pages":[{"title":"Allocation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/core_library/allocation"},{"title":"Arithmetic","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/functions/core_library/arithmetic"},{"title":"Exponentiation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/core_library/exponentiation"},{"title":"Gray Code","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/core_library/gray_code"},{"title":"Mid Circuit Measurement","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/core_library/mid_circuit_measurement"},{"title":"Standard Gates","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/core_library/standard_gates"}]},{"group":"Open Library","icon":"/icons/bulletsharp.svg","expanded":false,"pages":[{"title":"Amplitude Amplification","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/amplitude_amplification"},{"title":"Amplitude Estimation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/amplitude_estimation"},{"title":"Amplitude Loading","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/amplitude_loading"},{"title":"Bit Operations","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/bit_operations"},{"title":"Discrete Sine Cosine Transform","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/discrete_sine_cosine_transform"},{"title":"Encodings","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/encodings"},{"title":"Grover","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/grover"},{"title":"Hea","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/hea"},{"title":"Linear Combination Of Unitaries","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/linear_combination_of_unitaries"},{"title":"Linear Pauli Rotation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/linear_pauli_rotation"},{"title":"Modular Arithmetics","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/modular_arithmetics"},{"title":"Qaoa Penalty","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/qaoa_penalty"},{"title":"Qft Functions","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/qft_functions"},{"title":"Qpe","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/qpe"},{"title":"Qsvt","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/qsvt"},{"title":"State Preparation","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/state_preparation"},{"title":"Swap Test","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/swap_test"},{"title":"Unary Iteration","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/unary_iteration"},{"title":"Utility Functions","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/utility_functions"},{"title":"Variational","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/functions/open_library/variational"}]}]},{"title":"Operations","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/operations"},{"title":"Path Operators","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/path-operators"},{"title":"Symbolic Functions","icon":"https://mintlify.s3.us-west-1.amazonaws.com/classiq/icons/bulletsharp.svg","href":"/sdk-reference/qmod/symbolic-functions"}]}]},{"tab":"Support","pages":[{"title":"Support","href":"/support"}]},{"tab":"Release Notes","pages":[{"title":"Release Notes","href":"/release-news/recap-aug-sep-2026"}]}]},"basePath":"","title":"Allocation - Classiq Docs","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}