The Vector concept is intended to define a vector that can be used in linear-algebra operations. A vector contains n entries of type value_type, numbered from 0 to n-1.
If the value_type satisfies the requirements of the AdditiveAbelianGroup concept, Vector is a refinement of AdditiveAbelianGroup.
If the value_type satisfies the requirements of the VectorSpace concept, Vector is a refinement of VectorSpace. Note that if the value_type is a Field, Vector is a VectorSpace over value_type. This is the most common situation in linear algebra.
Vector thus inherits the algebraic structure from its entries.
The vector is also a refinement of Assignable if the vector's value_type is a model of Assignable.
The vector is also a refinement of AdditiveAbelianGroup if the vector's value_type is a AdditiveAbelianGroup.
The vector is also a refinement of VectorSpace if the vector's value_type is a VectorSpace.
size_type | Type of the matrix size (row index number, column index number) |
value_type | Type of vector entries |
X | Type that is a model of the Vector concept |
v | object of type X |
a | object of type X::value_type |
Name | Expression | Type requirements | Return type |
---|---|---|---|
Size constructor[2] | X(n) | X::value_type is DefaultConstructible | X |
Size | size() | size_type |
[1]Vector being default-constructible does not require the vector entries to be initialized. The reason for this is that this initialisation generally takes linear time.
[2] The size-constructor is not the same as the default fill constructor. The difference is that the size-constructor is not required to initialise all of its elements to value_type(). The reason for this is that this initialisation generally takes linear time.