Ipopt  3.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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: IpTripletHelper.hpp 2380 2013-09-06 22:57:49Z ghackebeil $
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
static Index GetNumberEntries(const Matrix &matrix)
find the total number of triplet entries of a Matrix
static Index GetNumberEntries_(const SumMatrix &matrix)
find the total number of triplet entries for the SumMatrix
Class for diagonal matrices.
Class for a Matrix in conjunction with its scaling factors for row and column scaling.
static void FillValuesFromVector(Index dim, const Vector &vector, Number *values)
fill the values from the vector into a dense double* structure
double Number
Type of all numbers.
Definition: IpTypes.hpp:17
Vector Base Class.
Definition: IpVector.hpp:47
Class for a Matrix in conjunction with its scaling factors for row and column scaling.
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
Class for symmetric matrices consisting of other matrices.
static void FillValues_(Index n_entries, const GenTMatrix &matrix, Number *values)
Matrix Base Class.
Definition: IpMatrix.hpp:27
Class for Matrices which are the transpose of another matrix.
Class for Matrices which are multiples of the identity matrix.
Class for Matrices which are sum of symmetric matrices.
Class for Matrices with few rows that consists of Vectors, together with a premultiplied Expansion ma...
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:19
Class for general matrices stored in triplet format.
Class for expansion/projection matrices.
DECLARE_STD_EXCEPTION(SUFFIX_EMPTY)
Class for symmetric matrices stored in triplet format.
Class for Matrices which are sum of matrices.
Definition: IpSumMatrix.hpp:24
static void PutValuesInVector(Index dim, const double *values, Vector &vector)
put the values from the double* back into the vector
Class for Matrices consisting of other matrices.
static void FillRowCol_(Index n_entries, const GenTMatrix &matrix, Index row_offset, Index col_offset, Index *iRow, Index *jCol)
static void FillValues(Index n_entries, const Matrix &matrix, Number *values)
fill the values for the triplet format from the matrix