00001
00002
00003
00004
00005
00006
00007
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 CompoundMatrix;
00034 class CompoundSymMatrix;
00035 class TransposeMatrix;
00036 class Vector;
00037
00038 class TripletHelper
00039 {
00040 public:
00044 static Index GetNumberEntries(const Matrix& matrix);
00045
00047 static void FillRowCol(Index n_entries, const Matrix& matrix, Index* iRow, Index* jCol, Index row_offset=0, Index col_offset=0);
00048
00050 static void FillValues(Index n_entries, const Matrix& matrix, Number* values);
00051
00053 static void FillValuesFromVector(Index dim, const Vector& vector, Number* values);
00054
00056 static void PutValuesInVector(Index dim, const double* values, Vector& vector);
00058
00059 private:
00061 static Index GetNumberEntries_(const SumMatrix& matrix);
00062
00064 static Index GetNumberEntries_(const SumSymMatrix& matrix);
00065
00067 static Index GetNumberEntries_(const CompoundMatrix& matrix);
00068
00070 static Index GetNumberEntries_(const CompoundSymMatrix& matrix);
00071
00073 static Index GetNumberEntries_(const TransposeMatrix& matrix);
00074
00075 static void FillRowCol_(Index n_entries, const GenTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00076
00077 static void FillValues_(Index n_entries, const GenTMatrix& matrix, Number* values);
00078
00079 static void FillRowCol_(Index n_entries, const SymTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00080
00081 static void FillValues_(Index n_entries, const SymTMatrix& matrix, Number* values);
00082
00083 static void FillRowCol_(Index n_entries, const DiagMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00084
00085 static void FillValues_(Index n_entries, const DiagMatrix& matrix, Number* values);
00086
00087 static void FillRowCol_(Index n_entries, const IdentityMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00088
00089 static void FillValues_(Index n_entries, const IdentityMatrix& matrix, Number* values);
00090
00091 static void FillRowCol_(Index n_entries, const ExpansionMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00092
00093 static void FillValues_(Index n_entries, const ExpansionMatrix& matrix, Number* values);
00094
00095 static void FillRowCol_(Index n_entries, const SumMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00096
00097 static void FillValues_(Index n_entries, const SumMatrix& matrix, Number* values);
00098
00099 static void FillRowCol_(Index n_entries, const SumSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00100
00101 static void FillValues_(Index n_entries, const SumSymMatrix& matrix, Number* values);
00102
00103 static void FillRowCol_(Index n_entries, const CompoundMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00104
00105 static void FillValues_(Index n_entries, const CompoundMatrix& matrix, Number* values);
00106
00107 static void FillRowCol_(Index n_entries, const CompoundSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00108
00109 static void FillValues_(Index n_entries, const CompoundSymMatrix& matrix, Number* values);
00110
00111 static void FillRowCol_(Index n_entries, const ScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00112
00113 static void FillValues_(Index n_entries, const ScaledMatrix& matrix, Number* values);
00114
00115 static void FillRowCol_(Index n_entries, const SymScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00116
00117 static void FillValues_(Index n_entries, const SymScaledMatrix& matrix, Number* values);
00118
00119 static void FillRowCol_(Index n_entries, const TransposeMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
00120
00121 static void FillValues_(Index n_entries, const TransposeMatrix& matrix, Number* values);
00122
00123 };
00124 }
00125
00126 #endif