PARP Research Group | Universidad de Murcia |
src/qvmath/qvcholmodsolver.h00001 /* 00002 * Copyright (C) 2011, 2012. PARP Research Group. 00003 * <http://perception.inf.um.es> 00004 * University of Murcia, Spain. 00005 * 00006 * This file is part of the QVision library. 00007 * 00008 * QVision is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as 00010 * published by the Free Software Foundation, version 3 of the License. 00011 * 00012 * QVision is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with QVision. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 // This code is partially based on the class 'CSparse', contained in the SBA package for the ROS framework: 00022 // http://www.ros.org/wiki/sba 00023 00024 00025 #ifndef QVCHOLMODSOLVER_H 00026 #define QVCHOLMODSOLVER_H 00027 00028 #ifndef DOXYGEN_IGNORE_THIS 00029 00030 #include <QVMatrix> 00031 #include <QMap> 00032 #include <QVSparseBlockMatrix> 00033 00034 #include <SuiteSparse/cholmod.h> 00035 00036 class QVCholmodSolver 00037 { 00038 private: 00039 // Blocks storage 00040 QVector< QVMatrix > diagonal; 00041 QVector< QMap<int, QVMatrix> > offdiagonal; 00042 00043 // parameters 00044 int asize, bsize, csize; // matrix A is asize x asize (blocks), csize x csize (elements) 00045 int nnz; // number of non-zeros in A 00046 00047 // CHOLMOD structures 00048 cholmod_sparse *chA; // linear problem matrix 00049 cholmod_common Common; 00050 00051 public: 00052 // constructor 00053 QVCholmodSolver(const QVSparseBlockMatrix &sparseA); 00054 00055 ~QVCholmodSolver(); 00056 00057 // set up compressed column structure; <init> true if first time 00058 // <diaginc> is the diagonal multiplier for LM 00059 void init(); 00060 00061 // doing the Cholesky with QVCholmodSolver or Cholmod 00062 bool solve(QVVector &x, QVVector &b); // solve in place with RHS B 00063 }; 00064 00065 #endif // DOXYGEN_IGNORE_THIS 00066 00067 #endif |