Container Concepts
Vector
Description
A Vector describes common aspects of dense, packed and sparse vectors.
Refinement of
Associated types
In addition to the types defined by Vector Expression
Public base |
vector_container<V> |
V must be derived from this public base type. |
Storage array |
V::array_type |
Dense Vector ONLY. The type of underlying storage array used to store the elements. The array_type must model the Storage concept. |
Notation
|
A type that is a model of Vector |
|
Objects of type |
|
Objects of a type convertible to |
|
Object of a type convertible to |
|
Object of a type convertible to |
Definitions
Valid expressions
In addition to the expressions defined in DefaultConstructible, Vector Expression the following expressions must be valid.
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
Sizing constructor |
|
|
|
Insert |
|
|
|
Erase |
|
|
|
Clear |
|
|
|
Resize |
|
|
|
Storage |
|
|
|
Expression semantics
Semantics of an expression is defined only where it differs from, or is not defined in Vector Expression .
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
Sizing constructor |
|
|
Allocates a vector of |
|
Element access [2] |
|
|
returns the n-th element in v |
|
Insert |
|
|
Inserts an
element at |
|
Erase |
|
|
Destroys the
element as |
|
Clear |
|
|
Equivalent to |
|
Resize |
|
|
Reallocates the vector so
that it can hold |
|
Storage |
|
Returns a reference to the underlying dense storage. |
|
Complexity guarantees
The run-time complexity of the sizing constructor is linear in the vector’s size.
The run-time complexity of insert_element and erase_element is specific for the Vector model and it depends on increases/decreases in storage requirements.
The run-time complexity of resize is linear in the vector’s size.
Invariants
Models
-
vector,bounded_vector,c_vector -
unit_vector,zero_vector,scalar_vector -
mapped_vector;,compressed_vector,coordinate_vector
Notes
[1] As a user you need not care about Vector being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user.
[2] The operator[] is added purely for
convenience and compatibility with the std::vector. In uBLAS however,
generally operator() is used for indexing because this can be used for
both vectors and matrices.
Matrix
Description
A Matrix describes common aspects of dense, packed and sparse matrices.
Refinement of
Associated types
In addition to the types defined by Matrix Expression
Public base |
matrix_container<M> |
M must be derived from this public base type. |
Storage array |
M::array_type |
Dense Matrix ONLY. The type of underlying storage array used to store the elements. The array_type must model the Storage concept. |
Notation
|
A type that is a model of Matrix |
|
Objects of type |
|
Objects of a type convertible to |
|
Object of a type convertible to |
|
Object of a type convertible to |
Definitions
Valid expressions
In addition to the expressions defined in Matrix Expression the following expressions must be valid.
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
Sizing constructor |
|
|
|
Insert |
|
|
|
Erase |
|
|
|
Clear |
|
|
|
Resize |
|
|
|
Storage |
|
|
|
Expression semantics
Semantics of an expression is defined only where it differs from, or is not defined in Matrix Expression .
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
Sizing constructor |
|
|
Allocates a matrix of |
|
Insert |
|
|
Inserts an element at |
|
Erase |
|
|
Destroys the element as |
|
Clear |
|
Equivalent to |
||
Resize |
|
Reallocate the matrix so that it can hold |
|
|
Storage |
|
Returns a reference to the underlying dense storage. |
Complexity guarantees
The run-time complexity of the sizing constructor is quadratic in the matrix’s size.
The run-time complexity of insert_element and erase_element is specific for the Matrix model and it depends on increases/decreases in storage requirements.
The run-time complexity of resize is quadratic in the matrix’s size.
Invariants
Models
-
matrix,bounded_matrix,c_matrix -
identity_matrix,zero_matrix,scalar_matrix -
triangular_matrix,symmetric_matrix,banded_matrix -
mapped_matrix,compressed_matrix,coordinate_matrix
Notes
[1] As a user you need not care about Matrix being a refinement of the MatrixExpression. Being a refinement of the MatrixExpression is only important for the template-expression engine but not the user.
Tensor
Description
A Tensor describes common aspects of dense multidimensional arrays.
Refinement of
Associated types
In addition to the types defined by Tensor Expression
Public base |
|
|
Storage array |
|
Dense tensor ONLY. The type of underlying storage array used to store the elements. The array_type must model the Storage concept. |
Notation
tensor_t |
A type that is a model of Tensor |
|---|---|
|
Objects of type |
`n1, n2, np, m1, m2, mq ` |
Dimension objects of a type convertible to
|
`i1, i2, ip, j, k ` |
Index objects of a type convertible to |
|
Object of a type convertible to |
Definitions
Valid expressions
In addition to the expressions defined in Tensor Expression the following expressions must be valid.
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
Sizing constructor |
|
|
|
Write |
|
|
|
Read |
|
|
|
Clear |
|
|
|
Resize |
|
|
|
Storage |
|
|
|
Expression semantics
Semantics of an expression is defined only where it differs from, or is not defined in Tensor Expression .
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
Sizing constructor |
|
|
Allocates a |
|
Write |
|
0 < = |
Writes an element at multi-index position |
|
Read |
|
0 < = |
Reads the element at multi-index position |
|
Clear |
|
Removes all elements from the container. |
||
Resize |
|
|
Reallocate the matrix so that it can hold |
|
Storage |
|
Returns a reference to the underlying dense storage. |
Complexity guarantees
The run-time complexity of contructor is linear in the tensor’s size
n1 x n2 x … np.
The run-time complexity of write() and read() is linear in the order
of the tensor.
The run-time complexity of resize is at most linear in the tensor’s size
m1 x m2 x … nq.
Invariants
Models
-
tensor
Notes
[1] As a user you need not care about Tensor being a refinement of the TensorExpression. Being a refinement of the TensorExpression is only important for the template-expression engine but not the user.
Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
Copyright (©) 2018 Cem Bassoy
Copyright (©) 2021 Shikhar Vashistha
Use, modification and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt ).