Scippy

SoPlex

Sequential object-oriented simPlex

clufactor.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-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SoPlex is distributed under the terms of the ZIB Academic Licence. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SoPlex; see the file COPYING. If not email to soplex@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file clufactor.h
17  * @brief Implementation of sparse LU factorization.
18  */
19 #ifndef _CLUFACTOR_H_
20 #define _CLUFACTOR_H_
21 
22 #include "spxdefines.h"
23 #include "slinsolver.h"
24 #include "timer.h"
25 #include "svector.h"
26 
27 #define WITH_L_ROWS 1
28 
29 namespace soplex
30 {
31 /**@brief Implementation of sparse LU factorization.
32  * @ingroup Algo
33  *
34  * This class implements a sparse LU factorization with either
35  * FOREST-TOMLIN or ETA updates, using dynamic Markowitz pivoting.
36  */
37 class CLUFactor
38 {
39 public:
40 
41  //----------------------------------------
42  /**@name Public types */
43  //@{
44  /** Doubly linked ring structure for garbage collection of column or
45  * row file in working matrix.
46  */
47  struct Dring
48  {
51  int idx;
52  };
53 
54  /// Pivot Ring
55  class Pring
56  {
57  public:
58  Pring* next; ///<
59  Pring* prev; ///<
60  int idx; ///< index of pivot row
61  int pos; ///< position of pivot column in row
62  int mkwtz; ///< markowitz number of pivot
63 
64  Pring() : next(0), prev(0) ///< constructor
65  {
66  mkwtz = -1;
67  idx = -1;
68  pos = -1;
69  }
70 
71  private:
72  Pring(const Pring&); ///< blocked copy constructor
73  Pring& operator= (const Pring&); ///< blocked assignment operator
74  };
75  //@}
76 
77 protected:
78 
79  //----------------------------------------
80  /**@name Protected types */
81  //@{
82  /// Temporary data structures.
83  class Temp
84  {
85  public:
86  int* s_mark; ///< marker
87  Real* s_max; ///< maximum absolute value per row (or -1)
88  int* s_cact; ///< lengths of columns of active submatrix
89  int stage; ///< stage of the structure
90  Pring pivots; ///< ring of selected pivot rows
91  Pring* pivot_col; ///< column index handlers for Real linked list
92  Pring* pivot_colNZ; ///< lists for columns to number of nonzeros
93  Pring* pivot_row; ///< row index handlers for Real linked list
94  Pring* pivot_rowNZ; ///< lists for rows to number of nonzeros
95 
96  Temp(); ///< constructor
97  ~Temp(); ///< destructor
98  void init(int p_dim); ///< initialization
99  void clear(); ///< clears the structure
100 
101  private:
102  Temp( const Temp& ); ///< blocked copy constructor
103  Temp& operator= ( const Temp& ); ///< blocked assignment operator
104  };
105 
106  /// Data structures for saving the row and column permutations.
107  struct Perm
108  {
109  int* orig; ///< orig[p] original index from p
110  int* perm; ///< perm[i] permuted index from i
111  };
112 
113  /// Data structures for saving the working matrix and U factor.
114  struct U
115  {
116  ///
117  struct Row
118  {
119  Dring list; /*!< \brief Double linked ringlist of vector
120  indices in the order they appear
121  in the row file */
122  Dring* elem; ///< %Array of ring elements.
123  int size; ///< size of arrays val and idx
124  int used; ///< used entries of arrays idx and val
125  Real* val; ///< hold nonzero values
126  int* idx; ///< hold column indices of nonzeros
127  int* start; ///< starting positions in val and idx
128  int* len; ///< used nonzeros per row vectors
129  int* max; /*!< \brief maximum available nonzeros per row:
130  start[i] + max[i] == start[elem[i].next->idx]
131  len[i] <= max[i]. */
132  } row;
133 
134  ///
135  struct Col
136  {
137  Dring list; /*!< \brief Double linked ringlist of vector
138  indices in the order they appear
139  in the column file */
140  Dring *elem; ///< %Array of ring elements.
141  int size; ///< size of array idx
142  int used; ///< used entries of array idx
143  int *idx; ///< hold row indices of nonzeros
144  Real *val; /*!< \brief hold nonzero values: this is only initialized
145  in the end of the factorization with DEFAULT
146  updates. */
147  int *start; ///< starting positions in val and idx
148  int *len; ///< used nonzeros per column vector
149  int *max; /*!< \brief maximum available nonzeros per colunn:
150  start[i] + max[i] == start[elem[i].next->idx]
151  len[i] <= max[i]. */
152  } col;
153  };
154 
155 
156  /// Data structures for saving the working matrix and L factor.
157  struct L
158  {
159  int size; ///< size of arrays val and idx
160  Real *val; ///< values of L vectors
161  int *idx; ///< indices of L vectors
162  int startSize; ///< size of array start
163  int firstUpdate; ///< number of first update L vector
164  int firstUnused; ///< number of first unused L vector
165  int *start; ///< starting positions in val and idx
166  int *row; ///< column indices of L vectors
167  int updateType; ///< type of updates to be used.
168 
169  /* The following arrays have length |firstUpdate|, since they keep
170  * rows of the L-vectors occuring during the factorization (without
171  * updates), only:
172  */
173  Real *rval; ///< values of rows of L
174  int *ridx; ///< indices of rows of L
175  int *rbeg; ///< start of rows in rval and ridx
176  int *rorig; ///< original row permutation
177  int *rperm; ///< original row permutation
178  };
179  //@}
180 
181  //----------------------------------------
182  /**@name Protected data */
183  //@{
184  SLinSolver::Status stat; ///< Status indicator.
185 
186  int thedim; ///< dimension of factorized matrix
187  int nzCnt; ///< number of nonzeros in U
188  Real initMaxabs; ///< maximum abs number in initail Matrix
189  Real maxabs; ///< maximum abs number in L and U
190 
191  Real rowMemMult; ///< factor of minimum Memory * number of nonzeros
192  Real colMemMult; ///< factor of minimum Memory * number of nonzeros
193  Real lMemMult; ///< factor of minimum Memory * number of nonzeros
194 
195  Perm row; ///< row permutation matrices
196  Perm col; ///< column permutation matrices
197 
198  L l; ///< L matrix
199  Real* diag; ///< Array of pivot elements
200  U u; ///< U matrix
201 
202  Real* work; ///< Working array: must always be left as 0!
203 
204  Timer* factorTime; ///< Time spent in factorizations
205  int factorCount; ///< Number of factorizations
206  //@}
207 
208 private:
209 
210  //----------------------------------------
211  /**@name Private data */
212  //@{
213  Temp temp; ///< Temporary storage
214  //@}
215 
216  //----------------------------------------
217  /**@name Solving
218  These helper methods are used during the factorization process.
219  The solve*-methods solve lower and upper triangular systems from
220  the left or from the right, respectively The methods with '2' in
221  the end solve two systems at the same time. The methods with
222  "Eps" in the end consider elements smaller then the passed epsilon
223  as zero.
224  */
225  //@{
226  ///
227  void solveUright(Real* wrk, Real* vec) const;
228  ///
229  int solveUrightEps(Real* vec, int* nonz, Real eps, Real* rhs);
230  ///
231  void solveUright2(Real* work1, Real* vec1, Real* work2, Real* vec2);
232  ///
233  int solveUright2eps(Real* work1, Real* vec1, Real* work2, Real* vec2, int* nonz, Real eps);
234  ///
235  void solveLright2(Real* vec1, Real* vec2);
236  ///
237  void solveUpdateRight(Real* vec);
238  ///
239  void solveUpdateRight2(Real* vec1, Real* vec2);
240  ///
241  void solveUleft(Real* work, Real* vec);
242  ///
243  void solveUleft2(Real* work1, Real* vec1, Real* work2, Real* vec2);
244  ///
245  int solveLleft2forest(Real* vec1, int* /* nonz */, Real* vec2, Real /* eps */);
246  ///
247  void solveLleft2(Real* vec1, int* /* nonz */, Real* vec2, Real /* eps */);
248  ///
249  int solveLleftForest(Real* vec, int* /* nonz */, Real /* eps */);
250  ///
251  void solveLleft(Real* vec) const;
252  ///
253  int solveLleftEps(Real* vec, int* nonz, Real eps);
254  ///
255  void solveUpdateLeft(Real* vec);
256  ///
257  void solveUpdateLeft2(Real* vec1, Real* vec2);
258 
259  void inline updateSolutionVectorLright(Real change, int j, Real& vec, int* idx, int& nnz);
260  ///
261  void vSolveLright(Real* vec, int* ridx, int& rn, Real eps);
262  ///
263  void vSolveLright2(Real* vec, int* ridx, int& rn, Real eps,
264  Real* vec2, int* ridx2, int& rn2, Real eps2);
265  ///
266  void vSolveLright3(Real* vec, int* ridx, int& rn, Real eps,
267  Real* vec2, int* ridx2, int& rn2, Real eps2,
268  Real* vec3, int* ridx3, int& rn3, Real eps3);
269  ///
270  int vSolveUright(Real* vec, int* vidx, Real* rhs, int* ridx, int rn, Real eps);
271  ///
272  void vSolveUrightNoNZ(Real* vec, Real* rhs, int* ridx, int rn, Real eps);
273  ///
274  int vSolveUright2(Real* vec, int* vidx, Real* rhs, int* ridx, int rn, Real eps,
275  Real* vec2, Real* rhs2, int* ridx2, int rn2, Real eps2);
276  ///
277  int vSolveUpdateRight(Real* vec, int* ridx, int n, Real eps);
278  ///
279  void vSolveUpdateRightNoNZ(Real* vec, Real /*eps*/);
280  ///
281  int solveUleft(Real eps, Real* vec, int* vecidx, Real* rhs, int* rhsidx, int rhsn);
282  ///
283  void solveUleftNoNZ(Real eps, Real* vec, Real* rhs, int* rhsidx, int rhsn);
284  ///
285  int solveLleftForest(Real eps, Real* vec, int* nonz, int n);
286  ///
287  void solveLleftForestNoNZ(Real* vec);
288  ///
289  int solveLleft(Real eps, Real* vec, int* nonz, int rn);
290  ///
291  void solveLleftNoNZ(Real* vec);
292  ///
293  int solveUpdateLeft(Real eps, Real* vec, int* nonz, int n);
294 
295  ///
296  void forestPackColumns();
297  ///
298  void forestMinColMem(int size);
299  ///
300  void forestReMaxCol(int col, int len);
301 
302  ///
303  void initPerm();
304  ///
305  void initFactorMatrix(const SVector** vec, const Real eps );
306  ///
307  void minLMem(int size);
308  ///
309  void setPivot(const int p_stage, const int p_col, const int p_row, const Real val);
310  ///
311  void colSingletons();
312  ///
313  void rowSingletons();
314 
315  ///
316  void initFactorRings();
317  ///
318  void freeFactorRings();
319 
320  ///
321  int setupColVals();
322  ///
323  void setupRowVals();
324 
325  ///
326  void eliminateRowSingletons();
327  ///
328  void eliminateColSingletons();
329  ///
330  void selectPivots(Real threshold);
331  ///
332  int updateRow(int r, int lv, int prow, int pcol, Real pval, Real eps);
333 
334  ///
335  void eliminatePivot(int prow, int pos, Real eps);
336  ///
337  void eliminateNucleus(const Real eps, const Real threshold);
338  ///
339  void minRowMem(int size);
340  ///
341  void minColMem(int size);
342  ///
343  void remaxCol(int p_col, int len);
344  ///
345  void packRows();
346  ///
347  void packColumns();
348  ///
349  void remaxRow(int p_row, int len);
350  ///
351  int makeLvec(int p_len, int p_row);
352  //@}
353 
354  //----------------------------------------
355  /**@name Blocked */
356  //@{
357  /// copy construtor.
358  CLUFactor(const CLUFactor&);
359  /// assignment operator.
360  CLUFactor& operator=(const CLUFactor&);
361  //@}
362 
363 protected:
364 
365  //----------------------------------------
366  /**@name Construction / destruction */
367  //@{
368  /// default construtor.
369  /** Since there is no sense in constructing a CLUFactor object
370  * per se, this is protected.
371  */
372 
374  {}
375  //@}
376 
377  //----------------------------------------
378  /**@name Solver methods */
379  //@{
380  ///
381  void solveLright(Real* vec);
382  ///
383  int solveRight4update(Real* vec, int* nonz, Real eps, Real* rhs,
384  Real* forest, int* forestNum, int* forestIdx);
385  ///
386  void solveRight(Real* vec, Real* rhs);
387  ///
388  int solveRight2update(Real* vec1, Real* vec2, Real* rhs1,
389  Real* rhs2, int* nonz, Real eps, Real* forest, int* forestNum, int* forestIdx);
390  ///
391  void solveRight2(Real* vec1, Real* vec2, Real* rhs1, Real* rhs2);
392  ///
393  void solveLeft(Real* vec, Real* rhs);
394  ///
395  int solveLeftEps(Real* vec, Real* rhs, int* nonz, Real eps);
396  ///
397  int solveLeft2(Real* vec1, int* nonz, Real* vec2, Real eps, Real* rhs1, Real* rhs2);
398 
399  ///
400  int vSolveRight4update(Real eps,
401  Real* vec, int* idx, /* result */
402  Real* rhs, int* ridx, int rn, /* rhs & Forest */
403  Real* forest, int* forestNum, int* forestIdx);
404  ///
405  int vSolveRight4update2(Real eps,
406  Real* vec, int* idx, /* result1 */
407  Real* rhs, int* ridx, int rn, /* rhs1 */
408  Real* vec2, Real eps2, /* result2 */
409  Real* rhs2, int* ridx2, int rn2, /* rhs2 */
410  Real* forest, int* forestNum, int* forestIdx);
411  /// sparse version of above method
413  Real eps, Real* vec, int* idx, /* result1 */
414  Real* rhs, int* ridx, int& rn, /* rhs1 */
415  Real eps2, Real* vec2, int* idx2, /* result2 */
416  Real* rhs2, int* ridx2, int& rn2, /* rhs2 */
417  Real* forest, int* forestNum, int* forestIdx);
418  ///
419  int vSolveRight4update3(Real eps,
420  Real* vec, int* idx, /* result1 */
421  Real* rhs, int* ridx, int rn, /* rhs1 */
422  Real* vec2, Real eps2, /* result2 */
423  Real* rhs2, int* ridx2, int rn2, /* rhs2 */
424  Real* vec3, Real eps3, /* result3 */
425  Real* rhs3, int* ridx3, int rn3, /* rhs3 */
426  Real* forest, int* forestNum, int* forestIdx);
427  /// sparse version of above method
429  Real eps, Real* vec, int* idx, /* result1 */
430  Real* rhs, int* ridx, int& rn, /* rhs1 */
431  Real eps2, Real* vec2, int* idx2, /* result2 */
432  Real* rhs2, int* ridx2, int& rn2, /* rhs2 */
433  Real eps3, Real* vec3, int* idx3, /* result3 */
434  Real* rhs3, int* ridx3, int& rn3, /* rhs3 */
435  Real* forest, int* forestNum, int* forestIdx);
436  ///
437  void vSolveRightNoNZ(Real* vec, Real eps, /* result */
438  Real* rhs, int* ridx, int rn); /* rhs */
439  ///
440  int vSolveLeft(Real eps,
441  Real* vec, int* idx, /* result */
442  Real* rhs, int* ridx, int rn); /* rhs */
443  ///
444  void vSolveLeftNoNZ(Real eps,
445  Real* vec, /* result */
446  Real* rhs, int* ridx, int rn); /* rhs */
447  ///
448  int vSolveLeft2(Real eps,
449  Real* vec, int* idx, /* result */
450  Real* rhs, int* ridx, int rn, /* rhs */
451  Real* vec2, /* result2 */
452  Real* rhs2, int* ridx2, int rn2); /* rhs2 */
453  /// sparse version of solving 2 systems of equations
454  void vSolveLeft2sparse(Real eps,
455  Real* vec, int* idx, /* result */
456  Real* rhs, int* ridx, int& rn, /* rhs */
457  Real* vec2, int* idx2, /* result2 */
458  Real* rhs2, int* ridx2, int& rn2); /* rhs2 */
459  ///
460  int vSolveLeft3(Real eps,
461  Real* vec, int* idx, /* result */
462  Real* rhs, int* ridx, int rn, /* rhs */
463  Real* vec2, /* result2 */
464  Real* rhs2, int* ridx2, int rn2, /* rhs2 */
465  Real* vec3, /* result3 */
466  Real* rhs3, int* ridx3, int rn3); /* rhs3 */
467  /// sparse version of solving 3 systems of equations
468  void vSolveLeft3sparse(Real eps,
469  Real* vec, int* idx, /* result */
470  Real* rhs, int* ridx, int& rn, /* rhs */
471  Real* vec2, int* idx2, /* result2 */
472  Real* rhs2, int* ridx2, int& rn2, /* rhs2 */
473  Real* vec3, int* idx3, /* result2 */
474  Real* rhs3, int* ridx3, int& rn3); /* rhs2 */
475 
476  void forestUpdate(int col, Real* work, int num, int *nonz);
477 
478  void update(int p_col, Real* p_work, const int* p_idx, int num);
479  void updateNoClear(int p_col, const Real* p_work, const int* p_idx, int num);
480 
481  ///
482  void factor(const SVector** vec, ///< Array of column vector pointers
483  Real threshold, ///< pivoting threshold
484  Real eps); ///< epsilon for zero detection
485  //@}
486 
487  //----------------------------------------
488  /**@name Debugging */
489  //@{
490  ///
491  void dump() const;
492 
493  ///
494  bool isConsistent() const;
495  //@}
496 };
497 
498 } // namespace soplex
499 #endif // _CLUFACTOR_H_
void solveUleft(Real *work, Real *vec)
Definition: clufactor.cpp:3683
int * len
used nonzeros per row vectors
Definition: clufactor.h:128
void solveLleft(Real *vec) const
Definition: clufactor.cpp:4015
int updateType
type of updates to be used.
Definition: clufactor.h:167
void solveUpdateRight2(Real *vec1, Real *vec2)
Definition: clufactor.cpp:3491
void updateNoClear(int p_col, const Real *p_work, const int *p_idx, int num)
Definition: clufactor.cpp:1320
int solveUright2eps(Real *work1, Real *vec1, Real *work2, Real *vec2, int *nonz, Real eps)
Definition: clufactor.cpp:3237
void vSolveLright3(Real *vec, int *ridx, int &rn, Real eps, Real *vec2, int *ridx2, int &rn2, Real eps2, Real *vec3, int *ridx3, int &rn3, Real eps3)
Definition: clufactor.cpp:4898
int solveRight2update(Real *vec1, Real *vec2, Real *rhs1, Real *rhs2, int *nonz, Real eps, Real *forest, int *forestNum, int *forestIdx)
Definition: clufactor.cpp:3590
Dring list
Double linked ringlist of vector indices in the order they appear in the column file.
Definition: clufactor.h:137
int * max
maximum available nonzeros per row: start[i] + max[i] == start[elem[i].next->idx] len[i] <= max[i]...
Definition: clufactor.h:129
int vSolveRight4update(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn, Real *forest, int *forestNum, int *forestIdx)
Definition: clufactor.cpp:5599
void forestMinColMem(int size)
Definition: clufactor.cpp:2900
void vSolveRight4update3sparse(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int &rn, Real eps2, Real *vec2, int *idx2, Real *rhs2, int *ridx2, int &rn2, Real eps3, Real *vec3, int *idx3, Real *rhs3, int *ridx3, int &rn3, Real *forest, int *forestNum, int *forestIdx)
sparse version of above method
Definition: clufactor.cpp:6018
Pring * pivot_rowNZ
lists for rows to number of nonzeros
Definition: clufactor.h:94
int * start
starting positions in val and idx
Definition: clufactor.h:147
int solveLleftForest(Real *vec, int *, Real)
Definition: clufactor.cpp:3985
Real * rval
values of rows of L
Definition: clufactor.h:173
void solveUleftNoNZ(Real eps, Real *vec, Real *rhs, int *rhsidx, int rhsn)
Definition: clufactor.cpp:4388
Real maxabs
maximum abs number in L and U
Definition: clufactor.h:189
int vSolveRight4update3(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn, Real *vec2, Real eps2, Real *rhs2, int *ridx2, int rn2, Real *vec3, Real eps3, Real *rhs3, int *ridx3, int rn3, Real *forest, int *forestNum, int *forestIdx)
Definition: clufactor.cpp:5868
Data structures for saving the row and column permutations.
Definition: clufactor.h:107
U u
U matrix.
Definition: clufactor.h:200
void minRowMem(int size)
Definition: clufactor.cpp:2875
void vSolveLeft3sparse(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int &rn, Real *vec2, int *idx2, Real *rhs2, int *ridx2, int &rn2, Real *vec3, int *idx3, Real *rhs3, int *ridx3, int &rn3)
sparse version of solving 3 systems of equations
Definition: clufactor.cpp:6287
Real * s_max
maximum absolute value per row (or -1)
Definition: clufactor.h:87
int size
size of array idx
Definition: clufactor.h:141
int * rorig
original row permutation
Definition: clufactor.h:176
void update(int p_col, Real *p_work, const int *p_idx, int num)
Definition: clufactor.cpp:1276
L l
L matrix.
Definition: clufactor.h:198
void solveUright(Real *wrk, Real *vec) const
Definition: clufactor.cpp:3111
Dring * elem
Array of ring elements.
Definition: clufactor.h:122
void solveLeft(Real *vec, Real *rhs)
Definition: clufactor.cpp:4248
Real initMaxabs
maximum abs number in initail Matrix
Definition: clufactor.h:188
Sparse Linear Solver virtual base class.
int mkwtz
markowitz number of pivot
Definition: clufactor.h:62
Pring * pivot_col
column index handlers for Real linked list
Definition: clufactor.h:91
int vSolveLeft2(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn, Real *vec2, Real *rhs2, int *ridx2, int rn2)
Definition: clufactor.cpp:6195
Real * diag
Array of pivot elements.
Definition: clufactor.h:199
Perm row
row permutation matrices
Definition: clufactor.h:195
Dring * elem
Array of ring elements.
Definition: clufactor.h:140
Perm col
column permutation matrices
Definition: clufactor.h:196
void solveUpdateRight(Real *vec)
Definition: clufactor.cpp:3459
Data structures for saving the working matrix and L factor.
Definition: clufactor.h:157
int * orig
orig[p] original index from p
Definition: clufactor.h:109
int solveRight4update(Real *vec, int *nonz, Real eps, Real *rhs, Real *forest, int *forestNum, int *forestIdx)
Definition: clufactor.cpp:3552
void vSolveLright(Real *vec, int *ridx, int &rn, Real eps)
Definition: clufactor.cpp:4728
Real lMemMult
factor of minimum Memory * number of nonzeros
Definition: clufactor.h:193
void minColMem(int size)
Definition: clufactor.cpp:2890
void eliminateRowSingletons()
Definition: clufactor.cpp:1880
Real * work
Working array: must always be left as 0!
Definition: clufactor.h:202
void forestUpdate(int col, Real *work, int num, int *nonz)
Performs the Forrest-Tomlin update of the LU factorization.
Definition: clufactor.cpp:710
void solveLleftForestNoNZ(Real *vec)
Definition: clufactor.cpp:4515
int * len
used nonzeros per column vector
Definition: clufactor.h:148
void solveUpdateLeft2(Real *vec1, Real *vec2)
Definition: clufactor.cpp:4156
double Real
Definition: spxdefines.h:215
int solveLleftEps(Real *vec, int *nonz, Real eps)
Definition: clufactor.cpp:4061
int size
size of arrays val and idx
Definition: clufactor.h:159
void solveUright2(Real *work1, Real *vec1, Real *work2, Real *vec2)
Definition: clufactor.cpp:3174
SLinSolver::Status stat
Status indicator.
Definition: clufactor.h:184
Pring * pivot_row
row index handlers for Real linked list
Definition: clufactor.h:93
CLUFactor()
default construtor.
Definition: clufactor.h:373
int used
used entries of arrays idx and val
Definition: clufactor.h:124
CLUFactor & operator=(const CLUFactor &)
assignment operator.
void solveLright(Real *vec)
Definition: clufactor.cpp:3319
void vSolveUpdateRightNoNZ(Real *vec, Real)
Definition: clufactor.cpp:5561
Sparse vectors.
int startSize
size of array start
Definition: clufactor.h:162
void vSolveLright2(Real *vec, int *ridx, int &rn, Real eps, Real *vec2, int *ridx2, int &rn2, Real eps2)
Definition: clufactor.cpp:4794
Pring * pivot_colNZ
lists for columns to number of nonzeros
Definition: clufactor.h:92
int factorCount
Number of factorizations.
Definition: clufactor.h:205
Real * val
hold nonzero values: this is only initialized in the end of the factorization with DEFAULT updates...
Definition: clufactor.h:144
int stage
stage of the structure
Definition: clufactor.h:89
int pos
position of pivot column in row
Definition: clufactor.h:61
int firstUnused
number of first unused L vector
Definition: clufactor.h:164
Temp temp
Temporary storage.
Definition: clufactor.h:213
void setPivot(const int p_stage, const int p_col, const int p_row, const Real val)
Definition: clufactor.cpp:266
void solveUpdateLeft(Real *vec)
Definition: clufactor.cpp:4125
void eliminateNucleus(const Real eps, const Real threshold)
Definition: clufactor.cpp:2530
void vSolveRight4update2sparse(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int &rn, Real eps2, Real *vec2, int *idx2, Real *rhs2, int *ridx2, int &rn2, Real *forest, int *forestNum, int *forestIdx)
sparse version of above method
Definition: clufactor.cpp:5788
int thedim
dimension of factorized matrix
Definition: clufactor.h:186
int * start
starting positions in val and idx
Definition: clufactor.h:127
Debugging, floating point type and parameter definitions.
int size
size of arrays val and idx
Definition: clufactor.h:123
void dump() const
Definition: clufactor.cpp:2829
int * idx
indices of L vectors
Definition: clufactor.h:161
void factor(const SVector **vec, Real threshold, Real eps)
epsilon for zero detection
Definition: clufactor.cpp:2772
int * perm
perm[i] permuted index from i
Definition: clufactor.h:110
bool isConsistent() const
Definition: clufactor.cpp:2951
void eliminateColSingletons()
Definition: clufactor.cpp:2001
Implementation of sparse LU factorization.This class implements a sparse LU factorization with either...
Definition: clufactor.h:37
void solveUleft2(Real *work1, Real *vec1, Real *work2, Real *vec2)
Definition: clufactor.cpp:3746
Everything should be within this namespace.
Timer class.
void vSolveRightNoNZ(Real *vec, Real eps, Real *rhs, int *ridx, int rn)
Definition: clufactor.cpp:6114
void remaxRow(int p_row, int len)
Definition: clufactor.cpp:413
int vSolveLeft(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn)
Definition: clufactor.cpp:6167
int solveLleft2forest(Real *vec1, int *, Real *vec2, Real)
Definition: clufactor.cpp:3815
void vSolveLeftNoNZ(Real eps, Real *vec, Real *rhs, int *ridx, int rn)
Definition: clufactor.cpp:6320
int firstUpdate
number of first update L vector
Definition: clufactor.h:163
Pring pivots
ring of selected pivot rows
Definition: clufactor.h:90
int vSolveLeft3(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn, Real *vec2, Real *rhs2, int *ridx2, int rn2, Real *vec3, Real *rhs3, int *ridx3, int rn3)
Definition: clufactor.cpp:6251
Real rowMemMult
factor of minimum Memory * number of nonzeros
Definition: clufactor.h:191
void solveLright2(Real *vec1, Real *vec2)
Definition: clufactor.cpp:3378
Dring list
Double linked ringlist of vector indices in the order they appear in the row file.
Definition: clufactor.h:119
int vSolveRight4update2(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int rn, Real *vec2, Real eps2, Real *rhs2, int *ridx2, int rn2, Real *forest, int *forestNum, int *forestIdx)
Definition: clufactor.cpp:5667
Timer * factorTime
Time spent in factorizations.
Definition: clufactor.h:204
int solveLeft2(Real *vec1, int *nonz, Real *vec2, Real eps, Real *rhs1, Real *rhs2)
Definition: clufactor.cpp:4283
int solveLeftEps(Real *vec, Real *rhs, int *nonz, Real eps)
Definition: clufactor.cpp:4266
void vSolveUrightNoNZ(Real *vec, Real *rhs, int *ridx, int rn, Real eps)
Definition: clufactor.cpp:5169
void forestReMaxCol(int col, int len)
Definition: clufactor.cpp:611
int * idx
hold row indices of nonzeros
Definition: clufactor.h:143
int idx
index of pivot row
Definition: clufactor.h:60
void eliminatePivot(int prow, int pos, Real eps)
Definition: clufactor.cpp:2434
void remaxCol(int p_col, int len)
Definition: clufactor.cpp:542
int * ridx
indices of rows of L
Definition: clufactor.h:174
int vSolveUright2(Real *vec, int *vidx, Real *rhs, int *ridx, int rn, Real eps, Real *vec2, Real *rhs2, int *ridx2, int rn2, Real eps2)
Definition: clufactor.cpp:5272
Real colMemMult
factor of minimum Memory * number of nonzeros
Definition: clufactor.h:192
int updateRow(int r, int lv, int prow, int pcol, Real pval, Real eps)
Definition: clufactor.cpp:2298
int vSolveUpdateRight(Real *vec, int *ridx, int n, Real eps)
Definition: clufactor.cpp:5517
int * max
maximum available nonzeros per colunn: start[i] + max[i] == start[elem[i].next->idx] len[i] <= max[i]...
Definition: clufactor.h:149
int makeLvec(int p_len, int p_row)
Definition: clufactor.cpp:2923
void updateSolutionVectorLright(Real change, int j, Real &vec, int *idx, int &nnz)
Definition: clufactor.cpp:4711
int * row
column indices of L vectors
Definition: clufactor.h:166
void vSolveLeft2sparse(Real eps, Real *vec, int *idx, Real *rhs, int *ridx, int &rn, Real *vec2, int *idx2, Real *rhs2, int *ridx2, int &rn2)
sparse version of solving 2 systems of equations
Definition: clufactor.cpp:6224
void minLMem(int size)
Definition: clufactor.cpp:2911
int * rbeg
start of rows in rval and ridx
Definition: clufactor.h:175
int * s_cact
lengths of columns of active submatrix
Definition: clufactor.h:88
void solveRight(Real *vec, Real *rhs)
Definition: clufactor.cpp:3581
void initFactorMatrix(const SVector **vec, const Real eps)
Definition: clufactor.cpp:1390
void solveLleft2(Real *vec1, int *, Real *vec2, Real)
Definition: clufactor.cpp:3882
void forestPackColumns()
Definition: clufactor.cpp:358
int nzCnt
number of nonzeros in U
Definition: clufactor.h:187
void selectPivots(Real threshold)
Definition: clufactor.cpp:2078
Real * val
hold nonzero values
Definition: clufactor.h:125
int * rperm
original row permutation
Definition: clufactor.h:177
int * start
starting positions in val and idx
Definition: clufactor.h:165
int * idx
hold column indices of nonzeros
Definition: clufactor.h:126
int used
used entries of array idx
Definition: clufactor.h:142
void solveRight2(Real *vec1, Real *vec2, Real *rhs1, Real *rhs2)
Definition: clufactor.cpp:3626
Status
status flags of the SLinSolver class.
Definition: slinsolver.h:51
int vSolveUright(Real *vec, int *vidx, Real *rhs, int *ridx, int rn, Real eps)
Definition: clufactor.cpp:5062
Temporary data structures.
Definition: clufactor.h:83
Data structures for saving the working matrix and U factor.
Definition: clufactor.h:114
int * s_mark
marker
Definition: clufactor.h:86
Wrapper for the system time query methods.
Definition: timer.h:76
int solveUrightEps(Real *vec, int *nonz, Real eps, Real *rhs)
Definition: clufactor.cpp:3131
Real * val
values of L vectors
Definition: clufactor.h:160
void solveLleftNoNZ(Real *vec)
Definition: clufactor.cpp:4646