C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
cxsc::sivector Class Reference

A sparse interval vector. More...

#include <sivector.hpp>

List of all members.

Public Member Functions

real density () const
 Returns the density of the vector (the number of non zero elements divided by the number of elements)
void dropzeros ()
 Erases explicitly stored zeros from the data structure.
int get_nnz () const
 Returns the number of non zero elements of this vector (note that this includes explicitly stored zeros)
sivectoroperator&= (const ivector_slice &v)
 Operator for element-wise intersection with another vector, result is assigned to the vector.
sivectoroperator&= (const sivector &v)
 Operator for element-wise intersection with another vector, result is assigned to the vector.
const interval operator() (const int i) const
 Returns a copy of the i-th (according to the currently used indexing) element of the vector.
sivector operator() (const intvector &per)
 Returns a vector whose elemnts are rearranged according to a given permutation vector.
sivector operator() (const intmatrix &P)
 Returns a vector whose elemnts are rearranged according to a given permutation matrix.
sivector_slice operator() (const int, const int)
 Returns a slice of the vector from the i-th to the j-th (according to the currently used indexing) element.
sivectoroperator*= (const real &s)
 Operator for multiplication with a scalar, result is assigned to the vector.
sivectoroperator*= (const interval &s)
 Operator for multiplication with an interval, result is assigned to the vector.
sivectoroperator+= (const rvector &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const ivector &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const rvector_slice &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const ivector_slice &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const srvector &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const sivector &v)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const srvector_slice &)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator+= (const sivector_slice &)
 Operator for element-wise addition with a vector, result is assigned to the vector.
sivectoroperator-= (const rvector &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const ivector &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const rvector_slice &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const ivector_slice &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const srvector &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const sivector &v)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const srvector_slice &)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator-= (const sivector_slice &)
 Operator for element-wise subtraction with a vector, result is assigned to the vector.
sivectoroperator/= (const real &s)
 Operator for division of each element of the vector with a scalar, result is assigned to the vector.
sivectoroperator/= (const interval &s)
 Operator for division of each element of the vector with an interval, result is assigned to the vector.
sivectoroperator= (const srvector &v)
 Assign a sparse real vector to a sparse interval vector.
sivectoroperator= (const real &v)
 Assigns v to all elements of the vector (resulting in a dense vector!)
sivectoroperator= (const interval &v)
 Assigns v to all elements of the vector (resulting in a dense vector!)
sivectoroperator= (const rvector &v)
 Assign the dense vector v to a sparse vector. Only the non zero elements of v are used.
sivectoroperator= (const ivector &v)
 Assign the dense vector v to a sparse vector. Only the non zero elements of v are used.
sivectoroperator= (const rvector_slice &v)
 Assign the dense vector slice v to a sparse vector. Only the non zero elements of v are used.
sivectoroperator= (const ivector_slice &v)
 Assign the dense vector slice v to a sparse vector. Only the non zero elements of v are used.
sivectoroperator= (const sivector_slice &)
 Assign the sparse vector slice v to a sparse vector.
sivectoroperator= (const srvector_slice &)
 Assign the sparse vector slice v to a sparse vector.
intervaloperator[] (const int i)
 Returns a reference to the i-th (according to the currently used indexing) element of the vector.
interval operator[] (const int i) const
 Returns a copy of the i-th (according to the currently used indexing) element of the vector.
