dim< Dimensionality, DimensionType > Struct Template Reference#
|
Reference API
|
#include <ginkgo/core/base/dim.hpp>
Public Types | |
| using | dimension_type = DimensionType |
Public Member Functions | |
| constexpr | dim () |
| constexpr | dim (const dimension_type &size) |
| template<typename... Rest, std::enable_if_t< sizeof...(Rest)==Dimensionality - 1 > * = nullptr> | |
| constexpr | dim (const dimension_type &first, const Rest &... rest) |
| constexpr const dimension_type & | operator[] (const size_type &dimension) const noexcept |
| dimension_type & | operator[] (const size_type &dimension) noexcept |
| constexpr | operator bool () const |
Static Public Attributes | |
| static constexpr size_type | dimensionality = Dimensionality |
Friends | |
| struct | dim< dimensionality+1 > |
| constexpr bool | operator== (const dim &x, const dim &y) |
| constexpr bool | operator!= (const dim &x, const dim &y) |
| constexpr dim | operator* (const dim &x, const dim &y) |
| std::ostream & | operator<< (std::ostream &os, const dim &x) |
Detailed Description
struct gko::dim< Dimensionality, DimensionType >
A type representing the dimensions of a multidimensional object.
- Template Parameters
-
Dimensionality number of dimensions of the object DimensionType datatype used to represent each dimension
Constructor & Destructor Documentation
◆ dim() [1/3]
|
inlineconstexpr |
Creates a dimension object with all dimensions set to zero.
◆ dim() [2/3]
|
inlineexplicitconstexpr |
Creates a dimension object with all dimensions set to the same value.
- Parameters
-
size the size of each dimension
◆ dim() [3/3]
|
inlineconstexpr |
Creates a dimension object with the specified dimensions.
If the number of dimensions given is less than the dimensionality of the object, the remaining dimensions are set to the same value as the last value given.
For example, in the context of matrices dim<2>{2, 3} creates the dimensions for a 2-by-3 matrix.
- Parameters
-
first first dimension rest other dimensions
Member Function Documentation
◆ operator bool()
|
inlineexplicitconstexpr |
Checks if all dimensions evaluate to true.
For standard arithmetic types, this is equivalent to all dimensions being different than zero.
- Returns
- true if and only if all dimensions evaluate to true
- Note
- This operator is explicit to avoid implicit dim-to-int casts. It will still be used in contextual conversions (if, &&, ||, !)
◆ operator[]() [1/2]
|
inlineconstexprnoexcept |
Returns the requested dimension.
For example, if d is a dim<2> object representing matrix dimensions, d[0] returns the number of rows, and d[1] returns the number of columns.
- Parameters
-
dimension the requested dimension
- Returns
- the
dimension-th dimension
◆ operator[]() [2/2]
|
inlinenoexcept |
Friends And Related Symbol Documentation
◆ operator!=
|
friend |
Checks if two dim objects are not equal.
- Parameters
-
x first object y second object
- Returns
- false if and only if all dimensions of both objects are equal.
◆ operator*
|
friend |
Multiplies two dim objects.
- Parameters
-
x first object y second object
- Returns
- a dim object representing the size of the tensor product
x * y
◆ operator<<
|
friend |
A stream operator overload for dim
- Parameters
-
os stream object x dim object
- Returns
- a stream object appended with the dim output
◆ operator==
|
friend |
Checks if two dim objects are equal.
- Parameters
-
x first object y second object
- Returns
- true if and only if all dimensions of both objects are equal.
The documentation for this struct was generated from the following file:
- ginkgo/core/base/dim.hpp
Generated by