Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

VNLSparseLUSolverTraits.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: VNLSparseLUSolverTraits.h,v $
00005   Language:  C++
00006   Date:      $Date: 2008-10-06 14:48:23 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef  __VNLSparseLUSolverTraits_h
00018 #define  __VNLSparseLUSolverTraits_h
00019 
00020 #include <vnl/vnl_vector.h>
00021 #include <vnl/vnl_sparse_matrix.h>
00022 #include <vnl/vnl_sparse_matrix_linear_system.h>
00023 #include <vnl/algo/vnl_sparse_lu.h>
00024 
00025 class VNLSparseLUSolverTraits
00026 {
00027 public:
00028 
00029   typedef double                            ValueType;
00030   typedef vnl_sparse_matrix< ValueType >    MatrixType;
00031   typedef vnl_vector< ValueType >           VectorType;
00032   typedef vnl_sparse_lu                     SolverType;
00033   
00034   VNLSparseLUSolverTraits();
00035 
00036   MatrixType InitializeSparseMatrix( const unsigned int& iN )
00037     {
00038     return MatrixType( iN, iN );
00039     }
00040 
00041   VectorType InitializeVector( const unsigned int& iN )
00042     {
00043     return VectorType( iN );
00044     }
00045   
00046   void FillMatrix( MatrixType& iA, const unsigned int& iR, const unsigned int& iC, const ValueType& iV )
00047     {
00048     iA( iR, iC ) = iV;
00049     }
00050   
00051   bool Solve( const MatrixType& iA, const VectorType& iB, VectorType& oX )
00052     {
00053     vnl_sparse_lu lu_solver( iA );
00054     return lu_solver.solve( iB );
00055     }
00056   
00057 private:
00058   MatrixType m_Matrix;
00059 };
00060 

Generated at Thu Nov 6 01:07:17 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000