CXSC  A C++ Class Library for Extended Scientific Computing
2.5.4

Helper class for slices of sparse vectors. More...
#include <srvector.hpp>
Public Member Functions  
real  density () const 
Returns the density of the vector slice (the number of non zero elements divided by the number of elements)  
int  get_nnz () const 
Returns the number of non zero elements of this vector slice (note that this includes explicitly stored zeros)  
const real  operator() (const int i) const 
Returns a copy of the ith (according to the currently used indexing) element of the vector slice.  
srvector_slice &  operator*= (const real &s) 
Operator for multiplication with a scalar, result is assigned to the vector slice.  
srvector_slice &  operator+= (const rvector &v) 
Operator for elementwise addition with a vector, result is assigned to the vector slice.  
srvector_slice &  operator+= (const rvector_slice &v) 
Operator for elementwise addition with a vector, result is assigned to the vector slice.  
srvector_slice &  operator+= (const srvector &v) 
Operator for elementwise addition with a vector, result is assigned to the vector slice.  
srvector_slice &  operator+= (const srvector_slice &v) 
Operator for elementwise addition with a vector, result is assigned to the vector slice.  
srvector_slice &  operator= (const rvector &v) 
Operator for elementwise subtraction with a vector, result is assigned to the vector slice.  
srvector_slice &  operator= (const rvector_slice &v) 
Operator for elementwise subtraction with a vector, result is assigned to the vector slice.  
srvector_slice &  operator= (const srvector &v) 
Operator for elementwise subtraction with a vector, result is assigned to the vector slice.  
srvector_slice &  operator= (const srvector_slice &v) 
Operator for elementwise subtraction with a vector, result is assigned to the vector slice.  
srvector_slice &  operator/= (const real &s) 
Operator for division of each element of the vector slice with a scalar, result is assigned to the vector slice.  
srvector_slice &  operator= (const real &v) 
Assigns v to all elements of the vector slice.  
srvector_slice &  operator= (const srvector_slice &v) 
Overwrite the vector slice with the elements of v.  
srvector_slice &  operator= (const srvector &v) 
Overwrite the vector slice with the elements of v.  
srvector_slice &  operator= (const rvector &v) 
Overwrite the vector slice with the elements of v.  
srvector_slice &  operator= (const rvector_slice &v) 
Overwrite the vector slice with the elements of v.  
real &  operator[] (const int i) 
Returns a reference to the ith (according to the currently used indexing) element of the vector slice.  
real  operator[] (const int i) const 
Returns a copy of the ith (according to the currently used indexing) element of the vector slice.  
Friends  
int  Lb (const srvector_slice &) 
Returns the lower index bound of the vector slice v.  
srvector  operator* (const srmatrix &, const srvector_slice &) 
Returns the product of the matrix A and the vector v.  
srvector  operator* (const srmatrix_slice &, const srvector_slice &) 
Returns the product of the matrix M and the vector v.  
int  Ub (const srvector_slice &) 
Returns the upper index bound of the vector slice v.  
int  VecLen (const srvector_slice &) 
Returns the length of the vector slice. 
Helper class for slices of sparse vectors.
This class stores a reference to a sparse vector and operates on a slice of it. This class is used internally by CXSC, it should normally not be necessary for the user to use it explicitly.
Definition at line 868 of file srvector.hpp.
const real cxsc::srvector_slice::operator()  (  const int  i  )  const [inline] 
Returns a copy of the ith (according to the currently used indexing) element of the vector slice.
If the ith 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 readonly access to the elements of a sparse vector slice.
Definition at line 950 of file srvector.hpp.
real& cxsc::srvector_slice::operator[]  (  const int  i  )  [inline] 
Returns a reference to the ith (according to the currently used indexing) element of the vector slice.
If the ith 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 the []operator should only be used for write access to the elements of a sparse vector. Use the ()operator for read access.
Definition at line 915 of file srvector.hpp.
real cxsc::srvector_slice::operator[]  (  const int  i  )  const [inline] 
Returns a copy of the ith (according to the currently used indexing) element of the vector slice.
If the ith element is explicitly stored, a copy to the value is returned. If is not explicitly stored, zero will be returned. This is the constversion of this operator, added for convenience. It is suggested to use the ()operator for read access.
Definition at line 938 of file srvector.hpp.
srvector operator*  (  const srmatrix &  A, 
const srvector_slice &  v  
)  [friend] 
Returns the product of the matrix A and the vector v.
Note that the precision used for the computation is set by the global variable opdotprec. By default it is set to 0, meaning maximum accuracy (this is also the slowest option). To use standard floating point operations, set opdotprec=1. Setting opdotprec to K>=2 uses (simulated) Kfold double precision.
Definition at line 1038 of file srmatrix.hpp.
srvector operator*  (  const srmatrix_slice &  M, 
const srvector_slice &  v  
)  [friend] 
Returns the product of the matrix M and the vector v.
Note that the precision used for the computation is set by the global variable opdotprec. By default it is set to 0, meaning maximum accuracy (this is also the slowest option). To use standard floating point operations, set opdotprec=1. Setting opdotprec to K>=2 uses (simulated) Kfold double precision.
Definition at line 1766 of file srmatrix.hpp.