source: trunk/Clp/src/ClpCholeskyDense.hpp @ 1370

Last change on this file since 1370 was 1370, checked in by forrest, 10 years ago

add ids

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1/* $Id: ClpCholeskyDense.hpp 1370 2009-06-04 09:37:13Z forrest $ */
2/* Copyright (C) 2003, International Business Machines Corporation
3   and others.  All Rights Reserved. */
4#ifndef ClpCholeskyDense_H
5#define ClpCholeskyDense_H
6
7#include "ClpCholeskyBase.hpp"
8class ClpMatrixBase;
9
10class ClpCholeskyDense : public ClpCholeskyBase {
11 
12public:
13   /**@name Virtual methods that the derived classes provides  */
14   /**@{*/
15  /** Orders rows and saves pointer to matrix.and model.
16   Returns non-zero if not enough memory */
17  virtual int order(ClpInterior * model) ;
18  /** Does Symbolic factorization given permutation.
19      This is called immediately after order.  If user provides this then
20      user must provide factorize and solve.  Otherwise the default factorization is used
21      returns non-zero if not enough memory */
22  virtual int symbolic();
23  /** Factorize - filling in rowsDropped and returning number dropped.
24      If return code negative then out of memory */
25  virtual int factorize(const double * diagonal, int * rowsDropped) ;
26  /** Uses factorization to solve. */
27  virtual void solve (double * region) ;
28  /**@}*/
29
30  /**@name Non virtual methods for ClpCholeskyDense  */
31  /**@{*/
32  /** Reserves space.
33      If factor not NULL then just uses passed space
34   Returns non-zero if not enough memory */
35   int reserveSpace(const ClpCholeskyBase * factor, int numberRows) ;
36  /** Returns space needed */
37   CoinBigIndex space( int numberRows) const;
38  /** part 2 of Factorize - filling in rowsDropped */
39  void factorizePart2(int * rowsDropped) ;
40  /** part 2 of Factorize - filling in rowsDropped - blocked */
41  void factorizePart3(int * rowsDropped) ;
42  /** Forward part of solve */
43  void solveF1(longDouble * a,int n,double * region);
44  void solveF2(longDouble * a,int n,double * region,double * region2);
45  /** Backward part of solve */
46  void solveB1(longDouble * a,int n,double * region);
47  void solveB2(longDouble * a,int n,double * region,double * region2);
48  /** Uses factorization to solve. */
49  void solveLong (CoinWorkDouble * region) ;
50  /** Forward part of solve */
51  void solveF1Long(longDouble * a,int n,CoinWorkDouble * region);
52  void solveF2Long(longDouble * a,int n,CoinWorkDouble * region,CoinWorkDouble * region2);
53  /** Backward part of solve */
54  void solveB1Long(longDouble * a,int n,CoinWorkDouble * region);
55  void solveB2Long(longDouble * a,int n,CoinWorkDouble * region,CoinWorkDouble * region2);
56  /** Uses factorization to solve. */
57  void solveLongWork (CoinWorkDouble * region) ;
58  /** Forward part of solve */
59  void solveF1LongWork(longDouble * a,int n,CoinWorkDouble * region);
60  void solveF2LongWork(longDouble * a,int n,CoinWorkDouble * region,CoinWorkDouble * region2);
61  /** Backward part of solve */
62  void solveB1LongWork(longDouble * a,int n,CoinWorkDouble * region);
63  void solveB2LongWork(longDouble * a,int n,CoinWorkDouble * region,CoinWorkDouble * region2);
64  int bNumber(const longDouble * array,int &, int&);
65  /** A */
66  inline longDouble * aMatrix() const
67  { return sparseFactor_;}
68  /** Diagonal */
69  inline longDouble * diagonal() const
70  { return diagonal_;}
71  /**@}*/
72
73
74  /**@name Constructors, destructor */
75  /**@{*/
76  /** Default constructor. */
77  ClpCholeskyDense();
78  /** Destructor  */
79  virtual ~ClpCholeskyDense();
80  /** Copy */
81  ClpCholeskyDense(const ClpCholeskyDense&);
82  /** Assignment */
83  ClpCholeskyDense& operator=(const ClpCholeskyDense&);
84  /** Clone */
85  virtual ClpCholeskyBase * clone() const ;
86  /**@}*/
87   
88   
89private:
90  /**@name Data members */
91  /**@{*/
92     /** Just borrowing space */
93  bool borrowSpace_;
94  /**@}*/
95};
96
97/* structure for C */
98typedef struct{
99  longDouble * diagonal_;
100  longDouble * a;
101  longDouble * work;
102  int * rowsDropped;
103  double doubleParameters_[1]; /* corresponds to 10 */
104  int integerParameters_[2]; /* corresponds to 34, nThreads */
105  int n;
106  int numberBlocks;
107} ClpCholeskyDenseC;
108
109extern "C" {
110  void ClpCholeskySpawn(void *);
111}
112  /**Non leaf recursive factor */
113  void 
114  ClpCholeskyCfactor(ClpCholeskyDenseC * thisStruct, 
115                     longDouble * a, int n, int numberBlocks,
116                     longDouble * diagonal, longDouble * work, int * rowsDropped);
117 
118  /**Non leaf recursive triangle rectangle update */
119  void 
120  ClpCholeskyCtriRec(ClpCholeskyDenseC * thisStruct, 
121                     longDouble * aTri, int nThis, 
122                     longDouble * aUnder, longDouble * diagonal, 
123                     longDouble * work,
124                     int nLeft, int iBlock, int jBlock,
125                     int numberBlocks);
126  /**Non leaf recursive rectangle triangle update */
127  void 
128  ClpCholeskyCrecTri(ClpCholeskyDenseC * thisStruct, 
129                     longDouble * aUnder, int nTri, int nDo,
130                     int iBlock, int jBlock,longDouble * aTri,
131                     longDouble * diagonal, longDouble * work, 
132                     int numberBlocks);
133  /** Non leaf recursive rectangle rectangle update,
134      nUnder is number of rows in iBlock,
135      nUnderK is number of rows in kBlock
136  */
137  void 
138  ClpCholeskyCrecRec(ClpCholeskyDenseC * thisStruct, 
139                     longDouble * above, int nUnder, int nUnderK,
140                     int nDo, longDouble * aUnder, longDouble *aOther,
141                     longDouble * work,
142                     int iBlock, int jBlock,
143                     int numberBlocks);
144  /**Leaf recursive factor */
145  void 
146  ClpCholeskyCfactorLeaf(ClpCholeskyDenseC * thisStruct, 
147                         longDouble * a, int n, 
148                         longDouble * diagonal, longDouble * work, 
149                         int * rowsDropped);
150  /**Leaf recursive triangle rectangle update */
151  void 
152  ClpCholeskyCtriRecLeaf(ClpCholeskyDenseC * thisStruct, 
153                         longDouble * aTri, longDouble * aUnder,
154                         longDouble * diagonal, longDouble * work,
155                         int nUnder);
156  /**Leaf recursive rectangle triangle update */
157  void 
158  ClpCholeskyCrecTriLeaf(ClpCholeskyDenseC * thisStruct, 
159                         longDouble * aUnder, longDouble * aTri, 
160                         longDouble * diagonal, longDouble * work, int nUnder);
161  /** Leaf recursive rectangle rectangle update,
162      nUnder is number of rows in iBlock,
163      nUnderK is number of rows in kBlock
164  */
165  void 
166  ClpCholeskyCrecRecLeaf(ClpCholeskyDenseC * thisStruct, 
167                         const longDouble * COIN_RESTRICT above, 
168                         const longDouble * COIN_RESTRICT aUnder, 
169                         longDouble * COIN_RESTRICT aOther, 
170                         const longDouble * COIN_RESTRICT work,
171                         int nUnder);
172#endif
Note: See TracBrowser for help on using the repository browser.