Blaze 3.9
blaze::SchurTrait< T1, T2, typename > Struct Template Reference

Base template for the SchurTrait class. More...

#include <SchurTrait.h>

Inherits decltype evalSchurTrait std::declval< T1 & >, and std::declval< T2 & >.

Detailed Description

template<typename T1, typename T2, typename>
struct blaze::SchurTrait< T1, T2, typename >

Base template for the SchurTrait class.

General

The SchurTrait class template offers the possibility to select the resulting data type of a generic Schur product operation between the two given types T1 and T2. SchurTrait defines the nested type Type, which represents the resulting data type of the Schur product. In case T1 and T2 cannot be combined in a Schur product, there is no nested type Type. Note that const and volatile qualifiers and reference modifiers are generally ignored.


Creating custom specializations

Per default, SchurTrait supports all matrix types of the Blaze library (including views and adaptors). For all other data types it is possible to specialize the SchurTrait template. The following example shows the according specialization for the Schur product between two static matrices with equal storage order:

template< typename T1, size_t M, size_t N, bool SO, typename T2 >
struct SchurTrait< StaticMatrix<T1,M,N,SO>, StaticMatrix<T2,M,N,SO> >
{
using Type = StaticMatrix< MultTrait_t<T1,T2>, M, N, SO >;
};


Examples

The following example demonstrates the use of the SchurTrait template, where depending on the two given data types the resulting data type is selected:

template< typename T1, typename T2 > // The two generic types
typename SchurTrait<T1,T2>::Type // The resulting generic return type
schur( T1 t1, T2 t2 ) //
{ // The function 'schur' returns the Schur
return t1 % t2; // product of the two given values
} //
decltype(auto) schur(const Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs)
Schur product of two matrices ( ).
Definition: Matrix.h:768

The documentation for this struct was generated from the following file: