Intel(R) Array Building Blocks provides many functions on scalars, all of which can also be applied to containers of such scalars.
For descriptions of what these functions do, see the scalar reference sections by type:
Any function that can be applied to scalars (see Scalars and Scalar Functions) can also be applied to dense containers (see Dense Containers and Dense Container Element-wise Functions) and nested containers (see Nested Containers and Nested Container Element-wise Functions).
Certain types may be mixed when applying these operations. Scalars and uncaptured values (see arbb::uncaptured) of the corresponding scalar type can be used together. Dense and nested containers may be mixed with their element type and uncaptured element type.
The following example illustrates combinations of types that are valid:
float uncaptured; arbb::f32 scalar; arbb::dense<arbb::f32> dense_1d; arbb::dense<arbb::f32, 2> dense_2d; arbb::nested<arbb::f32> nested; arbb::i32 scalar_i32; arbb::dense<arbb::i32> dense_1d_i32; // These cases do not mix types, so they are allowed. scalar = scalar + scalar; dense_1d = dense_1d + dense_1d; dense_2d = dense_2d + dense_2d; nested = nested + nested; // Some legal cases with mixed types. scalar = scalar + uncaptured; dense_1d = dense_1d + scalar; nested = nested + scalar; dense_1d = uncaptured + dense_1d; nested = uncaptured + nested; // The following cases are invalid // // Mixing dimensionalities is not allowed. // INVALID: dense_2d = dense_1d + dense_2d; // Mixing dense and nested containers is not allowed. // INVALID: nested = dense_1d + nested; // Mixing scalar types is not allowed. // INVALID: scalar = scalar + scalar_i32; // Mixing scalar types is not allowed. // INVALID: dense = dense + dense_i32;
Element-wise operations apply to dense containers of user-defined types (see User-defined Types) if the user-defined types themselves provide these operations. For example, if a user-defined type defines a valid operator+()
, it will be possible to add together dense containers of this type. These operations perform the same operations as the user-defined functions, such as the aforementioned user-defined operator+()
.
Modules | |
Scalar Functions | |
Dense Container Element-wise Functions | |
Nested Container Element-wise Functions |
Copyright © 2010, Intel Corporation. All rights reserved.