libqasm
library for handling cQASM files
|
Two-dimensional matrix of some kind of type. More...
Public Member Functions | |
Matrix () | |
Creates an empty matrix. More... | |
Matrix (size_t ncols) | |
Creates a vector. More... | |
Matrix (size_t nrows, size_t ncols) | |
Creates a zero-initialized matrix of the given size. More... | |
Matrix (const std::vector< T > &data) | |
Creates a column vector with the given data. More... | |
Matrix (const std::vector< T > &data, size_t ncols) | |
Creates a matrix with the given data. More... | |
size_t | size_rows () const |
Returns the number of rows. More... | |
size_t | size_cols () const |
Returns the number of columns. More... | |
const std::vector< T > & | get_data () const |
Returns access to the raw data vector. More... | |
T | at (size_t row, size_t col) const |
Returns the value at the given position. More... | |
T & | at (size_t row, size_t col) |
Returns a mutable reference to the value at the given position. More... | |
bool | operator== (const Matrix< T > &rhs) const |
Equality operator for matrices. More... | |
bool | operator!= (const Matrix< T > &rhs) const |
Inequality operator for matrices. More... | |
Two-dimensional matrix of some kind of type.
Definition at line 113 of file cqasm-v1-primitives.hpp.
#include <cqasm-v1-primitives.hpp>
|
inline |
Creates an empty matrix.
Definition at line 122 of file cqasm-v1-primitives.hpp.
|
inline |
Creates a vector.
Definition at line 129 of file cqasm-v1-primitives.hpp.
|
inline |
Creates a zero-initialized matrix of the given size.
Definition at line 136 of file cqasm-v1-primitives.hpp.
|
inline |
Creates a column vector with the given data.
Definition at line 143 of file cqasm-v1-primitives.hpp.
|
inline |
Creates a matrix with the given data.
The number of rows is inferred. If the number of data elements is not divisible by the number of columns, a range error is thrown.
Definition at line 152 of file cqasm-v1-primitives.hpp.
|
inline |
Returns the number of rows.
Definition at line 163 of file cqasm-v1-primitives.hpp.
|
inline |
Returns the number of columns.
Definition at line 170 of file cqasm-v1-primitives.hpp.
|
inline |
Returns access to the raw data vector.
Definition at line 177 of file cqasm-v1-primitives.hpp.
|
inline |
Returns the value at the given position.
row and col start at 1. Throws a std::range_error when either or both indices are out of range.
Definition at line 185 of file cqasm-v1-primitives.hpp.
|
inline |
Returns a mutable reference to the value at the given position.
row and col start at 1. Throws a std::range_error when either or both indices are out of range.
Definition at line 197 of file cqasm-v1-primitives.hpp.
|
inline |
Equality operator for matrices.
Definition at line 207 of file cqasm-v1-primitives.hpp.
|
inline |
Inequality operator for matrices.
Definition at line 214 of file cqasm-v1-primitives.hpp.