47 static const std::vector<size_t> dims{2, 2};
48 auto tensor = std::make_shared<Utils::Tensor<>>(dims);
50 std::vector<size_t> indices{0, 0};
51 (*tensor)(indices) = onZero ? 1. : 0.;
53 (*tensor)(indices) = 0;
55 (*tensor)(indices) = onZero ? 0. : 1.;
57 (*tensor)(indices) = 0;
64 static const std::vector<size_t> dims{2};
65 auto tensor = std::make_shared<Utils::Tensor<>>(dims);
67 std::vector<size_t> indices{0};
68 (*tensor)(indices) = 1.0;
70 (*tensor)(indices) = 0.0;
77 static const std::vector<size_t> dims{2};
78 auto tensor = std::make_shared<Utils::Tensor<>>(dims);
80 std::vector<size_t> indices{0};
81 (*tensor)(indices) = 0.0;
83 (*tensor)(indices) = 1.0;
90 static const std::vector<size_t> dims{2, 2};
91 auto tensor = std::make_shared<Utils::Tensor<>>(dims);
93 const MatrixClass &mat = gate.getRawOperatorMatrix();
95 std::vector<size_t> indices{0, 0};
96 (*tensor)(indices) = mat(0, 0);
98 (*tensor)(indices) = mat(1, 0);
100 (*tensor)(indices) = mat(1, 1);
102 (*tensor)(indices) = mat(0, 1);
109 static const std::vector<size_t> dims{2, 2, 2, 2};
110 auto tensor = std::make_shared<Utils::Tensor<>>(dims);
112 const MatrixClass &mat = gate.getRawOperatorMatrix();
114 std::vector<size_t> indices;
118 for (
int q0l = 0; q0l < 2; ++q0l)
120 const int l0 = q0l << 1;
122 for (
int q0c = 0; q0c < 2; ++q0c)
125 const int c0 = q0c << 1;
126 for (
int q1l = 0; q1l < 2; ++q1l)
129 for (
int q1c = 0; q1c < 2; ++q1c)
132 (*tensor)(indices) = mat(l0 | q1l, c0 | q1c);