The Quantum Exact Simulation Toolkit v4.0.0
Loading...
Searching...
No Matches
qmatrix.hpp
1/** @file
2 * @author Tyson Jones
3 *
4 * @defgroup testutilsqmatrix qmatrix
5 * @ingroup testutils
6 * @brief
7 * Testing utilities which define 'qmatrix', used
8 * to perform reference complex matrix algebra, and
9 * as a reference proxy to a quantum density matrix.
10 * @{
11 */
12
13#ifndef QMATRIX_HPP
14#define QMATRIX_HPP
15
16#include "quest/include/quest.h"
17#include "qvector.hpp"
18
19#include <vector>
20using std::vector;
21
22
23typedef vector<vector<qcomp>> qmatrix;
24
25
26qmatrix getZeroMatrix(size_t dim);
27qmatrix getConstantMatrix(size_t dim, qcomp elem);
28qmatrix getIdentityMatrix(size_t dim);
29qmatrix getDiagonalMatrix(qvector v);
30qmatrix getPauliMatrix(int id);
31
32qmatrix operator * (const qcomp&, const qmatrix& );
33qmatrix operator * (const qmatrix&, const qcomp&);
34qmatrix operator * (const qreal&, const qmatrix&);
35qmatrix operator * (const qmatrix&, const qreal&);
36qmatrix operator *= (qmatrix&, const qcomp&);
37qmatrix operator *= (qmatrix&, const qreal&);
38
39qmatrix operator / (const qmatrix&, const qcomp&);
40qmatrix operator / (const qmatrix&, const qreal&) ;
41qmatrix operator /= (qmatrix&, const qcomp&);
42qmatrix operator /= (qmatrix&, const qreal&);
43
44qmatrix operator + (const qmatrix&, const qmatrix&);
45qmatrix operator += (qmatrix&, const qmatrix&);
46
47qmatrix operator - (const qmatrix&, const qmatrix&);
48qmatrix operator -= (qmatrix&, const qmatrix&);
49
50qmatrix operator * (const qmatrix&, const qmatrix&);
51qmatrix operator *= (qmatrix&, const qmatrix&);
52
53void setSubMatrix(qmatrix &dest, qmatrix sub, size_t r, size_t c);
54void setSubMatrix(qmatrix &dest, qvector sub, size_t flatInd);
55void setToDebugState(qmatrix &m);
56
57qvector getDiagonals(qmatrix m);
58
59
60#endif // QMATRIX_HPP
61
62/** @} (end defgroup) */
qmatrix getIdentityMatrix(size_t dim)
Definition qmatrix.cpp:30
void setSubMatrix(qmatrix &dest, qmatrix sub, size_t r, size_t c)
Definition qmatrix.cpp:203
qmatrix getZeroMatrix(size_t dim)
Definition qmatrix.cpp:18