Matrix | ( | const std::vector< value_t, alloc_t > & | v, |
typename std::vector< value_t, alloc_t >::size_type | cColumns, | ||
typename std::vector< value_t, alloc_t >::size_type | cRows, | ||
interpretation_t | vector_interpretation, | ||
const allocator_type & | alloc = allocator_type() |
||
) |
Creates a matrix from an std::vector of elements copied to the constructed matrix as a set of rows or as a set of columns depending on the interpretation mark.
value_t | is a type of elements of the input vector to be explicitly converted into value_type . |
alloc_t | is a type of an allocator object used by the vector specified as the input parameter. |
interpretation_t | is a type of the vector_interpretation parameter denoting a way to copy the data elements into the matrix. |
v | is an std::vector<value_t ,alloc_t> set of elements to be explicitly converted to elements of the value_type type and stored within the internal storage of the matrix created with respect to other parameters. The input vector must contain at least a number of elements that is determined as a product of a number of columns and a number of rows, both of which are specified parametrically. This product defines a number of elements that will be read from the vector and copied to the internal storage. |
cColumns | is a number of columns in the created matrix. |
cRows | is a number of rows in the created matrix. |
vector_interpretation | is an interpretation mark which is set to either interpret_array_as_matrix_rows_set to specify that the input vector specifies a set of adjacent rows, or interpret_array_as_matrix_columns_set to interpret the vector as a set of adjacent columns. |
alloc | is an allocator object used to manage storage of the matrix elements. |
Example code:
Chusov::Exceptions::InvalidParameterException | The values of cColumns and cRows do not correspond to a size of the input vector v (i.e. size of the vector is less than a result of multiplication of cColumns and cRows ). |