class_docstr: BlockEncode(A, wires)
  Construct a unitary :math:`U(A)` such that an arbitrary matrix :math:`A`
  is encoded in the top-left block.
  
  .. math::
  
      \begin{align}
           U(A) &=
           \begin{bmatrix}
              A & \sqrt{I-AA^\dagger} \\
              \sqrt{I-A^\dagger A} & -A^\dagger
          \end{bmatrix}.
      \end{align}
  
  **Details:**
  
  * Number of wires: Any (the operation can act on any number of wires)
  * Number of parameters: 1
  * Number of dimensions per parameter: (2,)
  * Gradient recipe: None
  
  Args:
      A (tensor_like): a general :math:`(n \times m)` matrix to be encoded
      wires (Iterable[int, str], Wires): the wires the operation acts on
      id (str or None): String representing the operation (optional)
  
  Raises:
      ValueError: if the number of wires doesn't fit the dimensions of the matrix
  
  **Example**
  
  We can define a matrix and a block-encoding circuit as follows:
  
  >>> A = [[0.1,0.2],[0.3,0.4]]
  >>> dev = qml.device('default.qubit', wires=2)
  >>> @qml.qnode(dev)
  ... def example_circuit():
  ...     qml.BlockEncode(A, wires=range(2))
  ...     return qml.state()
  
  We can see that :math:`A` has been block encoded in the matrix of the circuit:
  
  >>> print(qml.matrix(example_circuit)())
  [[ 0.1         0.2         0.97283788 -0.05988708]
   [ 0.3         0.4        -0.05988708  0.86395228]
   [ 0.94561648 -0.07621992 -0.1        -0.3       ]
   [-0.07621992  0.89117368 -0.2        -0.4       ]]
  
  We can also block-encode a non-square matrix and check the resulting unitary matrix:
  
  >>> A = [[0.2, 0, 0.2],[-0.2, 0.2, 0]]
  >>> op = qml.BlockEncode(A, wires=range(3))
  >>> print(np.round(qml.matrix(op), 2))
  [[ 0.2   0.    0.2   0.96  0.02  0.    0.    0.  ]
   [-0.2   0.2   0.    0.02  0.96  0.    0.    0.  ]
   [ 0.96  0.02 -0.02 -0.2   0.2   0.    0.    0.  ]
   [ 0.02  0.98  0.   -0.   -0.2   0.    0.    0.  ]
   [-0.02  0.    0.98 -0.2  -0.    0.    0.    0.  ]
   [ 0.    0.    0.    0.    0.    1.    0.    0.  ]
   [ 0.    0.    0.    0.    0.    0.    1.    0.  ]
   [ 0.    0.    0.    0.    0.    0.    0.    1.  ]]
  
  .. note::
      If the operator norm of :math:`A`  is greater than 1, we normalize it to ensure
      :math:`U(A)` is unitary. The normalization constant can be
      accessed through :code:`op.hyperparameters["norm"]`.
  
      Specifically, the norm is computed as the maximum of
      :math:`\| AA^\dagger \|` and
      :math:`\| A^\dagger A \|`.
class_docstr_tok: ["BlockEncode","(","A",",","wires",")","Construct","a","unitary",":","math",":","`","U","(","A",")","`","such","that","an","arbitrary","matrix",":","math",":","`","A","`","is","encoded","in","the","top-left","block",".","..","math",":",":","\\begin","{","align","}","U","(","A",")","&","=","\\begin","{","bmatrix","}","A","&","\\sqrt","{","I-AA^\\dagger","}","\\\\","\\sqrt","{","I-A^\\dagger","A","}","&","-A^\\dagger","\\end","{","bmatrix","}",".","\\end","{","align","}","*","*","Details",":","*","*","*","Number","of","wires",":","Any","(","the","operation","can","act","on","any","number","of","wires",")","*","Number","of","parameters",":","1","*","Number","of","dimensions","per","parameter",":","(","2",",",")","*","Gradient","recipe",":","None","Args",":","A","(","tensor_like",")",":","a","general",":","math",":","`","(","n","\\times","m",")","`","matrix","to","be","encoded","wires","(","Iterable","[","int",",","str","]",",","Wires",")",":","the","wires","the","operation","acts","on","id","(","str","or","None",")",":","String","representing","the","operation","(","optional",")","Raises",":","ValueError",":","if","the","number","of","wires","does","n't","fit","the","dimensions","of","the","matrix","*","*","Example","*","*","We","can","define","a","matrix","and","a","block-encoding","circuit","as","follows",":",">",">",">","A","=","[","[","0.1,0.2","]",",","[","0.3,0.4","]","]",">",">",">","dev","=","qml.device","(","'default.qubit","'",",","wires=2",")",">",">",">","@","qml.qnode","(","dev",")","...","def","example_circuit","(",")",":","...","qml.BlockEncode","(","A",",","wires=range","(","2",")",")","...","return","qml.state","(",")","We","can","see","that",":","math",":","`","A","`","has","been","block","encoded","in","the","matrix","of","the","circuit",":",">",">",">","print","(","qml.matrix","(","example_circuit",")","(",")",")","[","[","0.1","0.2","0.97283788","-0.05988708","]","[","0.3","0.4","-0.05988708","0.86395228","]","[","0.94561648","-0.07621992","-0.1","-0.3","]","[","-0.07621992","0.89117368","-0.2","-0.4","]","]","We","can","also","block-encode","a","non-square","matrix","and","check","the","resulting","unitary","matrix",":",">",">",">","A","=","[","[","0.2",",","0",",","0.2","]",",","[","-0.2",",","0.2",",","0","]","]",">",">",">","op","=","qml.BlockEncode","(","A",",","wires=range","(","3",")",")",">",">",">","print","(","np.round","(","qml.matrix","(","op",")",",","2",")",")","[","[","0.2","0",".","0.2","0.96","0.02","0",".","0",".","0",".","]","[","-0.2","0.2","0",".","0.02","0.96","0",".","0",".","0",".","]","[","0.96","0.02","-0.02","-0.2","0.2","0",".","0",".","0",".","]","[","0.02","0.98","0",".","-0",".","-0.2","0",".","0",".","0",".","]","[","-0.02","0",".","0.98","-0.2","-0",".","0",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","1",".","0",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","1",".","0",".","]","[","0",".","0",".","0",".","0",".","0",".","0",".","0",".","1",".","]","]","..","note",":",":","If","the","operator","norm","of",":","math",":","`","A","`","is","greater","than","1",",","we","normalize","it","to","ensure",":","math",":","`","U","(","A",")","`","is","unitary",".","The","normalization","constant","can","be","accessed","through",":","code",":","`","op.hyperparameters","[","``","norm","''","]","`",".","Specifically",",","the","norm","is","computed","as","the","maximum","of",":","math",":","`","\\|","AA^\\dagger","\\|","`","and",":","math",":","`","\\|","A^\\dagger","A","\\|","`","."]
code: def _flatten(self):
      return self.data, (self.wires, ())
  
imports: import warnings
  from itertools import product
  import numpy
  from scipy.linalg import fractional_matrix_power
  from pennylane.math import norm, cast, eye, zeros, transpose, conj, sqrt, sqrt_matrix
  from pennylane import numpy
  import pennylane
  from pennylane.operation import AnyWires, DecompositionUndefinedError, Operation
  from pennylane.wires import Wires
label_desc: Use image node_id 2 for calling the BlockEncode obj's underlying member method code with example usage: obj._flatten() and returns: self,  self,  