A verifiable quantum advantage towards real world applications: Quantum Echoes 
Learn more
         
     
  
  
  
  
  
    
      cirq.decompose_once
  
      
    
  
  
  
  
  
    
  
  
    
    
Decomposes a value into operations, if possible.
cirq.decompose_once(
    val: Any,
    default=RaiseTypeErrorIfNotProvided,
    *args,
    flatten: bool = True,
    context: (DecompositionContext | None) = None,
    **kwargs
)
Used in the notebooks
This method decomposes the value exactly once, instead of decomposing it
and then continuing to decomposing the decomposed operations recursively
until some criteria is met (which is what cirq.decompose does).
| Args | 
|---|
| val | The value to call _decompose_on, if possible. | 
| default | A default result to use if the value doesn't have a _decompose_method or that method returnsNotImplementedorNone. If not specified, non-decomposable values cause aTypeError. | 
| *args | Positional arguments to forward into the _decompose_method ofval.  For example, this is used to tell gates what qubits they are
being applied to. | 
| flatten | If True, the returned OP-TREE will be flattened to a list of operations. | 
| context | Decomposition context specifying common configurable options for
controlling the behavior of decompose. | 
| **kwargs | Keyword arguments to forward into the _decompose_method ofval. | 
| Returns | 
|---|
| The result of val._decompose_(*args, **kwargs), ifvalhas a_decompose_method and it didn't returnNotImplementedorNone.
Otherwisedefaultis returned, if it was specified. Otherwise an error
is raised. | 
| Raises | 
|---|
| TypeError | valdidn't have a_decompose_method (or that method returnedNotImplementedorNone) anddefaultwasn't set. | 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-08-14 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[],[]]