GSparseSymbolic.hpp
4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/***************************************************************************
* GSparseSymbolic.hpp - sparse matrix symbolic analysis class *
* ----------------------------------------------------------------------- *
* copyright : (C) 2006 by Jurgen Knodlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef GSPARSESYMBOLIC_HPP
#define GSPARSESYMBOLIC_HPP
/* __ Includes ___________________________________________________________ */
#include "GException.hpp"
#include "GVector.hpp"
#include "GMatrix.hpp"
#include "GSparseMatrix.hpp"
/* __ Namespaces _________________________________________________________ */
using namespace std;
/* __ Definitions ________________________________________________________ */
/* __ Enumerators ________________________________________________________ */
/* __ Structures _________________________________________________________ */
/* __ Prototypes _________________________________________________________ */
/***************************************************************************
* GSparseSymbolic class definition *
***************************************************************************/
class GSparseSymbolic {
// Friend classes
friend class GSparseMatrix;
friend class GSparseNumeric;
// Binary operator friends
// I/O friends
friend ostream& operator<< (ostream& os, const GSparseSymbolic& s);
// Friend functions
public:
// Constructors and destructors
GSparseSymbolic();
// GSparseSymbolic(const GSparseSymbolic& s) { cout << "would sym to" << endl;}
~GSparseSymbolic();
// Assignment operator
GSparseSymbolic& operator= (const GSparseSymbolic& s);
// Binary operators
// Unary operators
// Functions
void cholesky_symbolic_analysis(int order, const GSparseMatrix& m);
// Exception: Invalid ordering scheme
class invalid_order : public GException {
public:
invalid_order(string origin, int order, int min_order, int max_order);
};
private:
// Functions
int* cs_amd (int order, const GSparseMatrix* A);
int* cs_counts(const GSparseMatrix* A, const int* parent, const int* post, int ata);
int* cs_etree(const GSparseMatrix* A, int ata);
int cs_fkeep(GSparseMatrix* A, int(*fkeep)(int, int, double, void*), void* other);
int cs_leaf(int i, int j, const int* first, int* maxfirst, int* prevleaf, int* ancestor, int* jleaf);
int* cs_pinv(int const* p, int n);
int* cs_post(const int* parent, int n);
int cs_tdfs(int j, int k, int* head, const int* next, int* post, int* stack);
static void init_ata(const GSparseMatrix* AT, const int* post, int* wrk_int, int** head, int** next);
static int cs_diag(int i, int j, double aij, void* other);
static int cs_wclear(int mark, int lemax, int* w, int n);
// Data
int* m_pinv; // Inverse row permutation for QR, fill reduce permutation for Cholesky
int* m_q; // Fill-reducing column permutation for LU and QR
int* m_parent; // elimination tree for Cholesky and QR
int* m_cp; // column pointers for Cholesky, row counts for QR
int* m_leftmost; // leftmost[i] = min(find(A(i,:))), for QR
int m_m2; // # of rows for QR, after adding fictitious rows
double m_lnz; // # entries in L for LU or Cholesky; in V for QR
double m_unz; // # entries in U for LU; in R for QR
int m_n_pinv; // Number of elements in m_pinv
int m_n_q; // Number of elements in m_q
int m_n_parent; // Number of elements in m_parent
int m_n_cp; // Number of elements in m_cp
int m_n_leftmost; // Number of elements in m_leftmost
};
/***************************************************************************
* Inline members *
***************************************************************************/
/***************************************************************************
* Inline friends *
***************************************************************************/
#endif /* GSPARSESYMBOLIC_HPP */