C
Qul::PlatformInterface::GenericMatrix Struct
template <int M, int N, typename T> struct Qul::PlatformInterface::GenericMatrixThe GenericMatrix class is a template class representing a matrix. More...
Header: | #include <platforminterface/genericmatrix.h> |
Since: | Qt Quick Ultralite (Platform) 1.7 |
Inherited By: |
Public Types
enum | Initialization { Uninitialized, ZeroInitialized, Identity } |
Public Functions
GenericMatrix() | |
GenericMatrix(Qul::PlatformInterface::GenericMatrix<type-parameter-0-2>::Initialization initialization) | |
GenericMatrix(const T *values) | |
T * | data() |
const T * | data() const |
bool | isIdentity() const |
void | setToIdentity() |
bool | operator!=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const |
T & | operator()(int row, int column) |
const T & | operator()(int row, int column) const |
Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator*=(T factor) |
Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator*=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) |
Qul::PlatformInterface::GenericMatrix<M, N, T> & | operator+=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) |
bool | operator==(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const |
Related Non-Members
Qul::PlatformInterface::GenericMatrix<M, N, T2> | operator*(T1 factor, const Qul::PlatformInterface::GenericMatrix<M, N, T2> &matrix) |
Qul::PlatformInterface::GenericMatrix<M, N2, T> | operator*(const Qul::PlatformInterface::GenericMatrix<M, N1, T> &m1, const Qul::PlatformInterface::GenericMatrix<N1, N2, T> &m2) |
Qul::PlatformInterface::GenericMatrix<M, N, T> | operator+(const Qul::PlatformInterface::GenericMatrix<M, N, T> &m1, const Qul::PlatformInterface::GenericMatrix<M, N, T> &m2) |
Detailed Description
The GenericMatrix class is a template class representing a matrix. For square matrices, few additinal methods are provided by template specialization.
The GenericMatrix template has three parameters:
M | Number of columns. |
N | Number of rows. |
T | Element type that is visible to users of the class. |
The T must be:
- Trivially copyable.
- Default constructible.
- Integer constructible.
Examples:
using Qul::PlatformInterface::GenericMatrix; // Specializes a square matrix. using Matrix5x5 = GenericMatrix<5, 5, float>; Matrix5x5 m(Matrix5x5::Identity); m.isIdentity(); // Specializes a rectangular matrix. using Matrix2x3 = GenericMatrix<2, 3, float>; Matrix2x3 m2(Matrix2x3::Uninitialized);
Member Type Documentation
enum GenericMatrix::Initialization
This enum type is used for matrix initialization policy.
Constant | Value | Description |
---|---|---|
Qul::PlatformInterface::GenericMatrix::Uninitialized | 0 | Constructs a matrix without initializing the contents. |
Qul::PlatformInterface::GenericMatrix::ZeroInitialized | 1 | Matrix content is zero initialized. |
Qul::PlatformInterface::GenericMatrix::Identity | 2 | Matrix content is set to the identity matrix. This enum is available only for square matrices. |
Member Function Documentation
GenericMatrix::GenericMatrix()
Constructs matrix with zero-initialized values.
[explicit]
GenericMatrix::GenericMatrix(Qul::PlatformInterface::GenericMatrix<type-parameter-0-2>::Initialization initialization)
Constructs matrix and sets values according to initialization policy.
[explicit]
GenericMatrix::GenericMatrix(const T *values)
Constructs a matrix from the given M * N values. The contents of the values array are assumed to be in row-major order.
T *GenericMatrix::data()
Returns a pointer to the raw data of this matrix.
const T *GenericMatrix::data() const
Returns a constant pointer to the raw data of this matrix.
bool GenericMatrix::isIdentity() const
Returns true
if this matrix is the identity, returns false
otherwise.
Note: This method is available only for square matrices.
See also setToIdentity().
void GenericMatrix::setToIdentity()
Sets this matrix to the identity.
Note: This method is available only for square matrices.
See also isIdentity().
bool GenericMatrix::operator!=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
Returns true
if this matrix is not identical to other, returns false
otherwise.
T &GenericMatrix::operator()(int row, int column)
Returns a reference to the element at position (row, column) in this matrix, so that the element can be assigned to.
const T &GenericMatrix::operator()(int row, int column) const
Returns a constant reference to the element at position (row, column) in this matrix.
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(T factor)
Multiplies all elements of this matrix by scalar factor.
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
Multiplies all elements of this matrix with other matrix.
Note: This method is available only for square matrices.
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator+=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
Adds the contents of other to this matrix.
bool GenericMatrix::operator==(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
Returns true
if this matrix is identical to other, returns false
otherwise.
Related Non-Members
template <int M, int N, typename T1, typename T2> Qul::PlatformInterface::GenericMatrix<M, N, T2> operator*(T1 factor, const Qul::PlatformInterface::GenericMatrix<M, N, T2> &matrix)
Returns the result of multiplying all elements of matrix by scalar factor.
template <int M, int N1, int N2, typename T> Qul::PlatformInterface::GenericMatrix<M, N2, T> operator*(const Qul::PlatformInterface::GenericMatrix<M, N1, T> &m1, const Qul::PlatformInterface::GenericMatrix<N1, N2, T> &m2)
Returns the result of multiplying all elements of m1 and m2.
template <int M, int N, typename T> Qul::PlatformInterface::GenericMatrix<M, N, T> operator+(const Qul::PlatformInterface::GenericMatrix<M, N, T> &m1, const Qul::PlatformInterface::GenericMatrix<M, N, T> &m2)
Returns the sum of m1 and m2.
Available under certain Qt licenses.
Find out more.