Commit ec9fb516 authored by Davis King's avatar Davis King

Added a function to the gate_exp() to return a matrix object for the gate.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402693
parent dae75ab8
...@@ -272,6 +272,19 @@ namespace dlib ...@@ -272,6 +272,19 @@ namespace dlib
const qc_scalar_type operator() (long r, long c) const { return exp(r,c); } const qc_scalar_type operator() (long r, long c) const { return exp(r,c); }
const matrix<qc_scalar_type> mat (
) const
{
matrix<qc_scalar_type,dims,dims> m;
for (long r = 0; r < m.nr(); ++r)
{
for (long c = 0; c < m.nc(); ++c)
{
m(r,c) = exp(r,c);
}
}
return m;
}
void apply_gate_to (quantum_register& reg) const void apply_gate_to (quantum_register& reg) const
{ {
......
...@@ -255,6 +255,12 @@ namespace dlib ...@@ -255,6 +255,12 @@ namespace dlib
- returns a reference to the subexpression contained in this object - returns a reference to the subexpression contained in this object
!*/ !*/
const matrix<qc_scalar_type> mat (
) const;
/*!
ensures
- returns a dense matrix object that contains the matrix for this gate
!*/
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment