#include <fixed_2D.h>
Public Types | |
enum | { array_rows = Rows, array_cols = Cols } |
typedef fixed_1D< Element, Cols > | col_array_type |
typedef const Element * | const_pointer |
typedef const Element & | const_reference |
typedef twod_tag | dimension_tag |
typedef fixed< Rows, Cols > | generator_type |
typedef Layout | layout |
typedef fixed_memory_tag | memory_tag |
typedef Element * | pointer |
typedef Element & | reference |
typedef not_resizable_tag | resizing_tag |
typedef fixed_1D< Element, Rows > | row_array_type |
typedef fixed_size_tag | size_tag |
typedef fixed_2D< Element, Cols, Rows, Layout > | transposed_type |
typedef Element | value_type |
Public Member Functions | |
CML_STATIC_REQUIRE_M ((same_type< Layout, row_major >::is_true||same_type< Layout, col_major >::is_true), invalid_layout_type_error) | |
CML_STATIC_REQUIRE_M ((Rows > 0)&&(Cols > 0), negative_array_size_error) | |
size_t | cols () const |
Return the number of cols in the array. | |
const_pointer | data () const |
Return access to the data as a raw pointer. | |
pointer | data () |
Return access to the data as a raw pointer. | |
fixed_2D () | |
const_reference | operator() (size_t row, size_t col) const |
Const access element (row,col) of the matrix. | |
reference | operator() (size_t row, size_t col) |
Access element (row,col) of the matrix. | |
size_t | rows () const |
Return the number of rows in the array. | |
Protected Types | |
typedef select_switch< Layout, row_major, row_major_array, col_major, col_major_array > ::result | array_data |
typedef Element | col_major_array [Cols][Rows] |
typedef Element | row_major_array [Rows][Cols] |
Protected Member Functions | |
const_reference | get_element (size_t row, size_t col, col_major) const |
reference | get_element (size_t row, size_t col, col_major) |
const_reference | get_element (size_t row, size_t col, row_major) const |
reference | get_element (size_t row, size_t col, row_major) |
Protected Attributes | |
array_data | m_data |
This uses an internal class to setup the data matrix with the proper layout. The alternative is to use a 1D array with size Rows*Cols and a multiplication to dereference an element, but it seems that compilers better optimize 2D array dereferences. This is different from dynamic_2D<>, which must use the 1D array method.
It's also possible to do this with a pointer to an array of values (e.g. a double*), whether or not it was actually declared as a fixed C array. This is HIGHLY DISCOURAGED, though, since it's relatively straightforward to implement a separate class to take a C array (or pointer) and turn it into an array object.
Definition at line 61 of file fixed_2D.h.
typedef select_switch< Layout, row_major, row_major_array, col_major, col_major_array >::result cml::fixed_2D< Element, Rows, Cols, Layout >::array_data [protected] |
Definition at line 193 of file fixed_2D.h.
typedef fixed_1D<Element,Cols> cml::fixed_2D< Element, Rows, Cols, Layout >::col_array_type |
Definition at line 107 of file fixed_2D.h.
typedef Element cml::fixed_2D< Element, Rows, Cols, Layout >::col_major_array[Cols][Rows] [protected] |
Definition at line 187 of file fixed_2D.h.
typedef const Element* cml::fixed_2D< Element, Rows, Cols, Layout >::const_pointer |
Definition at line 85 of file fixed_2D.h.
typedef const Element& cml::fixed_2D< Element, Rows, Cols, Layout >::const_reference |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 84 of file fixed_2D.h.
typedef twod_tag cml::fixed_2D< Element, Rows, Cols, Layout >::dimension_tag |
Definition at line 100 of file fixed_2D.h.
typedef fixed<Rows,Cols> cml::fixed_2D< Element, Rows, Cols, Layout >::generator_type |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 78 of file fixed_2D.h.
typedef Layout cml::fixed_2D< Element, Rows, Cols, Layout >::layout |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 88 of file fixed_2D.h.
typedef fixed_memory_tag cml::fixed_2D< Element, Rows, Cols, Layout >::memory_tag |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 91 of file fixed_2D.h.
typedef Element* cml::fixed_2D< Element, Rows, Cols, Layout >::pointer |
Definition at line 82 of file fixed_2D.h.
typedef Element& cml::fixed_2D< Element, Rows, Cols, Layout >::reference |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 83 of file fixed_2D.h.
typedef not_resizable_tag cml::fixed_2D< Element, Rows, Cols, Layout >::resizing_tag |
Definition at line 97 of file fixed_2D.h.
typedef fixed_1D<Element,Rows> cml::fixed_2D< Element, Rows, Cols, Layout >::row_array_type |
Definition at line 106 of file fixed_2D.h.
typedef Element cml::fixed_2D< Element, Rows, Cols, Layout >::row_major_array[Rows][Cols] [protected] |
Definition at line 186 of file fixed_2D.h.
typedef fixed_size_tag cml::fixed_2D< Element, Rows, Cols, Layout >::size_tag |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 94 of file fixed_2D.h.
typedef fixed_2D<Element,Cols,Rows,Layout> cml::fixed_2D< Element, Rows, Cols, Layout >::transposed_type |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 103 of file fixed_2D.h.
typedef Element cml::fixed_2D< Element, Rows, Cols, Layout >::value_type |
Reimplemented in cml::matrix< Element, fixed< Rows, Cols >, BasisOrient, Layout >.
Definition at line 81 of file fixed_2D.h.
anonymous enum |
cml::fixed_2D< Element, Rows, Cols, Layout >::fixed_2D | ( | ) | [inline] |
Definition at line 161 of file fixed_2D.h.
cml::fixed_2D< Element, Rows, Cols, Layout >::CML_STATIC_REQUIRE_M | ( | (same_type< Layout, row_major >::is_true||same_type< Layout, col_major >::is_true) | , | |
invalid_layout_type_error | ||||
) |
cml::fixed_2D< Element, Rows, Cols, Layout >::CML_STATIC_REQUIRE_M | ( | (Rows > 0)&&(Cols > 0) | , | |
negative_array_size_error | ||||
) |
size_t cml::fixed_2D< Element, Rows, Cols, Layout >::cols | ( | ) | const [inline] |
const_pointer cml::fixed_2D< Element, Rows, Cols, Layout >::data | ( | ) | const [inline] |
pointer cml::fixed_2D< Element, Rows, Cols, Layout >::data | ( | ) | [inline] |
const_reference cml::fixed_2D< Element, Rows, Cols, Layout >::get_element | ( | size_t | row, | |
size_t | col, | |||
col_major | ||||
) | const [inline, protected] |
Definition at line 178 of file fixed_2D.h.
reference cml::fixed_2D< Element, Rows, Cols, Layout >::get_element | ( | size_t | row, | |
size_t | col, | |||
col_major | ||||
) | [inline, protected] |
Definition at line 174 of file fixed_2D.h.
const_reference cml::fixed_2D< Element, Rows, Cols, Layout >::get_element | ( | size_t | row, | |
size_t | col, | |||
row_major | ||||
) | const [inline, protected] |
Definition at line 170 of file fixed_2D.h.
reference cml::fixed_2D< Element, Rows, Cols, Layout >::get_element | ( | size_t | row, | |
size_t | col, | |||
row_major | ||||
) | [inline, protected] |
Definition at line 166 of file fixed_2D.h.
Referenced by cml::fixed_2D< Element, Rows, Cols, Layout >::operator()().
const_reference cml::fixed_2D< Element, Rows, Cols, Layout >::operator() | ( | size_t | row, | |
size_t | col | |||
) | const [inline] |
Const access element (row,col) of the matrix.
row | row of element. | |
col | column of element. |
Definition at line 147 of file fixed_2D.h.
reference cml::fixed_2D< Element, Rows, Cols, Layout >::operator() | ( | size_t | row, | |
size_t | col | |||
) | [inline] |
Access element (row,col) of the matrix.
row | row of element. | |
col | column of element. |
Definition at line 134 of file fixed_2D.h.
size_t cml::fixed_2D< Element, Rows, Cols, Layout >::rows | ( | ) | const [inline] |
array_data cml::fixed_2D< Element, Rows, Cols, Layout >::m_data [protected] |
Definition at line 196 of file fixed_2D.h.
Referenced by cml::fixed_2D< Element, Rows, Cols, Layout >::data(), and cml::fixed_2D< Element, Rows, Cols, Layout >::get_element().