C
Qul::PlatformInterface::GenericMatrix Struct
template <int M, int N, typename T> struct Qul::PlatformInterface::GenericMatrixGenericMatrix クラスは、行列を表すテンプレートクラスです。詳細...
| Header: | #include <platforminterface/genericmatrix.h> |
| Since: | Qt Quick Ultralite (Platform) 1.7 |
| Inherited By: |
パブリック型
| enum | Initialization { Uninitialized, ZeroInitialized, Identity } |
パブリック関数
| 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 |
関連する非メンバー
| 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) |
詳細な説明
GenericMatrix クラスは、行列を表すテンプレートクラスです。正方行列については、テンプレートの特化によっていくつかの追加メソッドが提供されています。
GenericMatrix テンプレートには 3 つのパラメータがあります:
| M | 列の数。 |
| N | 行数。 |
| T | そのクラスのユーザーに表示される要素の型。 |
T は以下の条件を満たす必要があります:
- 単純にコピー可能であること。
- デフォルトコンストラクタが定義されていること。
- 整数によるコンストラクタが定義されていること。
例:
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);メンバ型のドキュメント
enum GenericMatrix::Initialization
この列挙型は、行列の初期化ポリシーに使用されます。
| 定数 | 値 | 説明 |
|---|---|---|
Qul::PlatformInterface::GenericMatrix::Uninitialized | 0 | 内容を初期化せずに行列を構築します。 |
Qul::PlatformInterface::GenericMatrix::ZeroInitialized | 1 | 行列の内容はゼロで初期化されます。 |
Qul::PlatformInterface::GenericMatrix::Identity | 2 | 行列の内容は単位行列に設定されます。この列挙型は、正方行列でのみ使用可能です。 |
メンバ関数のドキュメント
GenericMatrix::GenericMatrix()
値をゼロで初期化した行列を作成します。
[explicit] GenericMatrix::GenericMatrix(Qul::PlatformInterface::GenericMatrix<type-parameter-0-2>::Initialization initialization)
initialization ポリシーに従って、行列を作成し、値を設定します。
[explicit] GenericMatrix::GenericMatrix(const T *values)
指定された M × N のvalues から行列を構築します。values 配列の内容は、行優先順序で格納されているものとみなされます。
T *GenericMatrix::data()
この行列の生データへのポインタを返します。
const T *GenericMatrix::data() const
この行列の生データへの定数ポインタを返します。
bool GenericMatrix::isIdentity() const
この行列が単位行列である場合は `true ` を返し、それ以外の場合は `false ` を返します。
注:この メソッドは正方行列でのみ利用可能です。
setToIdentity()も参照してください 。
void GenericMatrix::setToIdentity()
この行列を単位行列に設定します。
注:この メソッドは正方行列でのみ利用可能です。
isIdentity()も参照してください 。
bool GenericMatrix::operator!=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
この行列が `other` と同一でない場合は `true ` を返し、同一である場合は `false ` を返します。
T &GenericMatrix::operator()(int row, int column)
この行列の (row,column) の位置にある要素への参照を返し、その要素に値を代入できるようにします。
const T &GenericMatrix::operator()(int row, int column) const
この行列の (row,column) の位置にある要素への定数参照を返します。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(T factor)
この行列のすべての要素にスカラーfactor を乗算します。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator*=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
この行列のすべての要素に、other 行列を乗算します。
注:この メソッドは正方行列でのみ利用可能です。
Qul::PlatformInterface::GenericMatrix<M, N, T> &GenericMatrix::operator+=(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other)
other の内容をこの行列に加算します。
bool GenericMatrix::operator==(const Qul::PlatformInterface::GenericMatrix<M, N, T> &other) const
この行列が `other` と同一であれば `true ` を返し、そうでない場合は `false ` を返します。
関連する非メンバー
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)
matrix のすべての要素とスカラー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)
m1 と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)
m1 とm2 の合計を返します。
特定の Qt ライセンスの下で利用可能です。
詳細はこちら。