26 #ifndef _CXSC_SRVECTOR_HPP_INCLUDED 27 #define _CXSC_SRVECTOR_HPP_INCLUDED 30 #include <intvector.hpp> 31 #include <rvector.hpp> 32 #include <intmatrix.hpp> 38 #include <sparsedot.hpp> 39 #include <sparsevector.hpp> 72 explicit srvector(
const int s) : lb(1), ub(s), n(s) {
73 p.reserve((
int)(s*0.1));
74 x.reserve((
int)(s*0.1));
78 srvector(
const int s,
const int b) : lb(1), ub(s), n(s) {
85 for(
int i=lb ; i<=ub ; i++) {
96 for(
int i=0 ; i<nnz ; i++) {
97 if(values[
Lb(values)+i] != 0.0) {
98 p.push_back(index[
Lb(index)+i]);
99 x.push_back(values[
Lb(values)+i]);
108 for(
int i=0 ; i<nnz ; i++) {
109 if(values[i] != 0.0) {
110 p.push_back(index[i]);
111 x.push_back(values[i]);
155 const std::vector<real>&
values()
const {
166 return (
double)x.size()/n;
171 for(
int i=0 ; i<
get_nnz() ; i++) {
173 x.erase(x.begin()+i);
174 p.erase(p.begin()+i);
181 return sp_vs_assign<srvector,real,real>(*
this,v);
186 return spf_vv_assign<srvector,rvector,real>(*
this,v);
191 return spf_vv_assign<srvector,rvector_slice,real>(*
this,v);
203 #if(CXSC_INDEX_CHECK) 204 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector::operator[](const int)"));
208 for(k=0 ; k<
get_nnz() && p[k]<=i-lb ; k++) {
213 p.insert(p.begin() + k, i-lb);
214 x.insert(x.begin() + k, 0.0);
225 #if(CXSC_INDEX_CHECK) 226 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector::operator[](const int)"));
237 #if(CXSC_INDEX_CHECK) 238 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector::operator()(const int)"));
242 for(
int k=0 ; k<
get_nnz() && p[k]<=i-lb ; k++) {
263 std::map<int,real> work;
264 for(
int i=0 ; i<
get_nnz() ; i++)
265 work.insert(std::make_pair(pinv[
Lb(pinv)+p[i]], x[i]));
267 for(std::map<int,real>::iterator it=work.begin() ; it!=work.end() ; it++) {
268 v.p.push_back(it->first);
269 v.x.push_back(it->second);
289 return sp_vs_multassign(*
this,s);
294 return sp_vs_divassign(*
this,s);
300 return spf_vv_addassign(*
this,v);
305 return spf_vv_addassign(*
this,v);
310 return spsp_vv_addassign(*
this,v);
318 return spf_vv_subassign(*
this,v);
323 return spf_vv_subassign(*
this,v);
328 return spsp_vv_subassign(*
this,v);
375 #include "vector_friend_declarations.inl" 383 for(
int i=0 ; i<v.n ; i++)
385 for(
int i=0 ; i<v.
get_nnz() ; i++)
386 dat[v.p[i]] = v.x[i];
390 return fsp_vv_assign<rvector,srvector,real>(*
this,v);
394 return fsl_vv_assign<rvector,srvector_slice,real>(*
this,v);
404 v.ub = v.lb + v.n - 1;
413 v.lb = v.ub - v.n + 1;
455 return sp_v_negative(v);
466 return spf_vv_mult<srvector,rvector,real,sparse_dot>(v1,v2);
477 return fsp_vv_mult<rvector,srvector,real,sparse_dot>(v1,v2);
488 return spf_vv_mult<srvector,rvector_slice,real,sparse_dot>(v1,v2);
499 return fsp_vv_mult<rvector_slice,srvector,real,sparse_dot>(v1,v2);
510 return spsp_vv_mult<srvector,srvector,real,sparse_dot>(v1,v2);
515 return sp_vs_mult<srvector,real,srvector>(v,s);
520 return sp_vs_div<srvector,real,srvector>(v,s);
525 return sp_sv_mult<real,srvector,srvector>(s,v);
530 return fsp_vv_add<rvector,srvector,rvector>(v1,v2);
535 return spf_vv_add<srvector,rvector,rvector>(v1,v2);
540 return fsp_vv_add<rvector_slice,srvector,rvector>(v1,v2);
545 return spf_vv_add<srvector,rvector_slice,rvector>(v1,v2);
550 return spsp_vv_add<srvector,srvector,srvector,real>(v1,v2);
555 return fsp_vv_sub<rvector,srvector,rvector>(v1,v2);
560 return spf_vv_sub<srvector,rvector,rvector>(v1,v2);
565 return fsp_vv_sub<rvector_slice,srvector,rvector>(v1,v2);
570 return spf_vv_sub<srvector,rvector_slice,rvector>(v1,v2);
575 return spsp_vv_sub<srvector,srvector,srvector,real>(v1,v2);
579 return fsp_vv_addassign(*
this,v2);
583 return fsp_vv_addassign(*
this,v2);
587 return fsp_vv_subassign(*
this,v2);
591 return fsp_vv_subassign(*
this,v2);
599 return spsp_vv_comp(v1,v2);
607 return spf_vv_comp(v1,v2);
615 return fsp_vv_comp(v1,v2);
623 return spf_vv_comp(v1,v2);
631 return fsp_vv_comp(v1,v2);
639 return !spsp_vv_comp(v1,v2);
647 return !spf_vv_comp(v1,v2);
655 return !fsp_vv_comp(v1,v2);
663 return !spf_vv_comp(v1,v2);
671 return !fsp_vv_comp(v1,v2);
679 return spsp_vv_less<srvector,srvector,real>(v1,v2);
687 return spf_vv_less<srvector,rvector,real>(v1,v2);
695 return fsp_vv_less<rvector,srvector,real>(v1,v2);
703 return spf_vv_less<srvector,rvector_slice,real>(v1,v2);
711 return fsp_vv_less<rvector_slice,srvector,real>(v1,v2);
719 return spsp_vv_leq<srvector,srvector,real>(v1,v2);
727 return spf_vv_leq<srvector,rvector,real>(v1,v2);
735 return fsp_vv_leq<rvector,srvector,real>(v1,v2);
743 return spf_vv_leq<srvector,rvector_slice,real>(v1,v2);
751 return fsp_vv_leq<rvector_slice,srvector,real>(v1,v2);
759 return spsp_vv_greater<srvector,srvector,real>(v1,v2);
767 return spf_vv_greater<srvector,rvector,real>(v1,v2);
775 return fsp_vv_greater<rvector,srvector,real>(v1,v2);
783 return spf_vv_greater<srvector,rvector_slice,real>(v1,v2);
791 return fsp_vv_greater<rvector_slice,srvector,real>(v1,v2);
799 return spsp_vv_geq<srvector,srvector,real>(v1,v2);
807 return spf_vv_geq<srvector,rvector,real>(v1,v2);
815 return fsp_vv_geq<rvector,srvector,real>(v1,v2);
823 return spf_vv_geq<srvector,rvector_slice,real>(v1,v2);
831 return fsp_vv_geq<rvector_slice,srvector,real>(v1,v2);
848 inline std::ostream& operator<<(std::ostream& os,
const srvector& v) {
849 return sp_v_output<srvector,real>(os,v);
858 inline std::istream& operator>>(std::istream& is,
srvector& v) {
859 return sp_v_input<srvector,real>(is,v);
871 std::vector<real>& x;
888 for(i=0 ; i<v.
get_nnz() && p[i]<lb-v.lb ; i++);
892 for(i=start ; i<v.
get_nnz() && p[i]<=ub-v.lb ; i++);
907 return (
double)nnz/n;
916 #if(CXSC_INDEX_CHECK) 917 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector_slice::operator[](const int)"));
921 for(k=start ; k<end+1 && p[k]-start<=i-lb ; k++) {
922 if(p[k]-offset == i-lb)
926 p.insert(p.begin() + k, i-lb);
927 x.insert(x.begin() + k, 0.0);
939 #if(CXSC_INDEX_CHECK) 940 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector_slice::operator[](const int)"));
951 #if(CXSC_INDEX_CHECK) 952 if(i<lb || i>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector_slice::operator()(const int)"));
956 for(
int k=start ; k<end && p[k]-start<=i-lb ; k++) {
957 if(p[k]-start == i-lb)
966 return sl_vs_assign<srvector_slice,real,real,std::vector<real>::iterator>(*
this,v);
971 return slsl_vv_assign<srvector_slice,srvector_slice,real,std::vector<real>::iterator>(*
this,v);
976 return slsp_vv_assign<srvector_slice,srvector,real,std::vector<real>::iterator>(*
this,v);
981 return slf_vv_assign<srvector_slice,rvector,real,std::vector<real>::iterator>(*
this,v);
986 return slf_vv_assign<srvector_slice,rvector,real,std::vector<real>::iterator>(*
this,v);
991 return sl_vs_multassign(*
this,s);
996 return sl_vs_divassign(*
this,s);
1001 return slf_vv_addassign<srvector_slice,rvector,real>(*
this,v);
1006 return slf_vv_addassign<srvector_slice,rvector_slice,real>(*
this,v);
1011 return slsp_vv_addassign(*
this,v);
1016 return slsl_vv_addassign(*
this,v);
1021 return slf_vv_subassign<srvector_slice,rvector,real>(*
this,v);
1026 return slf_vv_subassign<srvector_slice,rvector_slice,real>(*
this,v);
1031 return slsp_vv_subassign(*
this,v);
1036 return slsl_vv_subassign(*
this,v);
1061 #include "vector_friend_declarations.inl" 1068 dat =
new real[v.n];
1069 for(
int i=0 ; i<v.n ; i++)
1071 for(
int i=v.start ; i<=v.end ; i++)
1072 dat[v.p[i]] = v.x[i];
1089 for(
int i=s.start ; i<=s.end ; i++) {
1090 p.push_back(s.p[i]-s.offset);
1091 x.push_back(s.x[i]);
1097 return spsl_vv_assign<srvector,srvector_slice,real>(*
this,v);
1101 #if(CXSC_INDEX_CHECK) 1102 if(i<lb || j>ub) cxscthrow(ELEMENT_NOT_IN_VEC(
"srvector::operator()(const int,const int)"));
1109 return sl_v_negative<srvector_slice,srvector>(v);
1130 std::vector<real>& x = ret.
values();
1131 for(
unsigned int i=0 ; i<x.size() ; i++)
1144 return slf_vv_mult<srvector_slice,rvector,real,sparse_dot>(v1,v2);
1154 return fsl_vv_mult<rvector,srvector_slice,real,sparse_dot>(v1,v2);
1164 return slf_vv_mult<srvector_slice,rvector_slice,real,sparse_dot>(v1,v2);
1174 return fsl_vv_mult<rvector_slice,srvector_slice,real,sparse_dot>(v1,v2);
1184 return spsl_vv_mult<srvector,srvector_slice,real,sparse_dot>(v1,v2);
1194 return slsp_vv_mult<srvector_slice,srvector,real,sparse_dot>(v1,v2);
1204 return slsl_vv_mult<srvector_slice,srvector_slice,real,sparse_dot>(v1,v2);
1209 return sp_vs_mult<srvector_slice,real,srvector>(v,s);
1214 return sp_vs_div<srvector_slice,real,srvector>(v,s);
1219 return sp_sv_mult<real,srvector_slice,srvector>(s,v);
1224 return fsl_vv_add<rvector,srvector_slice,rvector>(v1,v2);
1229 return slf_vv_add<srvector_slice,rvector,rvector>(v1,v2);
1234 return fsl_vv_add<rvector_slice,srvector_slice,rvector>(v1,v2);
1239 return slf_vv_add<srvector_slice,rvector_slice,rvector>(v1,v2);
1244 return slsl_vv_add<srvector_slice,srvector_slice,srvector,real>(v1,v2);
1249 return spsl_vv_add<srvector,srvector_slice,srvector,real>(v1,v2);
1254 return slsp_vv_add<srvector_slice,srvector,srvector,real>(v1,v2);
1259 return fsl_vv_sub<rvector,srvector_slice,rvector>(v1,v2);
1264 return slf_vv_sub<srvector_slice,rvector,rvector>(v1,v2);
1269 return fsl_vv_sub<rvector_slice,srvector_slice,rvector>(v1,v2);
1274 return slf_vv_sub<srvector_slice,rvector_slice,rvector>(v1,v2);
1279 return slsl_vv_sub<srvector_slice,srvector_slice,srvector,real>(v1,v2);
1284 return spsl_vv_sub<srvector,srvector_slice,srvector,real>(v1,v2);
1289 return slsp_vv_sub<srvector_slice,srvector,srvector,real>(v1,v2);
1293 return fsl_vv_addassign(*
this,v2);
1297 return fsl_vv_addassign(*
this,v2);
1301 return spsl_vv_addassign(*
this,v2);
1305 return fsl_vv_subassign(*
this,v2);
1309 return fsl_vv_subassign(*
this,v2);
1313 return spsl_vv_subassign(*
this,v2);
1321 return slsl_vv_comp(v1,v2);
1329 return slsp_vv_comp(v1,v2);
1337 return spsl_vv_comp(v1,v2);
1345 return slf_vv_comp(v1,v2);
1353 return fsl_vv_comp(v1,v2);
1361 return slf_vv_comp(v1,v2);
1369 return fsl_vv_comp(v1,v2);
1377 return !slsl_vv_comp(v1,v2);
1385 return !slf_vv_comp(v1,v2);
1393 return !fsl_vv_comp(v1,v2);
1401 return !slsp_vv_comp(v1,v2);
1409 return !spsl_vv_comp(v1,v2);
1417 return !slf_vv_comp(v1,v2);
1425 return !fsl_vv_comp(v1,v2);
1433 return slsl_vv_less<srvector_slice,srvector_slice,real>(v1,v2);
1441 return slsp_vv_less<srvector_slice,srvector,real>(v1,v2);
1449 return spsl_vv_less<srvector,srvector_slice,real>(v1,v2);
1457 return slf_vv_less<srvector_slice,rvector,real>(v1,v2);
1465 return fsl_vv_less<rvector,srvector_slice,real>(v1,v2);
1473 return slf_vv_less<srvector_slice,rvector_slice,real>(v1,v2);
1481 return fsl_vv_less<rvector_slice,srvector_slice,real>(v1,v2);
1489 return slsl_vv_leq<srvector_slice,srvector_slice,real>(v1,v2);
1497 return slsp_vv_leq<srvector_slice,srvector,real>(v1,v2);
1505 return spsl_vv_leq<srvector,srvector_slice,real>(v1,v2);
1513 return slf_vv_leq<srvector_slice,rvector,real>(v1,v2);
1521 return fsl_vv_leq<rvector,srvector_slice,real>(v1,v2);
1529 return slf_vv_leq<srvector_slice,rvector_slice,real>(v1,v2);
1537 return fsl_vv_leq<rvector_slice,srvector_slice,real>(v1,v2);
1545 return slsl_vv_greater<srvector_slice,srvector_slice,real>(v1,v2);
1553 return slsp_vv_greater<srvector_slice,srvector,real>(v1,v2);
1561 return spsl_vv_greater<srvector,srvector_slice,real>(v1,v2);
1569 return slf_vv_greater<srvector_slice,rvector,real>(v1,v2);
1577 return fsl_vv_greater<rvector,srvector_slice,real>(v1,v2);
1585 return slf_vv_greater<srvector_slice,rvector_slice,real>(v1,v2);
1593 return fsl_vv_greater<rvector_slice,srvector_slice,real>(v1,v2);
1601 return slsl_vv_geq<srvector_slice,srvector_slice,real>(v1,v2);
1609 return slsp_vv_geq<srvector_slice,srvector,real>(v1,v2);
1617 return spsl_vv_geq<srvector,srvector_slice,real>(v1,v2);
1625 return slf_vv_geq<srvector_slice,rvector,real>(v1,v2);
1633 return fsl_vv_geq<rvector,srvector_slice,real>(v1,v2);
1641 return slf_vv_geq<srvector_slice,rvector_slice,real>(v1,v2);
1649 return fsl_vv_geq<rvector_slice,srvector_slice,real>(v1,v2);
1667 return sl_v_output<srvector_slice, real>(os,v);
1677 return sl_v_input<srvector_slice, real>(is,v);
1685 spsp_vv_accu<dotprecision,srvector,srvector,sparse_dot>(dot,x,y);
1693 spf_vv_accu<dotprecision,srvector,rvector,sparse_dot>(dot,x,y);
1701 spf_vv_accu<dotprecision,srvector,rvector_slice,sparse_dot>(dot,x,y);
1709 fsp_vv_accu<dotprecision,rvector,srvector,sparse_dot>(dot,x,y);
1717 fsp_vv_accu<dotprecision,rvector_slice,srvector,sparse_dot>(dot,x,y);
1725 slf_vv_accu<dotprecision,srvector_slice,rvector,sparse_dot>(dot,x,y);
1733 slf_vv_accu<dotprecision,srvector_slice,rvector_slice,sparse_dot>(dot,x,y);
1741 fsl_vv_accu<dotprecision,rvector,srvector_slice,sparse_dot>(dot,x,y);
1749 fsl_vv_accu<dotprecision,rvector_slice,srvector_slice,sparse_dot>(dot,x,y);
1757 slsl_vv_accu<dotprecision,srvector_slice,srvector_slice,sparse_dot>(dot,x,y);
1765 spsl_vv_accu<dotprecision,srvector,srvector_slice,sparse_dot>(dot,x,y);
1773 slsp_vv_accu<dotprecision,srvector_slice,srvector,sparse_dot>(dot,x,y);
1782 spsp_vv_accuapprox<dotprecision,srvector,srvector,sparse_dot>(dot,x,y);
1791 spf_vv_accuapprox<dotprecision,srvector,rvector,sparse_dot>(dot,x,y);
1800 spf_vv_accuapprox<dotprecision,srvector,rvector_slice,sparse_dot>(dot,x,y);
1809 fsp_vv_accuapprox<dotprecision,rvector,srvector,sparse_dot>(dot,x,y);
1818 fsp_vv_accuapprox<dotprecision,rvector_slice,srvector,sparse_dot>(dot,x,y);
1827 slf_vv_accuapprox<dotprecision,srvector_slice,rvector,sparse_dot>(dot,x,y);
1836 slf_vv_accuapprox<dotprecision,srvector_slice,rvector_slice,sparse_dot>(dot,x,y);
1845 fsl_vv_accuapprox<dotprecision,rvector,srvector_slice,sparse_dot>(dot,x,y);
1854 fsl_vv_accuapprox<dotprecision,rvector_slice,srvector_slice,sparse_dot>(dot,x,y);
1863 slsl_vv_accuapprox<dotprecision,srvector_slice,srvector_slice,sparse_dot>(dot,x,y);
1872 spsl_vv_accuapprox<dotprecision,srvector,srvector_slice,sparse_dot>(dot,x,y);
1881 slsp_vv_accuapprox<dotprecision,srvector_slice,srvector,sparse_dot>(dot,x,y);
1891 accumulate(tmp,x,y);
1902 accumulate(tmp,x,y);
1913 accumulate(tmp,x,y);
1924 accumulate(tmp,x,y);
1935 accumulate(tmp,x,y);
1946 accumulate(tmp,x,y);
1957 accumulate(tmp,x,y);
1968 accumulate(tmp,x,y);
1979 accumulate(tmp,x,y);
1990 accumulate(tmp,x,y);
2001 accumulate(tmp,x,y);
2012 accumulate(tmp,x,y);
2023 accumulate(tmp,x,y);
2034 accumulate(tmp,x,y);
2045 accumulate(tmp,x,y);
2056 accumulate(tmp,x,y);
2067 accumulate(tmp,x,y);
2078 accumulate(tmp,x,y);
2089 accumulate(tmp,x,y);
2100 accumulate(tmp,x,y);
2111 accumulate(tmp,x,y);
2122 accumulate(tmp,x,y);
2133 accumulate(tmp,x,y);
2144 accumulate(tmp,x,y);
2299 accumulate(tmp,x,y);
2310 accumulate(tmp,x,y);
2321 accumulate(tmp,x,y);
2332 accumulate(tmp,x,y);
2343 accumulate(tmp,x,y);
2354 accumulate(tmp,x,y);
2365 accumulate(tmp,x,y);
2376 accumulate(tmp,x,y);
2387 accumulate(tmp,x,y);
2398 accumulate(tmp,x,y);
2409 accumulate(tmp,x,y);
2420 accumulate(tmp,x,y);
2427 #include "sparsevector.inl" void set_k(unsigned int i)
Set precision for computation of dot products.
real & operator[](const int i)
Returns a reference to the i-th (according to the currently used indexing) element of the vector slic...
rvector_slice & operator-=(const rvector &rv)
Implementation of subtraction and allocation operation.
friend srvector InfIm(const scivector &)
Returns the infimum of the imaginary part of the complex interval vector as a new sparse point vector...
std::vector< real > & values()
Returns a reference to the STL-vector storing the values of the non zero elements.
srvector_slice & operator=(const rvector_slice &v)
Overwrite the vector slice with the elements of v.
The Data Type idotprecision.
Helper class for slices of sparse vectors.
int get_nnz() const
Returns the number of non zero elements of this vector slice (note that this includes explicitly stor...
The Data Type dotprecision.
int get_nnz() const
Returns the number of non zero elements of this vector (note that this includes explicitly stored zer...
srvector()
Default constructor, creates an empty vector of size 0.
srvector & operator+=(const rvector_slice &v)
Operator for element-wise addition with a vector, result is assigned to the vector.
rvector & operator=(const rvector &rv)
Implementation of standard assigning operator.
friend srvector absmax(const sivector &)
Computes the component-wise maximum absolute values for a vector v.
friend int Ub(const srvector &)
Returns the upper index bound of the vector v.
const std::vector< int > & row_indices() const
Returns a reference to the STL-vector storing the row indices of the non zero elements.
srvector & operator=(const rvector &v)
Assign the dense vector v to a sparse vector. Only the non zero elements of v are used...
srvector & operator-=(const rvector_slice &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector.
The namespace cxsc, providing all functionality of the class library C-XSC.
civector operator*(const cimatrix_subv &rv, const cinterval &s)
Implementation of multiplication operation.
friend srvector InfRe(const scivector &)
Returns the infimum of the real part of the complex interval vector as a new sparse point vector...
friend srvector Inf(const sivector &)
Returns the infimum of the interval vector as a new sparse point vector.
real operator[](const int i) const
Returns a copy of the i-th (according to the currently used indexing) element of the vector slice...
srvector_slice & operator=(const srvector &v)
Overwrite the vector slice with the elements of v.
friend void SetLb(srvector &, const int)
Sets the lower index bound of the vector v to i.
A sparse interval vector.
friend void SetUb(srvector &, const int)
Sets the upper index bound of the vector v to i.
srvector_slice & operator=(const srvector_slice &v)
Overwrite the vector slice with the elements of v.
int get_k() const
Get currently set precision for computation of dot products.
friend srvector mid(const sivector &)
Compute the midpoint vector of v.
void accumulate_approx(cdotprecision &dp, const cmatrix_subv &rv1, const cmatrix_subv &rv2)
The accurate scalar product of the last two arguments added to the value of the first argument (witho...
srvector & operator+=(const rvector &v)
Operator for element-wise addition with a vector, result is assigned to the vector.
srvector operator()(const intmatrix &P)
Returns a vector whose elemnts are rearranged according to a given permutation matrix.
const std::vector< real > & values() const
Returns a reference to the STL-vector storing the values of the non zero elements.
A sparse complex interval vector.
srvector & operator=(const real &v)
Assigns v to all elements of the vector (resulting in a dense vector!)
srvector & operator-=(const rvector &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector.
The Data Type ivector_slice.
srvector_slice & operator+=(const rvector_slice &v)
Operator for element-wise addition with a vector, result is assigned to the vector slice...
The Data Type cidotprecision.
friend srvector absmin(const sivector &)
Computes the component-wise minimum absolute values for a vector v.
srvector_slice & operator=(const real &v)
Assigns v to all elements of the vector slice.
srvector(const int n, const int nnz, const intvector &index, const rvector &values)
Creates a sparse vector of dimension n with nnz non zeros, who are defined by the elements of index a...
The Data Type rvector_slice.
srvector_slice & operator+=(const srvector_slice &v)
Operator for element-wise addition with a vector, result is assigned to the vector slice...
real density() const
Returns the density of the vector slice (the number of non zero elements divided by the number of ele...
srvector(const rvector &v)
Constructor for creating a sparse vector our of a dense vector v. Only the non-zero elements of v are...
rvector_slice & operator=(const rvector_slice &sl)
Implementation of standard assigning operator.
srvector_slice & operator-=(const srvector_slice &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector slice...
friend int Lb(const srvector &)
Returns the lower index bound of the vector v.
std::vector< int > & row_indices()
Returns a reference to the STL-vector storing the row indices of the non zero elements.
srvector(const int n, const int nnz, const int *index, const real *values)
Creates a sparse vector of dimension n with nnz non zeros, who are defined by the elements of index a...
A slice of a sparse real matrix.
friend srvector abs(const srvector &)
Returns the vector whose elements are the respective absolute values of the elements of v...
The Data Type cdotprecision.
srvector & operator+=(const srvector &v)
Operator for element-wise addition with a vector, result is assigned to the vector.
real operator[](const int i) const
Returns a copy of the i-th (according to the currently used indexing) element of the vector...
srvector_slice & operator-=(const rvector_slice &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector slice...
void Resize(cimatrix &A)
Resizes the matrix.
srvector(const int s)
Constructor for creating an empty vector of size s.
int get_k() const
Get currently set precision for computation of dot products.
Helper class for slices of sparse vectors.
srvector(const int s, const int b)
Constructor for creating an empty vector of size s and reserving memory for b elements.
Represents a row or column vector of a sparse matrix.
The Data Type civector_slice.
srvector_slice & operator-=(const srvector &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector slice...
friend srvector SupIm(const scivector &)
Returns the supremum of the imaginary part of the complex interval vector as a new sparse point vecto...
friend srvector Re(const scvector &)
Returns the real part of the complex vector v.
int get_k() const
Get currently set precision for computation of dot products.
srvector_slice & operator*=(const real &s)
Operator for multiplication with a scalar, result is assigned to the vector slice.
srvector & operator-=(const srvector &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector.
srvector_slice & operator+=(const srvector &v)
Operator for element-wise addition with a vector, result is assigned to the vector slice...
srvector & operator=(const rvector_slice &v)
Assign the dense vector slice v to a sparse vector. Only the non zero elements of v are used...
friend int VecLen(const srvector &)
Returns the length of the vector (the dimension)
friend srvector Sup(const sivector &)
Returns the supremum of the interval vector as a new sparse point vector.
real density() const
Returns the density of the vector (the number of non zero elements divided by the number of elements)...
rvector()
Constructor of class rvector.
Helper class for slices of sparse vectors.
rvector & operator-=(const srvector &rv)
Implementation of addition and allocation operation.
friend srvector Im(const scvector &)
Returns the imaginary part of the complex vector v.
Helper class for slices of sparse vectors.
real & operator[](const int i)
Returns a reference to the i-th (according to the currently used indexing) element of the vector...
const real operator()(const int i) const
Returns a copy of the i-th (according to the currently used indexing) element of the vector...
civector operator/(const cimatrix_subv &rv, const cinterval &s)
Implementation of division operation.
The Data Type cvector_slice.
srvector_slice & operator-=(const rvector &v)
Operator for element-wise subtraction with a vector, result is assigned to the vector slice...
void dropzeros()
Erases explicitly stored zeros from the data structure.
rvector_slice & operator+=(const rvector &rv)
Implementation of addition and allocation operation.
srvector_slice & operator+=(const rvector &v)
Operator for element-wise addition with a vector, result is assigned to the vector slice...
srvector & operator*=(const real &s)
Operator for multiplication with a scalar, result is assigned to the vector.
rvector & operator+=(const srvector &rv)
Implementation of addition and allocation operation.
srvector operator()(const intvector &per)
Returns a vector whose elemnts are rearranged according to a given permutation vector.
friend srvector SupRe(const scivector &)
Returns the supremum of the real part of the complex interval vector as a new sparse point vector...
srvector_slice & operator/=(const real &s)
Operator for division of each element of the vector slice with a scalar, result is assigned to the ve...
srvector_slice & operator=(const rvector &v)
Overwrite the vector slice with the elements of v.
const real operator()(const int i) const
Returns a copy of the i-th (according to the currently used indexing) element of the vector slice...
friend srvector diam(const sivector &)
Computes the diameter of v.
srvector & operator/=(const real &s)
Operator for division of each element of the vector with a scalar, result is assigned to the vector...