SoPlex Doxygen Documentation
dvector_exact.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the class library */
4 /* SoPlex --- the Sequential object-oriented simPlex. */
5 /* */
6 /* Copyright (C) 1996 Roland Wunderling */
7 /* 1996-2012 Konrad-Zuse-Zentrum */
8 /* fuer Informationstechnik Berlin */
9 /* */
10 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
11 /* */
12 /* You should have received a copy of the ZIB Academic License */
13 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
14 /* */
15 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16 
17 /**@file dvector_exact.h
18  * @brief Dynamic vectors of MpqReal.
19  */
20 #ifndef _DVECTOR_EXACT_H_
21 #define _DVECTOR_EXACT_H_
22 
23 #include <iostream>
24 #include <assert.h>
25 
26 #include "spxdefines.h"
27 #include "mpqreal.h"
28 #include "vector_exact.h"
29 #include "vector.h"
30 #include "svector.h"
31 
32 namespace soplex
33 {
34 /**@brief Dynamic vectors of MpqReal.
35  * @ingroup Algebra
36  *
37  * Class DVector_exact is a copy of class DVector replacing the floating point type Real with the exact MpqReal.
38  */
40 {
41  //-----------------------------------
42  /**@name Data */
43  //@{
44  int memsize; ///< length of array of values \ref soplex::DVector::mem "mem"
45  MpqReal* mem; ///< value array to be used
46  //@}
47 
48 public:
49 
50  //--------------------------------------------------
51  /**@name Access */
52  //@{
53  /// resets \ref soplex::DVector "DVector"'s dimension to \p newdim.
54  void reDim(int newdim);
55 
56  /// resets \ref soplex::DVector "DVector"'s memory size to \p newsize.
57  void reSize(int newsize);
58 
59  /// resets \ref soplex::DVector "DVector"'s memory size to \p newsize and dimension to \p newdim.
60  void reSize(int newsize, int newdim);
61 
62  /// returns \ref soplex::DVector "DVector"'s memory size.
63  int memSize() const
64  {
65  return memsize;
66  }
67 
68  /// consistency check.
69  bool isConsistent() const;
70  //@}
71 
72  //--------------------------------------------------
73  /**@name Construction / destruction */
74  //@{
75  /// default constructor. \p dim is the initial dimension.
76  explicit
77  DVector_exact(int dim = 0);
78  /// copy constructor.
79  explicit DVector_exact(const Vector& old);
80  /// copy constructor.
81  explicit DVector_exact(const Vector_exact& old);
82  /// copy constructor.
83  DVector_exact(const DVector_exact& old);
84  /// assignment operator.
86  {
87  if( this != &vec )
88  {
89  if ( vec.dim() != dim() )
90  reDim(vec.dim());
92 
93  assert(isConsistent());
94  }
95 
96  return *this;
97  }
98  /// assignment operator.
100  {
101  if( vec.dim() != dim() )
102  reDim(vec.dim());
104 
105  assert(isConsistent());
106 
107  return *this;
108  }
109  /// assignment operator.
111  {
112  if( vec.dim() != dim() )
113  reDim(vec.dim());
115 
116  assert(isConsistent());
117 
118  return *this;
119  }
120  /// assignment operator.
122  {
123  if( vec.dim() != dim() )
124  reDim(vec.dim());
126 
127  assert(isConsistent());
128 
129  return *this;
130  }
131 
132  /// destructor.
133  ~DVector_exact();
134 };
135 } // namespace soplex
136 #endif // _DVECTOR_EXACT_H_
137 
138 //-----------------------------------------------------------------------------
139 //Emacs Local Variables:
140 //Emacs mode:c++
141 //Emacs c-basic-offset:3
142 //Emacs tab-width:8
143 //Emacs indent-tabs-mode:nil
144 //Emacs End:
145 //-----------------------------------------------------------------------------