Ipopt  trunk
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
IpTripletHelper.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2004, 2009 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Eclipse Public License.
00004 //
00005 // $Id$
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPTRIPLETHELPER_HPP__
00010 #define __IPTRIPLETHELPER_HPP__
00011 
00012 #include "IpTypes.hpp"
00013 #include "IpException.hpp"
00014 
00015 namespace Ipopt
00016 {
00017 
00018   DECLARE_STD_EXCEPTION(UNKNOWN_MATRIX_TYPE);
00019   DECLARE_STD_EXCEPTION(UNKNOWN_VECTOR_TYPE);
00020 
00022   class Matrix;
00023   class GenTMatrix;
00024   class SymTMatrix;
00025   class DiagMatrix;
00026   class IdentityMatrix;
00027   class ExpansionMatrix;
00028   class ScaledMatrix;
00029   class SymScaledMatrix;
00030   class SumMatrix;
00031   class SumSymMatrix;
00032   class ZeroMatrix;
00033   class ZeroSymMatrix;
00034   class CompoundMatrix;
00035   class CompoundSymMatrix;
00036   class TransposeMatrix;
00037   class ExpandedMultiVectorMatrix;
00038   class Vector;
00039 
00040   class TripletHelper
00041   {
00042   public:
00046     static Index GetNumberEntries(const Matrix& matrix);
00047 
00049     static void FillRowCol(Index n_entries, const Matrix& matrix, Index* iRow, Index* jCol, Index row_offset=0, Index col_offset=0);
00050 
00052     static void FillValues(Index n_entries, const Matrix& matrix, Number* values);
00053 
00055     static void FillValuesFromVector(Index dim, const Vector& vector, Number* values);
00056 
00058     static void PutValuesInVector(Index dim, const double* values, Vector& vector);
00060 
00061   private:
00063     static Index GetNumberEntries_(const SumMatrix& matrix);
00064 
00066     static Index GetNumberEntries_(const SumSymMatrix& matrix);
00067 
00069     static Index GetNumberEntries_(const CompoundMatrix& matrix);
00070 
00072     static Index GetNumberEntries_(const CompoundSymMatrix& matrix);
00073 
00075     static Index GetNumberEntries_(const TransposeMatrix& matrix);
00076 
00078     static Index GetNumberEntries_(const ExpandedMultiVectorMatrix& matrix);
00079 
00080     static void FillRowCol_(Index n_entries, const GenTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00081 
00082     static void FillValues_(Index n_entries, const GenTMatrix& matrix, Number* values);
00083 
00084     static void FillRowCol_(Index n_entries, const SymTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00085 
00086     static void FillValues_(Index n_entries, const SymTMatrix& matrix, Number* values);
00087 
00088     static void FillRowCol_(Index n_entries, const DiagMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00089 
00090     static void FillValues_(Index n_entries, const DiagMatrix& matrix, Number* values);
00091 
00092     static void FillRowCol_(Index n_entries, const IdentityMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00093 
00094     static void FillValues_(Index n_entries, const IdentityMatrix& matrix, Number* values);
00095 
00096     static void FillRowCol_(Index n_entries, const ExpansionMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00097 
00098     static void FillValues_(Index n_entries, const ExpansionMatrix& matrix, Number* values);
00099 
00100     static void FillRowCol_(Index n_entries, const SumMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00101 
00102     static void FillValues_(Index n_entries, const SumMatrix& matrix, Number* values);
00103 
00104     static void FillRowCol_(Index n_entries, const SumSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00105 
00106     static void FillValues_(Index n_entries, const SumSymMatrix& matrix, Number* values);
00107 
00108     static void FillRowCol_(Index n_entries, const CompoundMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00109 
00110     static void FillValues_(Index n_entries, const CompoundMatrix& matrix, Number* values);
00111 
00112     static void FillRowCol_(Index n_entries, const CompoundSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00113 
00114     static void FillValues_(Index n_entries, const CompoundSymMatrix& matrix, Number* values);
00115 
00116     static void FillRowCol_(Index n_entries, const ScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00117 
00118     static void FillValues_(Index n_entries, const ScaledMatrix& matrix, Number* values);
00119 
00120     static void FillRowCol_(Index n_entries, const SymScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00121 
00122     static void FillValues_(Index n_entries, const SymScaledMatrix& matrix, Number* values);
00123 
00124     static void FillRowCol_(Index n_entries, const TransposeMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00125 
00126     static void FillValues_(Index n_entries, const TransposeMatrix& matrix, Number* values);
00127 
00128     static void FillRowCol_(Index n_entries, const ExpandedMultiVectorMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00129 
00130     static void FillValues_(Index n_entries, const ExpandedMultiVectorMatrix& matrix, Number* values);
00131 
00132   };
00133 } // namespace Ipopt
00134 
00135 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines