Ipopt  3.12.13
IpTripletHelper.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2009 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // $Id$
6 //
7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
8 
9 #ifndef __IPTRIPLETHELPER_HPP__
10 #define __IPTRIPLETHELPER_HPP__
11 
12 #include "IpTypes.hpp"
13 #include "IpException.hpp"
14 
15 namespace Ipopt
16 {
17 
18  DECLARE_STD_EXCEPTION(UNKNOWN_MATRIX_TYPE);
19  DECLARE_STD_EXCEPTION(UNKNOWN_VECTOR_TYPE);
20 
22  class Matrix;
23  class GenTMatrix;
24  class SymTMatrix;
25  class DiagMatrix;
26  class IdentityMatrix;
27  class ExpansionMatrix;
28  class ScaledMatrix;
29  class SymScaledMatrix;
30  class SumMatrix;
31  class SumSymMatrix;
32  class ZeroMatrix;
33  class ZeroSymMatrix;
34  class CompoundMatrix;
35  class CompoundSymMatrix;
36  class TransposeMatrix;
37  class ExpandedMultiVectorMatrix;
38  class Vector;
39 
41  {
42  public:
46  static Index GetNumberEntries(const Matrix& matrix);
47 
49  static void FillRowCol(Index n_entries, const Matrix& matrix, Index* iRow, Index* jCol, Index row_offset=0, Index col_offset=0);
50 
52  static void FillValues(Index n_entries, const Matrix& matrix, Number* values);
53 
55  static void FillValuesFromVector(Index dim, const Vector& vector, Number* values);
56 
58  static void PutValuesInVector(Index dim, const double* values, Vector& vector);
60 
61  private:
63  static Index GetNumberEntries_(const SumMatrix& matrix);
64 
66  static Index GetNumberEntries_(const SumSymMatrix& matrix);
67 
69  static Index GetNumberEntries_(const CompoundMatrix& matrix);
70 
72  static Index GetNumberEntries_(const CompoundSymMatrix& matrix);
73 
75  static Index GetNumberEntries_(const TransposeMatrix& matrix);
76 
79 
80  static void FillRowCol_(Index n_entries, const GenTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
81 
82  static void FillValues_(Index n_entries, const GenTMatrix& matrix, Number* values);
83 
84  static void FillRowCol_(Index n_entries, const SymTMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
85 
86  static void FillValues_(Index n_entries, const SymTMatrix& matrix, Number* values);
87 
88  static void FillRowCol_(Index n_entries, const DiagMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
89 
90  static void FillValues_(Index n_entries, const DiagMatrix& matrix, Number* values);
91 
92  static void FillRowCol_(Index n_entries, const IdentityMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
93 
94  static void FillValues_(Index n_entries, const IdentityMatrix& matrix, Number* values);
95 
96  static void FillRowCol_(Index n_entries, const ExpansionMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
97 
98  static void FillValues_(Index n_entries, const ExpansionMatrix& matrix, Number* values);
99 
100  static void FillRowCol_(Index n_entries, const SumMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
101 
102  static void FillValues_(Index n_entries, const SumMatrix& matrix, Number* values);
103 
104  static void FillRowCol_(Index n_entries, const SumSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
105 
106  static void FillValues_(Index n_entries, const SumSymMatrix& matrix, Number* values);
107 
108  static void FillRowCol_(Index n_entries, const CompoundMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
109 
110  static void FillValues_(Index n_entries, const CompoundMatrix& matrix, Number* values);
111 
112  static void FillRowCol_(Index n_entries, const CompoundSymMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
113 
114  static void FillValues_(Index n_entries, const CompoundSymMatrix& matrix, Number* values);
115 
116  static void FillRowCol_(Index n_entries, const ScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
117 
118  static void FillValues_(Index n_entries, const ScaledMatrix& matrix, Number* values);
119 
120  static void FillRowCol_(Index n_entries, const SymScaledMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
121 
122  static void FillValues_(Index n_entries, const SymScaledMatrix& matrix, Number* values);
123 
124  static void FillRowCol_(Index n_entries, const TransposeMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
125 
126  static void FillValues_(Index n_entries, const TransposeMatrix& matrix, Number* values);
127 
128  static void FillRowCol_(Index n_entries, const ExpandedMultiVectorMatrix& matrix, Index row_offset, Index col_offset, Index* iRow, Index* jCol);
129 
130  static void FillValues_(Index n_entries, const ExpandedMultiVectorMatrix& matrix, Number* values);
131 
132  };
133 } // namespace Ipopt
134 
135 #endif
Ipopt::SymScaledMatrix
Class for a Matrix in conjunction with its scaling factors for row and column scaling.
Definition: IpSymScaledMatrix.hpp:26
Ipopt::CompoundSymMatrix
Class for symmetric matrices consisting of other matrices.
Definition: IpCompoundSymMatrix.hpp:24
Ipopt::TripletHelper::FillValuesFromVector
static void FillValuesFromVector(Index dim, const Vector &vector, Number *values)
fill the values from the vector into a dense double* structure
Ipopt::ScaledMatrix
Class for a Matrix in conjunction with its scaling factors for row and column scaling.
Definition: IpScaledMatrix.hpp:26
Ipopt::SumMatrix
Class for Matrices which are sum of matrices.
Definition: IpSumMatrix.hpp:24
Ipopt::TripletHelper::FillValues
static void FillValues(Index n_entries, const Matrix &matrix, Number *values)
fill the values for the triplet format from the matrix
Ipopt::TripletHelper::FillRowCol_
static void FillRowCol_(Index n_entries, const GenTMatrix &matrix, Index row_offset, Index col_offset, Index *iRow, Index *jCol)
Ipopt
Definition: matlabjournal.hpp:14
Ipopt::Number
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Ipopt::Matrix
Matrix Base Class.
Definition: IpMatrix.hpp:27
Ipopt::TripletHelper::FillRowCol
static void FillRowCol(Index n_entries, const Matrix &matrix, Index *iRow, Index *jCol, Index row_offset=0, Index col_offset=0)
fill the irows, jcols structure for the triplet format from the matrix
Ipopt::CompoundMatrix
Class for Matrices consisting of other matrices.
Definition: IpCompoundMatrix.hpp:34
Ipopt::TripletHelper::FillValues_
static void FillValues_(Index n_entries, const GenTMatrix &matrix, Number *values)
Ipopt::TripletHelper::GetNumberEntries
static Index GetNumberEntries(const Matrix &matrix)
find the total number of triplet entries of a Matrix
Ipopt::SumSymMatrix
Class for Matrices which are sum of symmetric matrices.
Definition: IpSumSymMatrix.hpp:24
Ipopt::TripletHelper
Definition: IpTripletHelper.hpp:40
Ipopt::Index
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Ipopt::TripletHelper::GetNumberEntries_
static Index GetNumberEntries_(const SumMatrix &matrix)
find the total number of triplet entries for the SumMatrix
IpTypes.hpp
Ipopt::TripletHelper::PutValuesInVector
static void PutValuesInVector(Index dim, const double *values, Vector &vector)
put the values from the double* back into the vector
Ipopt::IdentityMatrix
Class for Matrices which are multiples of the identity matrix.
Definition: IpIdentityMatrix.hpp:21
Ipopt::GenTMatrix
Class for general matrices stored in triplet format.
Definition: IpGenTMatrix.hpp:36
Ipopt::ExpandedMultiVectorMatrix
Class for Matrices with few rows that consists of Vectors, together with a premultiplied Expansion ma...
Definition: IpExpandedMultiVectorMatrix.hpp:29
Ipopt::DiagMatrix
Class for diagonal matrices.
Definition: IpDiagMatrix.hpp:20
Ipopt::SymTMatrix
Class for symmetric matrices stored in triplet format.
Definition: IpSymTMatrix.hpp:42
Ipopt::TransposeMatrix
Class for Matrices which are the transpose of another matrix.
Definition: IpTransposeMatrix.hpp:23
IpException.hpp
Ipopt::ExpansionMatrix
Class for expansion/projection matrices.
Definition: IpExpansionMatrix.hpp:27
Ipopt::DECLARE_STD_EXCEPTION
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
Ipopt::Vector
Vector Base Class.
Definition: IpVector.hpp:47