computation/interfaces/direct/Cholmod.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_CHOLMOD_HXX
00021 
00022 extern "C"
00023 {
00024 #include "cholmod.h"
00025 }
00026 
00027 
00028 namespace Seldon
00029 {
00030 
00032   class MatrixCholmod
00033   {
00034   protected :
00035     cholmod_common param_chol;
00036     cholmod_factor* L;
00037     cholmod_sparse* Lsparse;
00038     int n;
00039 
00040   public :
00041     MatrixCholmod();
00042     ~MatrixCholmod();
00043 
00044     void Clear();
00045 
00046     void HideMessages();
00047     void ShowMessages();
00048     void ShowFullHistory();
00049 
00050     template<class Prop, class Storage, class Allocator>
00051     void FactorizeMatrix(Matrix<double, Prop, Storage, Allocator> & mat,
00052                          bool keep_matrix = false);
00053 
00054     template<class Transpose_status, class Allocator>
00055     void Solve(const Transpose_status& TransA,
00056                Vector<double, VectFull, Allocator>& x);
00057 
00058     template<class Transpose_status, class Allocator>
00059     void Mlt(const Transpose_status& TransA,
00060              Vector<double, VectFull, Allocator>& x);
00061 
00062   };
00063 
00064 }
00065 
00066 #define SELDON_FILE_CHOLMOD_HXX
00067 #endif
00068