![]() |
The Blaze library tries hard to make the use of custom data types as convenient, easy and intuitive as possible. However, unfortunately it is not possible to meet the requirements of all possible data types. Thus it might be necessary to provide Blaze with some additional information about the data type. The following sections give an overview of the necessary steps to enable the use of the hypothetical custom data type custom::double_t
for vector and matrix operations. For example:
The Blaze library assumes that the custom::double_t
data type provides operator+()
for additions, operator-()
for subtractions, operator*()
for multiplications and operator/()
for divisions. If any of these functions is missing it is necessary to implement the operator to perform the according operation. For this example we assume that the custom data type provides the four following functions instead of operators:
The following implementations will satisfy the requirements of the Blaze library:
Blaze will use all the information provided with these functions (for instance the return type) to properly handle the operations. In the rare case that the return type cannot be automatically determined from the operator it might be additionally necessary to provide a specialization of the following four Blaze class templates:
The same steps are necessary if several custom data types need to be combined (as for instance custom::double_t
and custom::float_t
). Note that in this case both permutations need to be taken into account:
Please note that only built-in data types apply for vectorization and thus custom data types cannot achieve maximum performance!
Previous: Block Vectors and Matrices Next: Customization of the Error Reporting Mechanism