00001 // Copyright (C) 2004, 2006 International Business Machines and others. 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // $Id: IpTSymLinearSolver.hpp 759 2006-07-07 03:07:08Z andreasw $ 00006 // 00007 // Authors: Carl Laird, Andreas Waechter IBM 2004-03-17 00008 00009 #ifndef __IPTSYMLINEARSOLVER_HPP__ 00010 #define __IPTSYMLINEATSOLVER_HPP__ 00011 00012 #include "IpSymLinearSolver.hpp" 00013 #include "IpSparseSymLinearSolverInterface.hpp" 00014 #include "IpTSymScalingMethod.hpp" 00015 #include "IpSymMatrix.hpp" 00016 #include "IpTripletToCSRConverter.hpp" 00017 #include "IpTripletToDenseConverter.hpp" 00018 #include <vector> 00019 00020 namespace Ipopt 00021 { 00022 00033 class TSymLinearSolver: public SymLinearSolver 00034 { 00035 public: 00042 TSymLinearSolver(SmartPtr<SparseSymLinearSolverInterface> solver_interface, 00043 SmartPtr<TSymScalingMethod> scaling_method); 00044 00046 virtual ~TSymLinearSolver(); 00048 00050 bool InitializeImpl(const OptionsList& options, 00051 const std::string& prefix); 00052 00058 virtual ESymSolverStatus MultiSolve(const SymMatrix &A, 00059 std::vector<SmartPtr<const Vector> >& rhsV, 00060 std::vector<SmartPtr<Vector> >& solV, 00061 bool check_NegEVals, 00062 Index numberOfNegEVals); 00063 00068 virtual Index NumberOfNegEVals() const; 00070 00071 //* @name Options of Linear solver */ 00073 00078 virtual bool IncreaseQuality(); 00079 00083 virtual bool ProvidesInertia() const; 00085 00088 static void RegisterOptions(SmartPtr<RegisteredOptions> roptions); 00090 00091 private: 00101 TSymLinearSolver(); 00102 00104 TSymLinearSolver(const TSymLinearSolver&); 00105 00107 void operator=(const TSymLinearSolver&); 00109 00113 TaggedObject::Tag atag_; 00114 00116 Index dim_; 00117 00121 Index nonzeros_triplet_; 00125 Index nonzeros_compressed_; 00127 00132 bool have_structure_; 00135 bool linear_scaling_on_demand_; 00138 bool initialized_; 00140 00142 SmartPtr<SparseSymLinearSolverInterface> solver_interface_; 00147 SmartPtr<TSymScalingMethod> scaling_method_; 00149 double* scaling_factors_; 00151 bool use_scaling_; 00153 bool just_switched_on_scaling_; 00155 00160 Index* airn_; 00163 Index* ajcn_; 00167 SmartPtr<TripletToCSRConverter> triplet_to_csr_converter_; 00168 SmartPtr<TripletToDenseConverter> triplet_to_dense_converter_; 00170 SparseSymLinearSolverInterface::EMatrixFormat matrix_format_; 00172 00177 bool warm_start_same_structure_; 00179 00186 ESymSolverStatus InitializeStructure(const SymMatrix& symT_A); 00187 00190 void GiveMatrixToSolver(bool new_matrix, const SymMatrix& sym_A); 00192 }; 00193 00194 } // namespace Ipopt 00195 #endif