INNER CODE UNIT · C++
scale
aromanro/QCSim · QCSim/DensityMatrixTests.cpp:60
const double scale = 1. / std::sqrt(static_cast<double>(dimension));
for (Eigen::Index row = 0; row < dimension; ++row)
for (Eigen::Index col = 0; col < dimension; ++col)
fourier(row, col) =
scale * std::polar(1., 2. * M_PI * static_cast<double>(row * col) / static_cast<double>(dimension));
return fourier;
}
static void DM_FillThreeQubitGates(std::vector<std::shared_ptr<QC::Gates::QuantumGateWithOp<>>> &gates)
{
gates.emplace_back(std::make_shared<QC::Gates::ToffoliGate<>>());
gates.emplace_back(std::make_shared<QC::Gates::FredkinGate<>>());
gates.emplace_back(std::make_shared<QC::Gates::CCZGate<>>());
// A dense complex gate exercises the generic three-qubit kernel rather than a specialized path.
gates.emplace_back(std::make_shared<QC::Gates::ThreeQubitsGate<>>(DM_FourierMatrix(8)));
}