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