chsvlib
chsv helper source code

◆ Matrix() [6/16]

Matrix ( std::initializer_list< std::initializer_list< value_type >>  lst,
const allocator_type alloc = allocator_type() 
)

Creates a matrix from an initializer list of rows which, in turn, are also specified using initializer list mechanism with elements of a type convertible to value_type.

Parameters
lstis an initializer list of initializer lists of row elements.
allocis an allocator object used to manage storage of the matrix elements. Example code:
#include <iostream>
#include <iomanip>
template <class value_t, class alloc_t, class derived_t, class policy_t>
std::ostream& operator<<(std::ostream& os, const Chusov::Math::Matrix<value_t, alloc_t, derived_t, policy_t>& m)
{
for (std::size_t iRow = 0; iRow < m.Rows(); ++iRow)
{
os << '[';
for (auto& c:m)
{
os << ' ' << std::setw(3) << c[iRow];
}
os << "]\n";
}
return os;
}
int main(int, char**)
{
{
{1, 2, 3, 4},
{4, 3, 2, 1}
};
std::cout << m;
return 0;
}
mathematical and arithmetical functions mostly over integer operands.
A class template for matrices of elements of various types and semantics, including types which do no...
Definition: chsvmath.h:6374
size_type Rows() const
Returns a number of rows in the current matrix.
Exceptions
Chusov::Exceptions::InvalidParameterExceptionSizes of the nested lists of elements are not consistent with each other.