NABLA  Nabla Ain't Basic Linear Algebra
Related Functions | List of all members
vector_expression< value_t, expr_t, tag, orientation > Struct Template Reference

Vector expression template class. More...

Related Functions

(Note that these are not member functions.)

template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
op::mul< value_t, value_t >
::result_type 
sum_of_products (const vector_expression< value_t, expr1, tag1 > &a, const vector_expression< value_t, expr2, tag2 > &b)
 Returns sum of products of corresponding elements.
Miscellaneous
template<typename value_t , typename expr_t , typename tag >
expr_t & get_vector (vector_expression< value_t, expr_t, tag > &a)
 Returns underlying vector expression.
template<typename value_t , typename expr_t , typename tag >
const expr_t & get_vector (const vector_expression< value_t, expr_t, tag > &a)
 Returns underlying vector expression.
template<typename value_t , typename expr_t >
void swap (vector_expression< value_t, expr_t, tag::storage > &a, vector_expression< value_t, expr_t, tag::storage > &b)
 Swaps contents of two vectors.
template<typename value_t , typename expr1 , typename expr2 >
void swap (vector_expression< value_t, expr1, tag::storage > &a, vector_expression< value_t, expr2, tag::storage > &b)
 Swaps contents of two vector expressions.
template<typename value_t , typename expr1 , typename expr2 , typename orientation >
void swap (vector_expression< value_t, expr1, tag::storage > &a, vector_ref< expr2, tag::reference, orientation > b)
 Swaps contents of two vector expressions.
template<typename expr1 , typename orientation , typename value_t , typename expr2 >
void swap (vector_ref< expr1, tag::reference, orientation > a, vector_expression< value_t, expr2, tag::storage > &b)
 Swaps contents of two vector expressions.
template<typename expr1 , typename orientation1 , typename expr2 , typename orientation2 >
void swap (vector_ref< expr1, tag::reference, orientation1 > a, vector_ref< expr2, tag::reference, orientation2 > b)
 Swaps contents of two vector expressions.
Matrix operations
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
product< matrix_expression
< value_t, expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 > > 
operator* (const matrix_expression< value_t, expr1, tag1 > &left, const vector_expression< value_t, expr2, tag2, orientation::column > &right)
 Binary matrix-vector multiplication operator.
template<typename value_t , typename expr1 , typename tag1 , typename shape , typename expr2 , typename tag2 >
product< shaped_expression
< value_t, expr1, tag1, shape >
, vector_expression< value_t,
expr2, tag2 > > 
operator* (const shaped_expression< value_t, expr1, tag1, shape > &left, const vector_expression< value_t, expr2, tag2, orientation::column > &right)
 Binary matrix-vector multiplication operator.
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
product< matrix_expression
< value_t, expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 > > 
map (const matrix_expression< value_t, expr1, tag1 > &linear_map, const vector_expression< value_t, expr2, tag2 > &v)
 Transforms a vector using provided transformation map.
template<typename value_t , typename expr1 , typename tag1 , typename shape , typename expr2 , typename tag2 >
product< shaped_expression
< value_t, expr1, tag1, shape >
, vector_expression< value_t,
expr2, tag2 > > 
map (const shaped_expression< value_t, expr1, tag1, shape > &linear_map, const vector_expression< value_t, expr2, tag2 > &v)
 Transforms a vector using provided transformation map.
Vector operations
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
util::mul_conj< value_t,
value_t >::result_type 
dot_product (const vector_expression< value_t, expr1, tag1 > &v1, const vector_expression< value_t, expr2, tag2 > &v2)
 Dot product is a sum of products of corresponding elements of first vector and conjugated elements of the second one:
template<typename value_t , typename expr_t , typename tag >
value_t sqrnorm (const vector_expression< value_t, expr_t, tag > &v)
 Returns squared Euclidean norm of a vector.
template<typename value_t , typename expr_t , typename tag >
value_t norm (const vector_expression< value_t, expr_t, tag > &v)
 Returns Euclidean norm of a vector.
