A verifiable quantum advantage towards real world applications: Quantum Echoes 
Learn more
         
     
  
  
  
  
  
    
      cirq.pauli_expansion
  
      
    
  
  
  
  
  
    
  
  
    
    
Returns coefficients of the expansion of val in the Pauli basis.
cirq.pauli_expansion(
    val: Any,
    *,
    default: (value.LinearDict[str] | TDefault) = RaiseTypeErrorIfNotProvided,
    atol: float = 1e-09
) -> (value.LinearDict[str] | TDefault)
| Args | 
|---|
| val | The value whose Pauli expansion is to returned. | 
| default | Determines what happens when valdoes not have methods that
allow Pauli expansion to be obtained (see below). If set, the value
is returned in that case. Otherwise, TypeError is raised. | 
| atol | Ignore coefficients whose absolute value is smaller than this. | 
| Returns | 
|---|
| If valhas a _pauliexpansion method, then its result is returned.
Otherwise, ifvalhas a small unitary then that unitary is expanded
in the Pauli basis and coefficients are returned. Otherwise, if default
is set to None or other value then default is returned. Otherwise,
TypeError is raised. | 
| Raises | 
|---|
| TypeError | If valhas none of the methods necessary to obtain its Pauli
expansion and no default value has been provided. | 
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  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."],[],[]]