sivectoroperator|= (const rvector &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
sivectoroperator|= (const ivector &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
sivectoroperator|= (const rvector_slice &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
sivectoroperator|= (const ivector_slice &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
sivectoroperator|= (const srvector &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
sivectoroperator|= (const sivector &v)
 Operator for element-wise convex hull with another vector, result is assigned to the vector.
std::vector< int > & row_indices ()
 Returns a reference to the STL-vector storing the row indices of the non zero elements.
const std::vector< int > & row_indices () const
 Returns a reference to the STL-vector storing the row indices of the non zero elements.
 sivector ()
 Default constructor, creates an empty vector of size 0.
 sivector (const int s)
 Constructor for creating an empty vector of size s.
 sivector (const int s, const int b)
 Constructor for creating an empty vector of size s and reserving memory for b elements.
 sivector (const ivector &v)
 Constructor for creating a sparse vector our of a dense vector v. Only the non-zero elements of v are stored explicitly.
 sivector (const rvector &v)
 Constructor for creating a sparse vector our of a dense vector v. Only the non-zero elements of v are stored explicitly.
 sivector (const int n, const int nnz, const intvector &index, const ivector &values)
 Creates a sparse vector of dimension n with nnz non zeros, who are defined by the elements of index and values.
 sivector (const int n, const int nnz, const int *index, const interval *values)
 Creates a sparse vector of dimension n with nnz non zeros, who are defined by the elements of index and values.
 sivector (const srvector &v)
 Creates a sparse interval vector out of a sparse real vector.
 sivector (const srvector_slice &)
 Creates a sparse interval vector out of a sparse real vector slice.
 sivector (const sivector_slice &)
 Creates a sparse interval vector out of a sparse interval vector slice.
 sivector (const srmatrix_subv &A)
 Creates a sparse interval vector out of a row or column of a sparse real matrix.
 sivector (const simatrix_subv &A)
 Creates a sparse interval vector out of a row or column of a sparse interval matrix.
std::vector< interval > & values ()
 Returns a reference to the STL-vector storing the values of the non zero elements.
const std::vector< interval > & values () const
 Returns a reference to the STL-vector storing the values of the non zero elements.

Friends

sivector abs (const sivector &)
 Computes the component-wise absolute values as the interval hull of $ \{ |v| \mid v \in [v] \} $ for a vector v.
sivector abs (const sivector_slice &)
 Computes the component-wise absolute values as the interval hull of $ \{ |v| \mid v \in [v] \} $ for a vector v.
sivector abs (const scivector &)
 Computes the component-wise absolute values as the interval hull of $ \{ |v| \mid v \in [v] \} $ for a vector v.
sivector abs (const scivector_slice &)
 Computes the component-wise absolute values as the interval hull of $ \{ |v| \mid v \in [v] \} $ for a vector v.
srvector absmax (const sivector &)
 Computes the component-wise maximum absolute values $ \max\limits_{v \in [v]} (|v|) $ for a vector v.
srvector absmin (const sivector &)
 Computes the component-wise minimum absolute values $ \min\limits_{v \in [v]} (|v|) $ for a vector v.
sivector Blow (const sivector &, const real &)
 Performs an epsilon inflation of the vector v.
srvector diam (const sivector &)
 Computes the diameter of v.
sivector Im (const scivector &)
 Returns the imaginary part of the vector v.
srvector Inf (const sivector &)
 Returns the infimum of the interval vector as a new sparse point vector.
int Lb (const sivector &)
 Returns the lower index bound of the vector v.
srvector mid (const sivector &)
 Compute the midpoint vector of v.
sivector Re (const scivector &)
 Returns the real part of the vector v.
void SetLb (sivector &, const int)
 Sets the lower index bound of the vector v to i.
void SetUb (sivector &, const int)
 Sets the upper index bound of the vector v to i.
srvector Sup (const sivector &)
 Returns the supremum of the interval vector as a new sparse point vector.
int Ub (const sivector &)
 Returns the upper index bound of the vector v.
int VecLen (const sivector &)
 Returns the length of the vector (the dimension)

Detailed Description

A sparse interval vector.

This data type represents a sparse interval vector. Only the non zero elements are stored explicitly with their value and the respective index. All operators are overloaded to take advantage of the sparsity.

Definition at line 59 of file sivector.hpp.


Member Function Documentation

const interval cxsc::sivector::operator() ( const int  i) const [inline]

Returns a copy of the i-th (according to the currently used indexing) element of the vector.

If the i-th element is explicitly stored, a copy of this value is returned. Otherwise, 0.0 will be returned. Unlike with the []-operator, the data structure remains unchanged either way. Thus this operator should always be used for read-only access to the elements of a sparse vector.

Definition at line 292 of file sivector.hpp.

sivector cxsc::sivector::operator() ( const intvector per) [inline]

Returns a vector whose elemnts are rearranged according to a given permutation vector.

For a permutation vector p with p[Lb(p)+i]=j, the j-th element of the given sparse vector will be the i-th element of the returned permuted vector.

Definition at line 310 of file sivector.hpp.

sivector cxsc::sivector::operator() ( const intmatrix P) [inline]

Returns a vector whose elemnts are rearranged according to a given permutation matrix.

For a given sparse vector x and permutation matrix P, this operator return the result of P*x. This operator is more efficient than explicitly computing P*x, since P is transformed into a permutation vector and the permutation ist performed directly, without explicitly computing P*x.

Definition at line 334 of file sivector.hpp.

sivector_slice cxsc::sivector::operator() ( const int  i,
const int  j 
) [inline]

Returns a slice of the vector from the i-th to the j-th (according to the currently used indexing) element.

This operator can be used for read and write access to a slice of the sparse vector.

Definition at line 2234 of file sivector.hpp.

interval& cxsc::sivector::operator[] ( const int  i) [inline]

Returns a reference to the i-th (according to the currently used indexing) element of the vector.

If the i-th element is explicitly stored, a reference to the value is returned. If is not explicitly stored, it will be added to the data structure as a zero element. The returned reference then points to this new element. Hence ths []-operator should only be used for write access to the elements of a sparse vector. Use the ()-operator for read access.

Definition at line 258 of file sivector.hpp.

interval cxsc::sivector::operator[] ( const int  i) const [inline]

Returns a copy of the i-th (according to the currently used indexing) element of the vector.

If the i-th element is explicitly stored, a copy to the value is returned. If is not explicitly stored, zero will be returned. This is the const-Version of this operator, added for convenience. It is suggested to use thei ()-operator for read access.

Definition at line 280 of file sivector.hpp.

std::vector<int>& cxsc::sivector::row_indices ( ) [inline]

Returns a reference to the STL-vector storing the row indices of the non zero elements.

This function is provided to allow easy interfacing to other software interfaces and efficient implementation of sparse algorithms. The user has to take care that the data remains consistent (the i-th element of the STL-vector storing the indices refers to the i-th element of the STL-vector storing the values of the elements). Note that the stored indices are always 0-based, independent of the starting index set in C-XSC.

Definition at line 148 of file sivector.hpp.

const std::vector<int>& cxsc::sivector::row_indices ( ) const [inline]

Returns a reference to the STL-vector storing the row indices of the non zero elements.

This function is provided to allow easy interfacing to other software interfaces and efficient implementation of sparse algorithms. The user has to take care that the data remains consistent (the i-th element of the STL-vector storing the indices refers to the i-th element of the STL-vector storing the values of the elements). Note that the stored indices are always 0-based, independent of the starting index set in C-XSC.

Definition at line 167 of file sivector.hpp.

std::vector<interval>& cxsc::sivector::values ( ) [inline]

Returns a reference to the STL-vector storing the values of the non zero elements.

This function is provided to allow easy interfacing to other software interfaces and efficient implementation of sparse algorithms. The user has to take care that the data remains consistent (the i-th element of the STL-vector storing the indices refers to the i-th element of the STL-vector storing the values of the elements).

Definition at line 157 of file sivector.hpp.

const std::vector<interval>& cxsc::sivector::values ( ) const [inline]

Returns a reference to the STL-vector storing the values of the non zero elements.

This function is provided to allow easy interfacing to other software interfaces and efficient implementation of sparse algorithms. The user has to take care that the data remains consistent (the i-th element of the STL-vector storing the indices refers to the i-th element of the STL-vector storing the values of the elements).

Definition at line 176 of file sivector.hpp.


Friends And Related Function Documentation

void SetLb ( sivector v,
const int  i 
) [friend]

Sets the lower index bound of the vector v to i.

After setting the lower index bound to i, the indexing of the vector is i-based.

Definition at line 546 of file sivector.hpp.

void SetUb ( sivector v,
const int  j 
) [friend]

Sets the upper index bound of the vector v to i.

After setting the upper index bound to i, the indexing of the vector of dimension n is (i-n+1)-based.

Definition at line 555 of file sivector.hpp.


The documentation for this class was generated from the following files: