Warning: this documentation for the development version is under construction.

/home/vivien/public_html/.src_seldon/computation/solver/SparseCholeskyFactorisation.hxx

00001 // Copyright (C) 2010 Marc Duruflé
00002 //
00003 // This file is part of the linear-algebra library Seldon,
00004 // http://seldon.sourceforge.net/.
00005 //
00006 // Seldon is free software; you can redistribute it and/or modify it under the
00007 // terms of the GNU Lesser General Public License as published by the Free
00008 // Software Foundation; either version 2.1 of the License, or (at your option)
00009 // any later version.
00010 //
00011 // Seldon is distributed in the hope that it will be useful, but WITHOUT ANY
00012 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
00014 // more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public License
00017 // along with Seldon. If not, see http://www.gnu.org/licenses/.
00018 
00019 
00020 #ifndef SELDON_FILE_SPARSE_CHOLESKY_FACTORISATION_HXX
00021 
00022 
00023 namespace Seldon
00024 {
00025 
00027   template<class T>
00028   class SparseCholeskySolver
00029   {
00030   protected :
00032     int print_level;
00034     int type_ordering;
00036     IVect permutation;
00038     int type_solver;
00040     int n;
00042     Matrix<T, Symmetric, ArrayRowSymSparse> mat_sym;
00044     Vector<T> xtmp;
00045 
00046 #ifdef SELDON_WITH_CHOLMOD
00047     MatrixCholmod mat_chol;
00048 #endif
00049 
00050   public :
00051     // Available solvers.
00052     enum {SELDON_SOLVER, CHOLMOD};
00053 
00054     SparseCholeskySolver();
00055 
00056     void HideMessages();
00057     void ShowMessages();
00058     void ShowFullHistory();
00059 
00060     void Clear();
00061 
00062     int GetM() const;
00063     int GetN() const;
00064 
00065     int GetTypeOrdering() const;
00066     void SetOrdering(const IVect&);
00067     void SelectOrdering(int);
00068 
00069     void SelectDirectSolver(int);
00070     int GetDirectSolver();
00071 
00072     template<class MatrixSparse>
00073     void Factorize(MatrixSparse& A, bool keep_matrix = false);
00074 
00075     template<class TransStatus, class Vector1>
00076     void Solve(const TransStatus& TransA, Vector1& x);
00077 
00078     template<class TransStatus, class Vector1>
00079     void Mlt(const TransStatus& TransA, Vector1& x);
00080 
00081   };
00082 
00083 } // namespace Seldon.
00084 
00085 
00086 #define SELDON_FILE_SPARSE_CHOLESKY_FACTORISATION_HXX
00087 #endif