[Qmod Classiq-library function]Applies Hadamard transform to the target qubits.Corresponds to the braket notation:H⊗n∣x⟩=2n1y=0∑2n−1(−1)xcdoty∣y⟩Parameters:
Name
Type
Description
Default
target
QArray[QBit]
qubits to apply to Hadamard transform to.
required
modular_increment
modular_increment(
a: CInt,
x: QNum
) -> None
[Qmod Classiq-library function]Adds a to x modulo the range of x, assumed that x is a non-negative integer and a is an integer.
Mathematically it is described as:x=(x+a)mod2x.size−1Parameters:
Name
Type
Description
Default
a
CInt
A classical integer to be added to x.
required
x
QNum
A quantum number that is assumed to be non-negative integer.
[Qmod Classiq-library function]Swaps the qubit states between two arrays.
Qubits of respective indices are swapped, and additional qubits in the longer array are left unchanged.Parameters:
Name
Type
Description
Default
x
QArray[QBit]
The first array
required
y
QArray[QBit]
The second array
required
Was this page helpful?
{"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/open_library/utility_functions","slug":"/sdk-reference/qmod/functions/open_library/utility_functions","pageMetadata":{"title":"Utility Functions","icon":"/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/functions/open_library/utility_functions"},"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`,mfrac:`mfrac`,mi:`mi`,mn:`mn`,mo:`mo`,mrow:`mrow`,mspace:`mspace`,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:`apply_to_all`})}),_jsx(_components.td,{children:`[Qmod Classiq-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`hadamard_transform`})}),_jsx(_components.td,{children:`[Qmod Classiq-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`modular_increment`})}),_jsx(_components.td,{children:`[Qmod Classiq-library function].`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`multiswap`})}),_jsx(_components.td,{children:`[Qmod Classiq-library function].`})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`apply_to_all`,children:`apply_to_all`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`apply_to_all(\ngate_operand: QCallable[Annotated[QBit, target]],\ntarget: QArray[QBit]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod Classiq-library function]`}),`\n`,_jsxs(_components.p,{children:[`Applies the single-qubit operand `,_jsx(_components.code,{children:`gate_operand`}),` to each qubit in the qubit\narray `,_jsx(_components.code,{children:`target`}),`.`]}),`\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:`gate_operand`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QCallable[Annotated[QBit, target]]`})}),_jsx(_components.td,{children:`The single-qubit gate to apply to each qubit in the array.`}),_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]`})}),_jsx(_components.td,{children:`The qubit array to apply the gate to.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`hadamard_transform`,children:`hadamard_transform`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`hadamard_transform(\ntarget: QArray[QBit]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod Classiq-library function]`}),`\n`,_jsx(_components.p,{children:`Applies Hadamard transform to the target qubits.`}),`\n`,_jsx(_components.p,{children:`Corresponds to the braket notation:`}),`\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.msup,{children:[_jsx(_components.mi,{children:`H`}),_jsxs(_components.mrow,{children:[_jsx(_components.mo,{children:`⊗`}),_jsx(_components.mi,{children:`n`})]})]}),_jsx(_components.mi,{mathvariant:`normal`,children:`∣`}),_jsx(_components.mi,{children:`x`}),_jsx(_components.mo,{stretchy:`false`,children:`⟩`}),_jsx(_components.mo,{children:`=`}),_jsxs(_components.mfrac,{children:[_jsx(_components.mn,{children:`1`}),_jsx(_components.msqrt,{children:_jsxs(_components.msup,{children:[_jsx(_components.mn,{children:`2`}),_jsx(_components.mi,{children:`n`})]})})]}),_jsxs(_components.munderover,{children:[_jsx(_components.mo,{children:`∑`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`y`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mn,{children:`0`})]}),_jsxs(_components.mrow,{children:[_jsxs(_components.msup,{children:[_jsx(_components.mn,{children:`2`}),_jsx(_components.mi,{children:`n`})]}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]})]}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`}),_jsxs(_components.msup,{children:[_jsx(_components.mo,{stretchy:`false`,children:`)`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`x`}),_jsx(_components.mspace,{linebreak:`newline`}),_jsx(_components.mi,{children:`c`}),_jsx(_components.mi,{children:`d`}),_jsx(_components.mi,{children:`o`}),_jsx(_components.mi,{children:`t`}),_jsx(_components.mi,{children:`y`})]})]}),_jsx(_components.mi,{mathvariant:`normal`,children:`∣`}),_jsx(_components.mi,{children:`y`}),_jsx(_components.mo,{stretchy:`false`,children:`⟩`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:` H^{\\\\otimes n} |x\\\\rangle = \\\\frac{1}{\\\\sqrt{2^n}} \\\\sum_{y=0}^{2^n - 1} (-1)^{x \\\\\\\\cdot y} |y\\\\rangle`})]})})}),_jsxs(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:[_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`1.0713em`,verticalAlign:`-0.25em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0813em`},children:`H`}),_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.8213em`},children:_jsxs(_components.span,{style:{top:`-3.113em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_jsx(_components.span,{className:`sizing reset-size6 size3 mtight`,children:_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord mtight`,children:`⊗`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`n`})]})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`∣`}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`}),_jsx(_components.span,{className:`mclose`,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.2702em`,verticalAlign:`-1.4032em`}}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mopen nulldelimiter`}),_jsx(_components.span,{className:`mfrac`,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.3214em`},children:[_jsxs(_components.span,{style:{top:`-2.2028em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_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.9072em`},children:[_jsxs(_components.span,{className:`svg-align`,style:{top:`-3em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,style:{paddingLeft:`0.833em`},children:_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord`,children:`2`}),_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.5904em`},children:_jsxs(_components.span,{style:{top:`-2.989em`,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:`mord mathnormal mtight`,children:`n`})})]})})})})})]})})]}),_jsxs(_components.span,{style:{top:`-2.8672em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`hide-tail`,style:{minWidth:`0.853em`,height:`1.08em`},children:_jsx(_components.svg,{xmlns:`http://www.w3.org/2000/svg`,width:`400em`,height:`1.08em`,viewBox:`0 0 400000 1080`,preserveAspectRatio:`xMinYMin slice`,children:_jsx(_components.path,{d:`M95,702\nc-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14\nc0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54\nc44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10\ns173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429\nc69,-144,104.5,-217.7,106.5,-221\nl0 -0\nc5.3,-9.3,12,-14,20,-14\nH400000v40H845.2724\ns-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7\nc-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z\nM834 80h400000v40h-400000z`})})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.1328em`},children:_jsx(_components.span,{})})})]})})})]}),_jsxs(_components.span,{style:{top:`-3.23em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`frac-line`,style:{borderBottomWidth:`0.04em`}})]}),_jsxs(_components.span,{style:{top:`-3.677em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`3em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord`,children:`1`})})]})]}),_jsx(_components.span,{className:`vlist-s`,children:``})]}),_jsx(_components.span,{className:`vlist-r`,children:_jsx(_components.span,{className:`vlist`,style:{height:`0.93em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mclose nulldelimiter`})]}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_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.867em`},children:[_jsxs(_components.span,{style:{top:`-1.8829em`,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`,style:{marginRight:`0.0359em`},children:`y`}),_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.3em`,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:[_jsxs(_components.span,{className:`mord mtight`,children:[_jsx(_components.span,{className:`mord mtight`,children:`2`}),_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.7385em`},children:_jsxs(_components.span,{style:{top:`-2.931em`,marginRight:`0.0714em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.5em`}}),_jsx(_components.span,{className:`sizing reset-size3 size1 mtight`,children:_jsx(_components.span,{className:`mord mathnormal mtight`,children:`n`})})]})})})})})]}),_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.4032em`},children:_jsx(_components.span,{})})})]})}),_jsx(_components.span,{className:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord`,children:`−`}),_jsx(_components.span,{className:`mord`,children:`1`}),_jsxs(_components.span,{className:`mclose`,children:[_jsx(_components.span,{className:`mclose`,children:`)`}),_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.8991em`},children:_jsxs(_components.span,{style:{top:`-3.113em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_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:`x`}),_jsx(_components.span,{className:`mspace mtight newline`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`c`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`d`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`o`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`t`}),_jsx(_components.span,{className:`mord mathnormal mtight`,style:{marginRight:`0.0359em`},children:`y`})]})})]})})})})})]}),_jsx(_components.span,{className:`mord`,children:`∣`}),_jsx(_components.span,{className:`mord mathnormal`,style:{marginRight:`0.0359em`},children:`y`}),_jsx(_components.span,{className:`mclose`,children:`⟩`})]})]})]})}),`\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:`target`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QArray[QBit]`})}),_jsx(_components.td,{children:`qubits to apply to Hadamard transform to.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})})]}),`\n`,_jsx(Heading,{level:`3`,id:`modular_increment`,children:`modular_increment`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`modular_increment(\na: CInt,\nx: QNum\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod Classiq-library function]`}),`\n`,_jsxs(_components.p,{children:[`Adds `,_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:[_jsx(_components.mrow,{children:_jsx(_components.mi,{children:`a`})}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`a`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`a`})]})})]}),` 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:[_jsx(_components.mrow,{children:_jsx(_components.mi,{children:`x`})}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`x`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`})]})})]}),` modulo the range of `,_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:[_jsx(_components.mrow,{children:_jsx(_components.mi,{children:`x`})}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`x`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`})]})})]}),`, assumed that `,_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:[_jsx(_components.mrow,{children:_jsx(_components.mi,{children:`x`})}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`x`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`})]})})]}),` is a non-negative integer and `,_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:[_jsx(_components.mrow,{children:_jsx(_components.mi,{children:`a`})}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:`a`})]})})}),_jsx(_components.span,{className:`katex-html`,\"aria-hidden\":`true`,children:_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`a`})]})})]}),` is an integer.\nMathematically it is described as:`]}),`\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:[_jsx(_components.mi,{children:`x`}),_jsx(_components.mo,{children:`=`}),_jsx(_components.mo,{stretchy:`false`,children:`(`}),_jsx(_components.mi,{children:`x`}),_jsx(_components.mo,{children:`+`}),_jsx(_components.mi,{children:`a`}),_jsx(_components.mo,{stretchy:`false`,children:`)`}),_jsx(_components.mtext,{children:`\\xA0`}),_jsx(_components.mspace,{}),_jsx(_components.mspace,{width:`1em`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{mathvariant:`normal`,children:`m`}),_jsx(_components.mi,{mathvariant:`normal`,children:`o`}),_jsx(_components.mi,{mathvariant:`normal`,children:`d`})]}),_jsx(_components.mtext,{children:` `}),_jsx(_components.mtext,{children:` `}),_jsx(_components.mtext,{children:`\\xA0`}),_jsxs(_components.msup,{children:[_jsx(_components.mn,{children:`2`}),_jsxs(_components.mrow,{children:[_jsx(_components.mi,{children:`x`}),_jsx(_components.mi,{mathvariant:`normal`,children:`.`}),_jsx(_components.mi,{children:`s`}),_jsx(_components.mi,{children:`i`}),_jsx(_components.mi,{children:`z`}),_jsx(_components.mi,{children:`e`})]})]}),_jsx(_components.mo,{children:`−`}),_jsx(_components.mn,{children:`1`})]}),_jsx(_components.annotation,{encoding:`application/x-tex`,children:` x = (x+a)\\\\ \\\\mod \\\\ 2^{x.size}-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.4306em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`}),_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:`mopen`,children:`(`}),_jsx(_components.span,{className:`mord mathnormal`,children:`x`}),_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:`1em`,verticalAlign:`-0.25em`}}),_jsx(_components.span,{className:`mord mathnormal`,children:`a`}),_jsx(_components.span,{className:`mclose`,children:`)`}),_jsx(_components.span,{className:`mspace`,children:`\\xA0`}),_jsx(_components.span,{className:`mspace allowbreak`}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`1em`}})]}),_jsxs(_components.span,{className:`base`,children:[_jsx(_components.span,{className:`strut`,style:{height:`0.958em`,verticalAlign:`-0.0833em`}}),_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord`,children:_jsx(_components.span,{className:`mord mathrm`,children:`mod`})})}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mspace`,style:{marginRight:`0.1667em`}}),_jsx(_components.span,{className:`mspace`,children:`\\xA0`}),_jsxs(_components.span,{className:`mord`,children:[_jsx(_components.span,{className:`mord`,children:`2`}),_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.8747em`},children:_jsxs(_components.span,{style:{top:`-3.113em`,marginRight:`0.05em`},children:[_jsx(_components.span,{className:`pstrut`,style:{height:`2.7em`}}),_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:`x`}),_jsx(_components.span,{className:`mord mtight`,children:`.`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`s`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`i`}),_jsx(_components.span,{className:`mord mathnormal mtight`,style:{marginRight:`0.044em`},children:`z`}),_jsx(_components.span,{className:`mord mathnormal mtight`,children:`e`})]})})]})})})})})]}),_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`})]})]})]})}),`\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:`a`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`CInt`})}),_jsx(_components.td,{children:`A classical integer to be added to x.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`x`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QNum`})}),_jsx(_components.td,{children:`A quantum number that is assumed to be non-negative integer.`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]})]})]}),`\n`,_jsx(Heading,{level:`3`,id:`multiswap`,children:`multiswap`}),`\n`,_jsx(`pre`,{children:_jsx(`code`,{children:`multiswap(\nx: QArray[QBit],\ny: QArray[QBit]\n) -> None`})}),`\n`,_jsx(_components.p,{children:`[Qmod Classiq-library function]`}),`\n`,_jsx(_components.p,{children:`Swaps the qubit states between two arrays.\nQubits of respective indices are swapped, and additional qubits in the longer array are left unchanged.`}),`\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:`x`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QArray[QBit]`})}),_jsx(_components.td,{children:`The first array`}),_jsx(_components.td,{children:_jsx(_components.em,{children:`required`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`y`})}),_jsx(_components.td,{children:_jsx(_components.code,{children:`QArray[QBit]`})}),_jsx(_components.td,{children:`The second array`}),_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":"Utility Functions","icon":"/icons/bulletsharp.svg","description":null,"href":"/sdk-reference/qmod/functions/open_library/utility_functions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"apply_to_all","slug":"apply_to_all","depth":3,"children":[]},{"title":"hadamard_transform","slug":"hadamard_transform","depth":3,"children":[]},{"title":"modular_increment","slug":"modular_increment","depth":3,"children":[]},{"title":"multiswap","slug":"multiswap","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":"Utility Functions - Classiq Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-10T09:11:55.562Z","originalFileLocation":"sdk-reference/qmod/functions/open_library/utility_functions.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=\"Utility Functions - 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/open_library/utility_functions\">\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=Open+Library\u0026amp;title=Utility+Functions\u0026amp;theme=b5df20730ff1884956593856\u0026amp;signature=1eedc6bc2088eb849ad2e2290789019e9e97226a277f2ebfec0fe78c582febf3\">\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=\"Utility Functions - Classiq Docs\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://classiq.mintlify.site/_mintlify/api/og/v2?division=Open+Library\u0026amp;title=Utility+Functions\u0026amp;theme=b5df20730ff1884956593856\u0026amp;signature=1eedc6bc2088eb849ad2e2290789019e9e97226a277f2ebfec0fe78c582febf3\">\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/open_library/utility_functions\">\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/open_library/utility_functions.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/open_library/utility_functions#webpage\",\"url\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions\",\"name\":\"Utility Functions\",\"dateModified\":\"2026-11-10T09:11:55.562Z\",\"isPartOf\":{\"@id\":\"https://docs.classiq.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Qmod\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/classical-types\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Functions\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/functions/core_library/allocation\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Open Library\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/amplitude_amplification\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Utility Functions\",\"item\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions#article\",\"headline\":\"Utility Functions\",\"name\":\"Utility Functions\",\"url\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.classiq.io/sdk-reference/qmod/functions/open_library/utility_functions#webpage\"},\"dateModified\":\"2026-11-10T09:11:55.562Z\",\"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/open_library/utility_functions.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","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","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","description":null,"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","description":null,"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":"Utility Functions - Classiq Docs","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}