Main Page
Classes
Files
File List
File Members
opt
build
clp
clp-1.12.0
Clp
src
ClpCholeskyBase.hpp
Go to the documentation of this file.
1
/* $Id: ClpCholeskyBase.hpp 1525 2010-02-26 17:27:59Z mjs $ */
2
// Copyright (C) 2003, International Business Machines
3
// Corporation and others. All Rights Reserved.
4
#ifndef ClpCholeskyBase_H
5
#define ClpCholeskyBase_H
6
7
#include "CoinPragma.hpp"
8
#include "CoinFinite.hpp"
9
//#define CLP_LONG_CHOLESKY 0
10
#ifndef CLP_LONG_CHOLESKY
11
#define CLP_LONG_CHOLESKY 0
12
#endif
13
/* valid combinations are
14
CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0
15
CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1
16
CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1
17
*/
18
#if COIN_LONG_WORK==0
19
#if CLP_LONG_CHOLESKY>0
20
#define CHOLESKY_BAD_COMBINATION
21
#endif
22
#else
23
#if CLP_LONG_CHOLESKY==0
24
#define CHOLESKY_BAD_COMBINATION
25
#endif
26
#endif
27
#ifdef CHOLESKY_BAD_COMBINATION
28
# warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
29
"Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
30
#endif
31
#if CLP_LONG_CHOLESKY>1
32
typedef
long
double
longDouble
;
33
#define CHOL_SMALL_VALUE 1.0e-15
34
#elif CLP_LONG_CHOLESKY==1
35
typedef
double
longDouble
;
36
#define CHOL_SMALL_VALUE 1.0e-11
37
#else
38
typedef
double
longDouble
;
39
#define CHOL_SMALL_VALUE 1.0e-11
40
#endif
41
class
ClpInterior
;
42
class
ClpCholeskyDense
;
43
class
ClpMatrixBase
;
44
51
class
ClpCholeskyBase
{
52
53
public
:
62
virtual
int
order
(
ClpInterior
* model);
67
virtual
int
symbolic
();
70
virtual
int
factorize
(
const
CoinWorkDouble *
diagonal
,
int
*
rowsDropped
) ;
72
virtual
void
solve
(CoinWorkDouble * region) ;
75
virtual
void
solveKKT
(CoinWorkDouble * region1, CoinWorkDouble * region2,
const
CoinWorkDouble * diagonal,
76
CoinWorkDouble diagonalScaleFactor);
77
private
:
79
int
orderAMD
();
80
public
:
82
85
inline
int
status
()
const
{
87
return
status_
;
88
}
90
inline
int
numberRowsDropped
()
const
{
91
return
numberRowsDropped_
;
92
}
94
void
resetRowsDropped
();
96
inline
char
*
rowsDropped
()
const
{
97
return
rowsDropped_
;
98
}
100
inline
double
choleskyCondition
()
const
{
101
return
choleskyCondition_
;
102
}
104
inline
double
goDense
()
const
{
105
return
goDense_
;
106
}
108
inline
void
setGoDense
(
double
value) {
109
goDense_
= value;
110
}
112
inline
int
rank
()
const
{
113
return
numberRows_
-
numberRowsDropped_
;
114
}
116
inline
int
numberRows
()
const
{
117
return
numberRows_
;
118
}
120
inline
CoinBigIndex
size
()
const
{
121
return
sizeFactor_
;
122
}
124
inline
longDouble
*
sparseFactor
()
const
{
125
return
sparseFactor_
;
126
}
128
inline
longDouble
*
diagonal
()
const
{
129
return
diagonal_
;
130
}
132
inline
longDouble
*
workDouble
()
const
{
133
return
workDouble_
;
134
}
136
inline
bool
kkt
()
const
{
137
return
doKKT_
;
138
}
140
inline
void
setKKT
(
bool
yesNo) {
141
doKKT_
= yesNo;
142
}
144
inline
void
setIntegerParameter
(
int
i,
int
value) {
145
integerParameters_
[i] = value;
146
}
148
inline
int
getIntegerParameter
(
int
i) {
149
return
integerParameters_
[i];
150
}
152
inline
void
setDoubleParameter
(
int
i,
double
value) {
153
doubleParameters_
[i] = value;
154
}
156
inline
double
getDoubleParameter
(
int
i) {
157
return
doubleParameters_
[i];
158
}
160
161
162
public
:
163
169
ClpCholeskyBase
(
int
denseThreshold = -1);
171
virtual
~ClpCholeskyBase
();
173
ClpCholeskyBase
(
const
ClpCholeskyBase
&);
175
ClpCholeskyBase
&
operator=
(
const
ClpCholeskyBase
&);
177
178
virtual
ClpCholeskyBase
*
clone
()
const
;
181
183
inline
int
type
()
const
{
184
if
(
doKKT_
)
return
100;
185
else
return
type_
;
186
}
187
protected
:
189
inline
void
setType
(
int
type
) {
190
type_
=
type
;
191
}
193
inline
void
setModel
(
ClpInterior
* model) {
194
model_
= model;
195
}
197
204
int
symbolic1
(
const
CoinBigIndex * Astart,
const
int
* Arow);
208
void
symbolic2
(
const
CoinBigIndex * Astart,
const
int
* Arow);
212
void
factorizePart2
(
int
* rowsDropped) ;
216
void
solve
(CoinWorkDouble * region,
int
type
);
218
int
preOrder
(
bool
lowerTriangular,
bool
includeDiagonal,
bool
doKKT);
220
void
updateDense
(
longDouble
* d,
/*longDouble * work,*/
int
* first);
222
223
protected
:
227
int
type_
;
230
bool
doKKT_
;
232
double
goDense_
;
234
double
choleskyCondition_
;
236
ClpInterior
*
model_
;
238
int
numberTrials_
;
240
int
numberRows_
;
242
int
status_
;
244
char
*
rowsDropped_
;
246
int
*
permuteInverse_
;
248
int
*
permute_
;
250
int
numberRowsDropped_
;
252
longDouble
*
sparseFactor_
;
254
CoinBigIndex *
choleskyStart_
;
256
int
*
choleskyRow_
;
258
CoinBigIndex *
indexStart_
;
260
longDouble
*
diagonal_
;
262
longDouble
*
workDouble_
;
264
int
*
link_
;
265
// Integer work array
266
CoinBigIndex *
workInteger_
;
267
// Clique information
268
int
*
clique_
;
270
CoinBigIndex
sizeFactor_
;
272
CoinBigIndex
sizeIndex_
;
274
int
firstDense_
;
276
int
integerParameters_
[64];
278
double
doubleParameters_
[64];
280
ClpMatrixBase
*
rowCopy_
;
282
char
*
whichDense_
;
284
longDouble
*
denseColumn_
;
286
ClpCholeskyDense
*
dense_
;
288
int
denseThreshold_
;
290
};
291
292
#endif
Generated on Tue Mar 1 2016 22:38:51 by
1.8.4