chsvlib
chsv helper source code

◆ operator+()

Matrix<common_value, common_allocator, void, common_policy> Chusov::Math::operator+ ( const Matrix< val1_t, alloc1_t, der1_t, policy1_t > &  left,
const Matrix< val2_t, alloc2_t, der2_t, policy2_t > &  right 
)

Adds up two matrices.

Template Parameters
val1_tis a type of an element of the left matrix.
alloc1_tis a type of an allocator used by the left operand.
der1_tis a derived type of the first operand. See Matrix::derived_type.
policy1_tis an execution policy of the first operand.
val2_tis a type of an element of the right matrix.
alloc2_tis a type of an allocator used by the right operand. It must match the first allocator so that
std::is_same<alloc_1, std::allocator_traits<alloc2>::template rebind_alloc<val1_t>>::value;
is true.
der2_tis a derived type of the second operand. See Matrix::derived_type.
policy2_tis an execution policy of the second operand.
Parameters
leftis a reference to the left operand.
rightis a reference to the right operand.
Returns
A new matrix which is a sum of the operands. The elements of the resulting matrix type are defines as follows:
- A type of an element is determined by the [std::common_type](http://en.cppreference.com/w/cpp/types/common_type) metafunction.
- A type of allocator is determined by the [std::allocator_traits<alloc1_t>::rebind_alloc](http://en.cppreference.com/w/cpp/memory/allocator_traits)
  for the resulting type of elements.
- The implementing matrix type is \p void (i.e. the implementor of the result is the \re Matrix class).
- An execution policy is determined by the \ref Chusov::Math::common_policy "common_policy" metafunction.
Remarks
The operation is defined only when a common type of the resulting matrix meets the requirements of the additive group concept.
Exceptions
Chusov::Exceptions::InvalidParameterExceptionDimensions of the matrices do not match.
Examples
chsvmath\algebraic_traits.cpp.