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

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

try and improve stability - also long double interior point

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