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

Base template for the SolveTrait class. More...

#include <SolveTrait.h>

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

Detailed Description

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

Base template for the SolveTrait class.

General

The SolveTrait class template offers the possibility to select the resulting data type for solving a linear system of equations (LSE) with the two given types T1 and T2 via the solve() operation. SolveTrait defines the nested type Type, which represents the resulting data type of the solve() operation. In case T1 and T2 cannot be combined in a solve() operation, there is no nested type Type. Note that const and volatile qualifiers and reference modifiers are generally ignored.


Creating custom specializations

Per default, SolveTrait supports all vector and matrix types of the Blaze library (including views and adaptors). For all other data types it is possible to specialize the SolveTrait template. The following example shows the according specialization for solving an LSE with a static matrix and a static vector:

template< typename T, size_t N, bool SO, bool TF >
struct SolveTrait< StaticMatrix<T,N,N,SO>, StaticVector<T,N,TF> >
{
using Type = StaticVector<T,N,TF>;
};


Examples

The following example demonstrates the use of the SolveTrait 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 SolveTrait<T1,T2>::Type // The resulting generic return type
solveLSE( const T1& t1, const T2& t2 ) //
{ // The function 'solveLSE' returns the solution
return solve( t1, t2 ); // for the LSE represented by the two given values
} //
void solve(const DenseMatrix< MT, SO > &A, DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &b)
Solving the given linear system of equations ( ).
Definition: LSE.h:6343

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