template<typename value_t , typename expr_t , typename tag >
const unary< vector_expression
< value_t, expr_t, tag >
, op::plus
operator+ (const vector_expression< value_t, expr_t, tag > &a)
 Unary plus operator.
template<typename value_t , typename expr_t , typename tag >
const unary< vector_expression
< value_t, expr_t, tag >
, op::minus
operator- (const vector_expression< value_t, expr_t, tag > &a)
 Unary minus operator.
template<typename value_t , typename expr_t , typename tag >
const unary< vector_expression
< value_t, expr_t, tag >
, op::conj
conj (const vector_expression< value_t, expr_t, tag > &a)
 Returns conjugated vector.
template<typename value_t , typename expr_t , typename tag >
const scaled
< vector_expression< value_t,
expr_t, tag > > 
operator* (const vector_expression< value_t, expr_t, tag > &a, const typename expr_t::value_type &s)
 Binary multiplication operator.
template<typename value_t , typename expr_t , typename tag >
const scaled
< vector_expression< value_t,
expr_t, tag > > 
operator* (const typename expr_t::value_type &s, const vector_expression< value_t, expr_t, tag > &a)
 Binary multiplication operator.
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
const binary
< vector_expression< value_t,
expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 >, op::add
operator+ (const vector_expression< value_t, expr1, tag1 > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Binary addition operator.
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
const binary
< vector_expression< value_t,
expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 >, op::sub
operator- (const vector_expression< value_t, expr1, tag1 > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Binary subtraction operator.
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
const binary
< vector_expression< value_t,
expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 >, op::mul
mul (const vector_expression< value_t, expr1, tag1 > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Binary element-wise multiplication operator.
template<typename value_t , typename expr1 , typename tag1 , typename expr2 , typename tag2 >
const binary
< vector_expression< value_t,
expr1, tag1 >
, vector_expression< value_t,
expr2, tag2 >, op::div
div (const vector_expression< value_t, expr1, tag1 > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Binary element-wise division operator.
template<typename value_t , typename expr1 , typename expr2 , typename tag2 >
expr1 & operator+= (vector_expression< value_t, expr1, tag::storage > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Vector addition assignment operator.
template<typename value_t , typename expr1 , typename expr2 , typename tag2 >
expr1 & operator+= (vector_expression< value_t, expr1, tag::reference > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Vector addition assignment operator.
template<typename value_t , typename expr1 , typename expr2 , typename tag2 >
expr1 & operator-= (vector_expression< value_t, expr1, tag::storage > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Vector subtraction assignment operator.
template<typename value_t , typename expr1 , typename expr2 , typename tag2 >
expr1 & operator-= (vector_expression< value_t, expr1, tag::reference > &left, const vector_expression< value_t, expr2, tag2 > &right)
 Vector subtraction assignment operator.
template<typename value_t , typename expr_t >
expr_t & operator*= (vector_expression< value_t, expr_t, tag::storage > &left, const value_t &right)
 Vector multiplication assignment operator.
template<typename value_t , typename expr_t >
expr_t & operator*= (vector_expression< value_t, expr_t, tag::reference > &left, const value_t &right)
 Vector multiplication assignment operator.

Detailed Description

template<typename value_t, typename expr_t, typename tag, typename orientation>
struct nabla::vector_expression< value_t, expr_t, tag, orientation >

Vector expression template class.

This class is the base class for all vector expressions including class vector .

For explanation about template parameters value_t, expr_t and tag see documentation for matrix_expression .

vector_expression is almost fully analogous to matrix_expression.

Vector Orientation

Actually all vectors are just straight strings of values and nobody cares about their orientation in space. But it is very convenient to think of a vector simultaneously being a matrix which consists of either one row or one column. To reflect this design two specializations of vector_expression are defined, namely vector_expression<value_t, expr_t, tag, orientation::column> and vector_expression<value_t, expr_t, tag, orientation::row>, which define column vector and row vector expressions respectively.

The choice of concept to model affects only the implicit conversion to matrix expression:

Here v.size() denotes the size of the vector.

Such design allows to restrict the orientation of the argument vector for a function. See details below.

There is another question about orientation: What is the orientation of a combination of vectors with different orientations?

In this library when two vectors are combined somehow yielding a vector its orientation is defined the following way:

For example if a column vector is added to another column vector the result is also a column vector:

vector<double> v1, v2;
//...
matrix<double> m;
m = (v1 + v2); //m becomes a v1.size() by 1 matrix

A difference of a row vector and a column vector is a vector with undefined orientation:

//the resulting vector can not be converted to matrix
m = (row(v1) - v2); //does not compile

column() and row() functions can be used to explicitly define orientation of a vector expression.

m = column(row(v1) - v2); //m becomes a v1.size() by 1 matrix

Defining Vector Expressions

The definition of vector expressions is fully analogous to the case of matrix_expression. See Defining Matrix Expressions.

For example definition of a vector class may look like this:

template<typename type>
class my_vector :
public vector_expression<type, //element type
my_vector<type>, //actual type
tag::storage //tag
>
{
//rest of definition
};

In this case a set of members must conform to storage tag requirements to make my_vector seamlessly integrated into the library (see Storage Concept Description). For more information see Expression Tags.

As an alternative the base could be specified like

vector_expression<type, //element type
my_vector<type>, //actual type
tag::storage, //tag
orientation::column //orientation
>

In this case my_vector type models the column vector concept and can be implicitly converted to a matrix consisting of one column.

Using Vector Expressions

The usage of vector expressions is very similar to that of matrix_expression (see Using Matrix Expressions).

For example this function handles all vector expressions:

template<typename value_t, typename expr_t, typename tag>
value_t foo(const vector_expression<value_t, expr_t, tag> &a);

Such definitions are irrelevant to the orientation (column/row) of an arbitrary vector.

However if you want to restrict the usage of vector expressions in the sense of vector orientation you can write something like this:

template<typename value_t, typename expr_t, typename tag>
value_t bar(const vector_expression<value_t, expr_t, tag, orientation::column> &a);

This function handles only expressions that are explicitly defined as column vectors.

See Also
matrix_expression, vector

Definition at line 1666 of file matrix.h.

Friends And Related Function Documentation

const unary< vector_expression< value_t, expr_t, tag >, op::conj > conj ( const vector_expression< value_t, expr_t, tag > &  a)
related

Returns conjugated vector.

This function returns an expression which represents conjugated vector, i.e. a vector with conjugated corresponding elements.

For real valued vectors it just returns a constant reference to the argument, i.e. it actually does nothing.

For some important details check out Using complex types.

Complexity:
conj(v): algorithmic complexity of this operation is constant (i.e. O(1)).

By convention the resulting expression has complexity of its subexpression.

Definition at line 5466 of file matrix.h.

const binary< vector_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 >, op::div > div ( const vector_expression< value_t, expr1, tag1 > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Binary element-wise division operator.

Sizes of argument vectors must be equal. Otherwise an exception (size_error) is thrown.

Complexity:
div(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5646 of file matrix.h.

util::mul_conj< value_t, value_t >::result_type dot_product ( const vector_expression< value_t, expr1, tag1 > &  v1,
const vector_expression< value_t, expr2, tag2 > &  v2 
)
related

Dot product is a sum of products of corresponding elements of first vector and conjugated elements of the second one:

sum = 0;
for each i
sum = sum + v1[i]*conj(v2[i]);
dot_product = sum;

It may be referred to as "scalar product" in other sources.

Exceptions
size_errorthrown if argument vectors have different sizes.

Sizes of argument vectors must be equal. Otherwise an exception is thrown.

For some important details check out Using complex types.

Note:
This function uses traits<value_t>::zero.
Complexity:
dot_product(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).
See Also
norm(), sum_of_products()

Definition at line 5272 of file matrix.h.

expr_t & get_vector ( vector_expression< value_t, expr_t, tag > &  a)
related

Returns underlying vector expression.

This template function deduces the actual type of the underlying vector expression and returns a reference to it. This scheme is called Curiously Recurring Template Pattern.

Definition at line 1974 of file matrix.h.

const expr_t & get_vector ( const vector_expression< value_t, expr_t, tag > &  a)
related

Returns underlying vector expression.

This template function deduces the actual type of the underlying vector expression and returns a reference to it. This scheme is called Curiously Recurring Template Pattern.

Definition at line 1982 of file matrix.h.

product< matrix_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 > > map ( const matrix_expression< value_t, expr1, tag1 > &  linear_map,
const vector_expression< value_t, expr2, tag2 > &  v 
)
related

Transforms a vector using provided transformation map.

Number of columns of the matrix linear_map and size of the vector v must be equal. Otherwise an exception (size_error) is thrown.

The vector is mapped the following way:

for each i
{ mapped[i] = 0;
for each j
mapped[i] += linear_map[i][j]*v[j]; }

That is, the number of rows of the matrix representing linear map is the dimension of space the resulting vector (mapped) belongs to.

This function preserves vector orientation, that is the orientation of the resulting vector expression is the same as that of the source vector.

This operation is analogous to matrix-vector multiplication.

Complexity:
map(m, v): algorithmic complexity of this operation is square (i.e. O(n2)).

Definition at line 4965 of file matrix.h.

product< shaped_expression< value_t, expr1, tag1, shape >, vector_expression< value_t, expr2, tag2 > > map ( const shaped_expression< value_t, expr1, tag1, shape > &  linear_map,
const vector_expression< value_t, expr2, tag2 > &  v 
)
related

Transforms a vector using provided transformation map.

This is an overload for shaped matrix expressions.

Number of columns of the matrix linear_map and size of the vector v must be equal. Otherwise an exception (size_error) is thrown.

Definition at line 4978 of file matrix.h.

const binary< vector_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 >, op::mul > mul ( const vector_expression< value_t, expr1, tag1 > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Binary element-wise multiplication operator.

Sizes of argument vectors must be equal. Otherwise an exception (size_error) is thrown.

Complexity:
mul(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5633 of file matrix.h.

value_t norm ( const vector_expression< value_t, expr_t, tag > &  v)
related

Returns Euclidean norm of a vector.

Euclidean norm of a vector is a square root of the sum of products of corresponding elements and their conjugates:

sum = 0;
for each i
sum = sum + v[i]*conj(v[i]);
norm = sqrt(sum);

It is equivalent to the square root of dot product of a vector and itself

sqrt(dot_product(v, v))

For some important details check out Using complex types.

By the way this entity uses sqrt() function to find the square root. It must be defined for the value_t type in order to use this operation.

Note:
This function uses traits<value_t>::zero.
Complexity:
norm(v): algorithmic complexity of this operation is linear (i.e. O(n)).
See Also
dot_product(), sum_of_products(), sqrnorm()

Definition at line 5389 of file matrix.h.

product< matrix_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 > > operator* ( const matrix_expression< value_t, expr1, tag1 > &  left,
const vector_expression< value_t, expr2, tag2, orientation::column > &  right 
)
related

Binary matrix-vector multiplication operator.

Number of columns of the matrix left and size of the vector right must be equal. Otherwise an exception (size_error) is thrown.

This operation is analogous to map().

Complexity:
m*v: algorithmic complexity of this operation is square (i.e. O(n2)).

Definition at line 4925 of file matrix.h.

product< shaped_expression< value_t, expr1, tag1, shape >, vector_expression< value_t, expr2, tag2 > > operator* ( const shaped_expression< value_t, expr1, tag1, shape > &  left,
const vector_expression< value_t, expr2, tag2, orientation::column > &  right 
)
related

Binary matrix-vector multiplication operator.

This is an overload for shaped matrix expressions.

Number of columns of the matrix left and size of the vector right must be equal. Otherwise an exception (size_error) is thrown.

Definition at line 4938 of file matrix.h.

const scaled< vector_expression< value_t, expr_t, tag > > operator* ( const vector_expression< value_t, expr_t, tag > &  a,
const typename expr_t::value_type &  s 
)
related

Binary multiplication operator.

Complexity:
v*s: algorithmic complexity of this operation is linear (i.e.

O(n)).

Definition at line 5514 of file matrix.h.

const scaled< vector_expression< value_t, expr_t, tag > > operator* ( const typename expr_t::value_type &  s,
const vector_expression< value_t, expr_t, tag > &  a 
)
related

Binary multiplication operator.

Complexity:
s*v: algorithmic complexity of this operation is linear (i.e.

O(n)).

Definition at line 5523 of file matrix.h.

expr_t & operator*= ( vector_expression< value_t, expr_t, tag::storage > &  left,
const value_t &  right 
)
related

Vector multiplication assignment operator.

Complexity:
v *= s: algorithmic complexity of this operation is linear (i.e.

O(n)).

Definition at line 5751 of file matrix.h.

expr_t & operator*= ( vector_expression< value_t, expr_t, tag::reference > &  left,
const value_t &  right 
)
related

Vector multiplication assignment operator.

This function is provided for convenience.

This function performs multiplication assignment element by element in a cycle.

Complexity:
v *= s: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5764 of file matrix.h.

const unary< vector_expression< value_t, expr_t, tag >, op::plus > operator+ ( const vector_expression< value_t, expr_t, tag > &  a)
related

Unary plus operator.

Complexity:
+v: algorithmic complexity of this operation is constant (i.e.

O(1)).

By convention the resulting expression has complexity of its subexpression.

Definition at line 5437 of file matrix.h.

const binary< vector_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 >, op::add > operator+ ( const vector_expression< value_t, expr1, tag1 > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Binary addition operator.

Sizes of argument vectors must be equal. Otherwise an exception (size_error) is thrown.

Complexity:
v + v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5607 of file matrix.h.

expr1 & operator+= ( vector_expression< value_t, expr1, tag::storage > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Vector addition assignment operator.

Sizes of argument vectors must be equal. Otherwise an exception is thrown.

Complexity:
v += v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5657 of file matrix.h.

expr1 & operator+= ( vector_expression< value_t, expr1, tag::reference > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Vector addition assignment operator.

This function is provided for convenience.

This function performs addition assignment element by element in a cycle.

For efficiency reasons this function does not check sizes of argument vectors for equality and does not throw an exception in case sizes are different. It only makes an assertion in debug configuration.

Complexity:
v += v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5678 of file matrix.h.

const unary< vector_expression< value_t, expr_t, tag >, op::minus > operator- ( const vector_expression< value_t, expr_t, tag > &  a)
related

Unary minus operator.

Complexity:
-v: algorithmic complexity of this operation is constant (i.e.

O(1)).

By convention the resulting expression has complexity of its subexpression.

Definition at line 5448 of file matrix.h.

const binary< vector_expression< value_t, expr1, tag1 >, vector_expression< value_t, expr2, tag2 >, op::sub > operator- ( const vector_expression< value_t, expr1, tag1 > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Binary subtraction operator.

Sizes of argument vectors must be equal. Otherwise an exception (size_error) is thrown.

Complexity:
v - v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5620 of file matrix.h.

expr1 & operator-= ( vector_expression< value_t, expr1, tag::storage > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Vector subtraction assignment operator.

Sizes of argument vectors must be equal. Otherwise an exception is thrown.

Complexity:
v -= v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5697 of file matrix.h.

expr1 & operator-= ( vector_expression< value_t, expr1, tag::reference > &  left,
const vector_expression< value_t, expr2, tag2 > &  right 
)
related

Vector subtraction assignment operator.

This function is provided for convenience.

This function performs subtraction assignment element by element in a cycle.

For efficiency reasons this function does not check sizes of argument vectors for equality and does not throw an exception in case sizes are different. It only makes an assertion in debug configuration.

Complexity:
v -= v: algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5718 of file matrix.h.

value_t sqrnorm ( const vector_expression< value_t, expr_t, tag > &  v)
related

Returns squared Euclidean norm of a vector.

Euclidean norm of a vector is a square root of the sum of products of corresponding elements and their conjugates. This function performs:

sum = 0;
for each i
sum = sum + v[i]*conj(v[i]);
sqrnorm = sum;

Note that this function returns squared Euclidean norm, that is |v|2.

It is equivalent to the dot product of a vector and itself

For some important details check out Using complex types.

Note:
This function uses traits<value_t>::zero.
Complexity:
sqrnorm(v): algorithmic complexity of this operation is linear (i.e. O(n)).
See Also
norm(), dot_product(), sum_of_products()

Definition at line 5364 of file matrix.h.

op::mul< value_t, value_t >::result_type sum_of_products ( const vector_expression< value_t, expr1, tag1 > &  a,
const vector_expression< value_t, expr2, tag2 > &  b 
)
related

Returns sum of products of corresponding elements.

This function performs a convenient operation – it computes a sum of products of corresponding elements of two vectors:

sum = 0;
for each i
sum = sum + v1[i]*v2[i];

For efficiency reasons this function does not check sizes of argument vectors for equality and does not throw an exception in case sizes are different. It only makes an assertion in debug configuration.

Note:
This function uses traits<value_t>::zero.
Complexity:
sum_of_products(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).
See Also
dot_product(), norm()

Definition at line 4680 of file matrix.h.

void swap ( vector_expression< value_t, expr_t, tag::storage > &  a,
vector_expression< value_t, expr_t, tag::storage > &  b 
)
related

Swaps contents of two vectors.

This template function handles all vector expressions with storage tag. Such expressions are meant to be storage types and by definition provide efficient swap operation.

The actual effect of this function is

get_vector(a).swap(get_vector(b));

This function is not meant to throw any exceptions.

Definition at line 5135 of file matrix.h.

void swap ( vector_expression< value_t, expr1, tag::storage > &  a,
vector_expression< value_t, expr2, tag::storage > &  b 
)
related

Swaps contents of two vector expressions.

This function is provided for convenience.

This function swaps contents of two vector expressions with storage tag. Such expressions are meant to be storage types.

This function does not actually swaps objects' storages or the like. Rather it swaps contents in the following manner:

temp = a;
a = b;
swap(b, temp);
Note
Due to construction of temporary object temp and assignment operation involved this function may throw an exception.
Complexity:
swap(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5158 of file matrix.h.

void swap ( vector_expression< value_t, expr1, tag::storage > &  a,
vector_ref< expr2, tag::reference, orientation >  b 
)
related

Swaps contents of two vector expressions.

This function is provided for convenience.

This function swaps contents of two vector expressions element by element in a cycle.

This function does not actually swaps objects' storages or the like. Rather it swaps contents element by element in a cycle like this:

for each i
swap(a(i), b(i));
Note
Since vectors can not be resized this function swaps only the first elements, that is min(a.size(), b.size()) elements.

Thus this function is not meant to throw any exceptions.

Complexity:
swap(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5205 of file matrix.h.

void swap ( vector_ref< expr1, tag::reference, orientation >  a,
vector_expression< value_t, expr2, tag::storage > &  b 
)
related

Swaps contents of two vector expressions.

This function is provided for convenience.This function swaps contents of two vector expressions element by element in a cycle.This function does not actually swaps objects' storages or the like. Rather it swaps contents element by element in a cycle like this:

for each i
swap(a(i), b(i));
Note
Since vectors can not be resized this function swaps only the first elements, that is min(a.size(), b.size()) elements.

Thus this function is not meant to throw any exceptions.

Complexity:
swap(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5216 of file matrix.h.

void swap ( vector_ref< expr1, tag::reference, orientation1 >  a,
vector_ref< expr2, tag::reference, orientation2 >  b 
)
related

Swaps contents of two vector expressions.

This function is provided for convenience.This function swaps contents of two vector expressions element by element in a cycle.This function does not actually swaps objects' storages or the like. Rather it swaps contents element by element in a cycle like this:

for each i
swap(a(i), b(i));
Note
Since vectors can not be resized this function swaps only the first elements, that is min(a.size(), b.size()) elements.

Thus this function is not meant to throw any exceptions.

Complexity:
swap(v, v): algorithmic complexity of this operation is linear (i.e. O(n)).

Definition at line 5227 of file matrix.h.


The documentation for this struct was generated from the following file: