Vector
Vector
Description
The templated class vector<T, A>
is the base container adaptor for
dense vectors. For a n-dimensional vector and 0 < = i < n every
element vi is mapped to the i-th element of the container.
Example
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (unsigned i = 0; i < v.size (); ++ i)
v (i) = i;
std::cout << v << std::endl;
}
Definition
Defined in the header vector.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the vector. |
|
|
|
Model of
Type requirements
None, except for those imposed by the requirements of Vector and RandomAccessContainer.
Public base classes
vector_container<vector<T, A> >
Members
Member | Where defined | Description |
---|---|---|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Allocates an uninitialized |
|
|
Allocates an uninitialized |
|
|
The copy constructor. |
|
|
The extended copy constructor. |
|
|
Reallocates a |
|
|
Returns the size of the |
|
|
Returns the upper bound on the size of the |
|
|
Equivilent to |
|
|
||
|
||
|
Returns a |
|
|
Returns a reference of the |
|
|
Returns a |
|
|
Returns a reference of the
|
|
|
The assignment operator. |
|
|
Assigns a temporary. May change the vector |
|
|
The extended assignment operator. |
|
|
Assigns a vector expression to the vector. Left and right hand side of the assignment should be independent. |
|
|
A computed assignment operator. Adds the vector expression to the vector. |
|
|
Adds a vector expression to the vector. Left and right hand side of the assignment should be independent. |
|
|
A computed assignment operator. Subtracts the vector expression from the vector. |
|
|
Subtracts a vector expression from the vector. Left and right hand side of the assignment should be independent. |
|
|
A computed assignment operator. Multiplies the vector with a scalar. |
|
|
A computed assignment operator. Divides the vector through a scalar. |
|
|
Swaps the contents of the vectors. |
|
|
Inserts the value |
|
|
Erases the value at the
|
|
|
Clears the vector. |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
|
|
Returns a |
Notes
[1] Common parameters for the Storage array are
unbounded_array<T>
, bounded_array<T>
and std::vector<T>
.
Unit Vector
Description
The templated class unit_vector<T, ALLOC>
represents canonical unit
vectors. For the k-th n-dimensional canonical unit vector and 0 ⇐
i < n holds uki = 0, if i <> k, and uki =
1.
Example
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
for (int i = 0; i < 3; ++ i) {
unit_vector<double> v (3, i);
std::cout << v << std::endl;
}
}
Definition
Defined in the header vector.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the vector. |
|
|
An STL Allocator for size_type and difference_type. |
std::allocator |
Model of
Vector .
Type requirements
None, except for those imposed by the requirements of Vector .
Public base classes
vector_container<unit_vector<T> >
Members
Member | Description |
---|---|
|
Constructs an |
|
Constructs the
|
|
The copy constructor. |
|
Resizes a
|
|
Returns the size of the |
|
Returns the index of the |
|
Returns the value of
the |
|
Returns the value of
the |
|
The assignment operator. |
|
Assigns a temporary.
May change the unit vector |
|
Swaps the contents of the unit vectors. |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
Zero Vector
Description
The templated class zero_vector<T, ALLOC>
represents zero vectors. For
a n-dimensional zero vector and 0 ⇐ i < n holds zi = 0.
Example
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
zero_vector<double> v (3);
std::cout << v << std::endl;
}
Definition
Defined in the header vector.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the vector. |
|
|
An STL Allocator for size_type and difference_type. |
std::allocator |
Model of
Vector .
Type requirements
None, except for those imposed by the requirements of Vector .
Public base classes
vector_container<zero_vector<T> >
Members
Member | Description |
---|---|
|
Constructs a |
|
Constructs a |
|
The copy constructor. |
|
Resizes a
|
|
Returns the size of the |
|
Returns the value of
the |
|
Returns the value of
the |
|
The assignment operator. |
|
Assigns a temporary.
May change the zero vector |
|
Swaps the contents of the zero vectors. |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
Scalar Vector
Description
The templated class scalar_vector<T, ALLOC>
represents scalar vectors.
For a n-dimensional scalar vector and 0 ⇐ i < n holds zi =
s.
Example
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
scalar_vector<double> v (3);
std::cout << v << std::endl;
}
Definition
Defined in the header vector.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the vector. |
|
|
An STL Allocator for size_type and difference_type. |
std::allocator |
Model of
Vector .
Type requirements
None, except for those imposed by the requirements of Vector .
Public base classes
vector_container<scalar_vector<T> >
Members
Member | Description |
---|---|
|
Constructs a |
|
Constructs a
|
|
The copy constructor. |
|
Resizes a
|
|
Returns the size of the |
|
Returns the value of
the |
|
Returns the value of
the |
|
The assignment operator. |
|
Assigns a
temporary. May change the scalar vector |
|
Swaps the contents of the scalar vectors. |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
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 ).