///|
/// Apply a local kernel on one control block and identity on the others.
pub(all) struct ControlledKernel {
  inner : &UnitaryKernel
  size : Int32
  offset : Int32
}

///|
pub impl LinearKernel for ControlledKernel with fn size(self) -> Int32 {
  self.size
}

///|
pub impl LinearKernel for ControlledKernel with fn apply(self, args) -> Unit {
  for i in 0.. &UnitaryKernel {
  ControlledKernel::{
    inner: self.inner.adjoint(),
    size: self.size,
    offset: self.offset,
  }
}

///|
pub extend ControlledKernel with LinearKernel::{size, apply}

///|
pub extend ControlledKernel with UnitaryKernel::{adjoint}