Cholmod.hxx
1 // Copyright (C) 2010 Marc DuruflĂ©
2 //
3 // This file is part of the linear-algebra library Seldon,
4 // http://seldon.sourceforge.net/.
5 //
6 // Seldon is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your option)
9 // any later version.
10 //
11 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
12 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
14 // more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with Seldon. If not, see http://www.gnu.org/licenses/.
18 
19 
20 #ifndef SELDON_FILE_CHOLMOD_HXX
21 
22 extern "C"
23 {
24 #include "cholmod.h"
25 }
26 
27 
28 namespace Seldon
29 {
30 
33  {
34  protected :
35  cholmod_common param_chol;
36  cholmod_factor* L;
37  int n;
38 
39  public :
40  MatrixCholmod();
41  ~MatrixCholmod();
42 
43  bool UseInteger8() const;
44  void Clear();
45 
46  void HideMessages();
47  void ShowMessages();
48  void ShowFullHistory();
49 
50  size_t GetMemorySize() const;
51  int GetInfoFactorization() const;
52 
53  template<class Prop, class Storage, class Allocator>
54  void FactorizeMatrix(Matrix<double, Prop, Storage, Allocator> & mat,
55  bool keep_matrix = false);
56 
57  void FactorizeCSR(Matrix<double, Symmetric, RowSymSparse> & Acsc);
58 
59  template<class Allocator>
60  void Solve(const SeldonTranspose& TransA,
62 
63  void Solve(const SeldonTranspose&, double* x_ptr, int nrhs);
64 
65  template<class Allocator>
66  void Mlt(const SeldonTranspose& TransA,
68 
69  };
70 
71  template<class T, class Prop, class Storage, class Allocator>
72  void GetCholesky(Matrix<T, Prop, Storage, Allocator>& A,
73  MatrixCholmod& mat_chol, bool keep_matrix = false);
74 
75  template<class T, class Allocator>
76  void
77  SolveCholesky(const SeldonTranspose& TransA,
79 
80  template<class T, class Allocator>
81  void
82  MltCholesky(const SeldonTranspose& TransA,
84 
85 }
86 
87 #define SELDON_FILE_CHOLMOD_HXX
88 #endif
89 
Seldon::SeldonTranspose
Definition: MatrixFlag.hxx:32
Seldon::MatrixCholmod::Solve
void Solve(const SeldonTranspose &TransA, Vector< double, VectFull, Allocator > &x)
Solves L x = b or L^T x = b.
Definition: Cholmod.cxx:147
Seldon::Vector
Definition: SeldonHeader.hxx:207
Seldon::Matrix
Definition: SeldonHeader.hxx:226
Seldon::MatrixCholmod
Object containing Cholesky factorization.
Definition: Cholmod.hxx:32
Seldon::Vector< T, VectFull, Allocator >
Full vector class.
Definition: Vector.hxx:88
Seldon::VirtualSparseDirectSolver
Base class for an interface with a direct solver.
Definition: SparseSolver.hxx:30
Seldon::MatrixCholmod::Mlt
void Mlt(const SeldonTranspose &TransA, Vector< double, VectFull, Allocator > &x)
Performs the matrix vector product y = L X or y = L^T X.
Definition: Cholmod.cxx:190
Seldon
Seldon namespace.
Definition: Array.cxx:24