chsvlib
chsv helper source code

◆ Matrix() [15/16]

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,
const allocator_type alloc = allocator_type() 
)

Creates a matrix from a set of its elements given by an std::vector object.

Template Parameters
value_tis a type of elements of the input vector to be explicitly converted into value_type.
alloc_tis a type of an allocator object used by the vector specified as the input parameter.
Parameters
vis 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 to be created with respect to other parameters. It is assumed that input buffer stores elements row-by-row with first cColumns elements of the vector to be elements of the first row of the matrix, the next cColumns elements are to be elements of the second row and so on. Hence, the input vector must contain at least a number of elements that is determined as a multiple of a number of columns and a number of rows, both of which are specified parametrically. This number of elements will be read from the vector and copied to the internal storage.
cColumnsis a number of columns in the created matrix.
cRowsis a number of rows in the created matrix.
allocis an allocator object used to manage storage of the matrix elements.
Exceptions
Chusov::Exceptions::InvalidParameterExceptionThe 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).
See also
template <class value_t, class alloc_t> Matrix(const std::vector<value_t, alloc_t>& v, const allocator_type& alloc = allocator_type());
  • creates a matrix from an std::vector which is considered as a one dimensional algebraic vector.