C-XSC - A C++ Class Library for Extended Scientific Computing  2.5.4
lx_ivector.hpp
1 /*
2 ** CXSC is a C++ library for eXtended Scientific Computing (V 2.5.4)
3 **
4 ** Copyright (C) 1990-2000 Institut fuer Angewandte Mathematik,
5 ** Universitaet Karlsruhe, Germany
6 ** (C) 2000-2014 Wiss. Rechnen/Softwaretechnologie
7 ** Universitaet Wuppertal, Germany
8 **
9 ** This library is free software; you can redistribute it and/or
10 ** modify it under the terms of the GNU Library General Public
11 ** License as published by the Free Software Foundation; either
12 ** version 2 of the License, or (at your option) any later version.
13 **
14 ** This library is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ** Library General Public License for more details.
18 **
19 ** You should have received a copy of the GNU Library General Public
20 ** License along with this library; if not, write to the Free
21 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 
24 /* CVS $Id: lx_ivector.hpp,v 1.9 2014/01/30 17:23:47 cxsc Exp $ */
25 
26 #ifndef _CXSC_LX_IVECTOR_HPP_INCLUDED
27 #define _CXSC_LX_IVECTOR_HPP_INCLUDED
28 
29 #include <except.hpp>
30 #include "lx_interval.hpp"
31 #include <iostream>
32 
33 namespace cxsc {
34 
36 
43 {
44  private:
45  lx_interval *dat;
46  int l,u,size;
47 
48  public:
49  //------ Konstruktoren ----------------------------------------------------
50 
52  inline lx_ivector () throw();
53 
58  explicit inline lx_ivector(int i) throw();
59 
61  explicit inline lx_ivector(int i1, int i2)
62 #if(CXSC_INDEX_CHECK)
63  throw(ERROR_IVECTOR_WRONG_BOUNDARIES,ERROR_IVECTOR_NO_MORE_MEMORY);
64 #else
65  throw();
66 #endif
67 
69  explicit inline lx_ivector(const lx_interval &) throw();
71  explicit inline lx_ivector(const l_interval &) throw();
73  explicit inline lx_ivector(const interval &) throw();
75  explicit inline lx_ivector(const lx_real &) throw();
77  explicit inline lx_ivector(const l_real &) throw();
79  explicit inline lx_ivector(const real &) throw();
80 
82  inline lx_ivector(const lx_ivector &) throw();
83 
84 
86  inline lx_ivector & operator = (const lx_ivector &) throw();
88  inline lx_ivector & operator =(const lx_interval &) throw();
90  inline lx_ivector & operator =(const l_interval &) throw();
92  inline lx_ivector & operator =(const interval &) throw();
94  inline lx_ivector & operator =(const lx_real &) throw();
96  inline lx_ivector & operator =(const l_real &) throw();
98  inline lx_ivector & operator =(const real &) throw();
99 
100  //--------- Destruktor ----------------------------------------------------
101  inline ~lx_ivector() { delete [] dat; }
102 
103 
105  inline lx_interval & operator [](const int &i)
106 #if(CXSC_INDEX_CHECK)
107  throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
108 #else
109  throw();
110 #endif
111  inline const lx_interval & operator [](const int &i) const
113 #if(CXSC_INDEX_CHECK)
114  throw(ERROR_IVECTOR_ELEMENT_NOT_IN_VEC);
115 #else
116  throw();
117 #endif
118 
119 //------ Standardfunktionen -----------------------------------------------
120 
122 friend inline int Lb(const lx_ivector &a) throw() { return a.l; }
124 friend inline int Ub(const lx_ivector &a) throw() { return a.u; }
126 friend inline int VecLen(const lx_ivector &a) throw() { return a.size; }
128 friend inline lx_ivector& SetLb(lx_ivector &a, int l) throw()
129 { a.l=l; a.u=l+a.size-1; return a; }
131 friend inline lx_ivector & SetUb(lx_ivector &a, int u) throw()
132 { a.u=u; a.l=u-a.size+1; return a; }
133 
135 friend inline void Resize(lx_ivector &rv, int lb, int ub)
136 #if(CXSC_INDEX_CHECK)
137  throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
138 #else
139  throw();
140 #endif
141 
143 friend inline void Resize(lx_ivector &rv, int len)
144 #if(CXSC_INDEX_CHECK)
145  throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
146 #else
147  throw();
148 #endif
149 
150 }; // End of class lx_ivector
151 
153 inline void DoubleSize(lx_ivector&) throw();
154 
155 inline void Resize(lx_ivector &rv, int lb, int ub)
156 #if(CXSC_INDEX_CHECK)
157  throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
158 #else
159  throw();
160 #endif
161 
162  inline void Resize(lx_ivector &rv, int len)
163 #if(CXSC_INDEX_CHECK)
164  throw(ERROR__WRONG_BOUNDARIES<lx_ivector>);
165 #else
166  throw();
167 #endif
168 
169 } // End namespace cxsc
170 
171 
172 #include "lx_ivector.inl"
173 
174 #endif
The Multiple-Precision Data Type l_interval.
Definition: l_interval.hpp:71
The Multiple-Precision Data Type l_real.
Definition: l_real.hpp:77
friend int Ub(const lx_ivector &a)
Returns the upper bound of the vector.
Definition: lx_ivector.hpp:124
The namespace cxsc, providing all functionality of the class library C-XSC.
Definition: cdot.cpp:29
lx_ivector & operator=(const lx_ivector &)
Implementation of standard assigning operator.
Definition: lx_ivector.inl:109
The Scalar Type interval.
Definition: interval.hpp:54
void DoubleSize(cimatrix &A)
Doubles the size of the matrix.
Definition: cimatrix.cpp:83
friend int VecLen(const lx_ivector &a)
Returns the dimension of the vector.
Definition: lx_ivector.hpp:126
friend lx_ivector & SetLb(lx_ivector &a, int l)
Sets the lower bound of the vector.
Definition: lx_ivector.hpp:128
friend int Lb(const lx_ivector &a)
Returns the lower bound of the vector.
Definition: lx_ivector.hpp:122
void Resize(cimatrix &A)
Resizes the matrix.
Definition: cimatrix.inl:1211
The Multiple-Precision Data Type lx_ivector.
Definition: lx_ivector.hpp:42
lx_interval & operator [](const int &i)
Operator for accessing the single elements of the vector.
Definition: lx_ivector.inl:178
friend lx_ivector & SetUb(lx_ivector &a, int u)
Sets the upper bound of the vector.
Definition: lx_ivector.hpp:131
lx_ivector()
Constructor of class lx_ivector.
Definition: lx_ivector.inl:31
friend void Resize(lx_ivector &rv, int lb, int ub)
Resizes the vector.
Definition: lx_ivector.inl:235
The Scalar Type real.
Definition: real.hpp:113