SoPlex Doxygen Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
src
dvector_exact.cpp
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
18
#include "
spxdefines.h
"
19
#include "
dvector_exact.h
"
20
#include "
spxalloc.h
"
21
22
namespace
soplex
23
{
24
25
void
DVector_exact::reSize
(
int
newsize)
26
{
27
reSize
(newsize,
dim
());
28
}
29
30
void
DVector_exact::reSize
(
int
newsize,
int
newdim)
31
{
32
assert(newsize >= newdim);
33
34
if
( newsize >
memsize
)
35
{
36
MpqReal
* olddata =
mem
;
37
38
mem
=
new
MpqReal
[newsize]();
39
assert(
mem
!= 0);
40
41
if
(
dimen
> 0 )
42
{
43
for
(
int
i = 0; i <
dimen
; i++ )
44
mem
[i] = olddata[i];
45
46
delete
[] olddata;
47
}
48
}
49
50
val
=
mem
;
51
memsize
= newsize;
52
dimen
= newdim;
53
}
54
55
void
DVector_exact::reDim
(
int
newdim)
56
{
57
assert(
memsize
>= 0);
58
59
if
( newdim >
memsize
)
60
{
61
reSize
(
int
(newdim + 0.2 *
memsize
));
62
}
63
64
for
(
int
i =
dimen
; i < newdim; i++ )
65
mem
[i] = 0;
66
67
dimen
= newdim;
68
}
69
70
DVector_exact::DVector_exact
(
const
DVector_exact
& old)
71
:
Vector_exact
(0, 0)
72
, mem(0)
73
{
74
dimen
= old.
dim
();
75
memsize
= old.
memsize
;
76
77
mem
=
new
MpqReal
[
memsize
]();
78
assert(
mem
!= 0);
79
80
val
=
mem
;
81
*
this
= old;
82
83
assert(
DVector_exact::isConsistent
());
84
}
85
86
DVector_exact::DVector_exact
(
const
Vector_exact
& old)
87
:
Vector_exact
(0, 0)
88
, mem(0)
89
{
90
dimen
= old.
dim
();
91
memsize
=
dimen
;
92
93
mem
=
new
MpqReal
[
memsize
]();
94
assert(
mem
!= 0);
95
96
val
=
mem
;
97
*
this
= old;
98
99
assert(
DVector_exact::isConsistent
());
100
}
101
102
DVector_exact::DVector_exact
(
const
Vector
& old)
103
:
Vector_exact
(0, 0)
104
, mem(0)
105
{
106
dimen
= old.
dim
();
107
memsize
=
dimen
;
108
109
mem
=
new
MpqReal
[
memsize
]();
110
assert(
mem
!= 0);
111
112
val
=
mem
;
113
Vector_exact::operator=
(old);
114
115
assert(
DVector_exact::isConsistent
());
116
}
117
118
DVector_exact::DVector_exact
(
int
p_dim)
119
:
Vector_exact
(0, 0)
120
, mem(0)
121
{
122
memsize
= (p_dim > 0) ? p_dim : 4;
123
124
mem
=
new
MpqReal
[
memsize
]();
125
assert(
mem
!= 0);
126
127
val
=
mem
;
128
dimen
= p_dim;
129
130
assert(
DVector_exact::isConsistent
());
131
}
132
133
DVector_exact::~DVector_exact
()
134
{
135
if
(
mem
!= 0 )
136
delete
[]
mem
;
137
}
138
139
bool
DVector_exact::isConsistent
()
const
140
{
141
#ifdef ENABLE_CONSISTENCY_CHECKS
142
if
(
val
!=
mem
||
dimen
>
memsize
||
dimen
< 0 )
143
return
MSGinconsistent
(
"DVector_exact"
);
144
145
return
Vector_exact::isConsistent
();
146
#else
147
return
true
;
148
#endif
149
}
150
}
// namespace soplex
151
152
//-----------------------------------------------------------------------------
153
//Emacs Local Variables:
154
//Emacs mode:c++
155
//Emacs c-basic-offset:3
156
//Emacs tab-width:8
157
//Emacs indent-tabs-mode:nil
158
//Emacs End:
159
//-----------------------------------------------------------------------------
© 2003-2013 by Zuse Institute Berlin (ZIB),
Imprint
Generated on Wed Jan 9 2013 for SoPlex by
doxygen