| 355 | |
| 356 | |
| 357 | qmatrix getExponentialOfNormalisedPauliVector(qreal arg, qreal x, qreal y, qreal z) { |
| 358 | |
| 359 | // exp(-arg/2 i [x^ X + y^ Y + z^ Z]) |
| 360 | qreal n = std::sqrt(x*x + y*y + z*z); |
| 361 | x /= n; |
| 362 | y /= n; |
| 363 | z /= n; |
| 364 | |
| 365 | qmatrix id = getIdentityMatrix(2); |
| 366 | qmatrix out = std::cos(arg/2)*id - 1_i*std::sin(arg/2)*( |
| 367 | x * getPauliMatrix(1) + |
| 368 | y * getPauliMatrix(2) + |
| 369 | z * getPauliMatrix(3)); |
| 370 | |
| 371 | return out; |
| 372 | } |
| 373 | |
| 374 | |
| 375 | qmatrix getOrthonormalisedRows(qmatrix matr) { |
no test coverage detected