Imported Upstream version 3.1.9
[platform/upstream/Imath.git] / docs / classes / Matrix44.rst
1 ..
2   SPDX-License-Identifier: BSD-3-Clause
3   Copyright Contributors to the OpenEXR Project.
4
5 Matrix44
6 ########
7
8 .. code-block::
9
10    #include <Imath/ImathMatrix.h>
11    
12 The ``Matrix44`` class template represents a 4x4 matrix, with
13 predefined typedefs for ``float`` and ``double``.
14
15 There are also various utility functions that operate on matrices
16 defined in ``ImathMatrixAlgo.h`` and described in :ref:`Matrix
17 Functions <matrix-functions>`.
18
19 Individual components of a matrix ``M`` may be referenced as either
20 ``M[j][i]`` or ``M.x[j][i]``. While the latter is a little awkward, it has an
21 advantage when used in loops that may be auto-vectorized or explicitly
22 vectorized by ``#pragma omp simd`` or other such hints, because the function
23 call and pointer casting of ``operator[]`` can confuse the compiler just
24 enough to prevent vectorization of the loop, whereas directly addressing the
25 real underlying array (``M.x[j][i]``) does not.
26
27 Example:
28
29 .. literalinclude:: ../examples/Matrix44.cpp
30    :language: c++
31                
32 .. doxygentypedef:: M44f
33
34 .. doxygentypedef:: M44d
35
36 .. doxygenclass:: Imath::Matrix44
37    :undoc-members:
38    :members:
39
40 .. doxygenfunction:: operator<<(std::ostream& s, const Matrix44<T>& m)
41