Ipopt Documentation  
IpSumSymMatrix.hpp
Go to the documentation of this file.
1 // Copyright (C) 2004, 2008 International Business Machines and others.
2 // All Rights Reserved.
3 // This code is published under the Eclipse Public License.
4 //
5 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13
6 
7 #ifndef __IPSUMSYMMATRIX_HPP__
8 #define __IPSUMSYMMATRIX_HPP__
9 
10 #include "IpUtils.hpp"
11 #include "IpSymMatrix.hpp"
12 
13 namespace Ipopt
14 {
15 
16 /* forward declarations */
17 class SumSymMatrixSpace;
18 
24 {
25 public:
27 
32  const SumSymMatrixSpace* owner_space
33  );
34 
36  ~SumSymMatrix();
38 
43  void SetTerm(
44  Index iterm,
45  Number factor,
46  const SymMatrix& matrix
47  );
48 
53  void GetTerm(
54  Index iterm,
55  Number& factor,
57  ) const;
58 
60  Index NTerms() const;
61 
62 protected:
64  virtual void MultVectorImpl(
66  Number alpha,
67  const Vector& x,
68  Number beta,
69  Vector& y
70  ) const;
71 
72  virtual bool HasValidNumbersImpl() const;
73 
74  virtual void ComputeRowAMaxImpl(
75  Vector& rows_norms,
76  bool init
77  ) const;
78 
79  virtual void ComputeColAMaxImpl(
80  Vector& cols_norms,
81  bool init
82  ) const;
83 
84  virtual void PrintImpl(
85  const Journalist& jnlst,
86  EJournalLevel level,
87  EJournalCategory category,
88  const std::string& name,
89  Index indent,
90  const std::string& prefix
91  ) const;
93 
94 private:
103 
105  SumSymMatrix();
106 
108  SumSymMatrix(
109  const SumSymMatrix&
110  );
111 
113  void operator=(
114  const SumSymMatrix&
115  );
117 
119  std::vector<Number> factors_;
120 
122  std::vector<SmartPtr<const SymMatrix> > matrices_;
123 
126 };
127 
130 {
131 public:
133 
138  Index ndim,
139  Index nterms
140  )
141  : SymMatrixSpace(ndim),
142  nterms_(nterms)
143  { }
144 
147  { }
149 
151 
153  Index NTerms() const
154  {
155  return nterms_;
156  }
158 
164  void SetTermSpace(
165  Index term_idx,
166  const SymMatrixSpace& space
167  );
168 
170  SmartPtr<const SymMatrixSpace> GetTermSpace(
171  Index term_idx
172  ) const;
173 
175  SumSymMatrix* MakeNewSumSymMatrix() const;
176 
177  virtual SymMatrix* MakeNewSymMatrix() const;
178 
179 private:
181 
182  std::vector<SmartPtr<const SymMatrixSpace> > term_spaces_;
183 };
184 
185 } // namespace Ipopt
186 #endif
std::vector< Number > factors_
std::vector storing the factors for each term.
std::vector< SmartPtr< const SymMatrix > > matrices_
std::vector storing the matrices for each term.
double Number
Type of all numbers.
Definition: IpTypes.hpp:15
Vector Base Class.
Definition: IpVector.hpp:47
Class for matrix space for SumSymMatrix.
~SumSymMatrixSpace()
Destructor.
EJournalLevel
Print Level Enum.
This file contains a base class for all exceptions and a set of macros to help with exceptions...
SumSymMatrixSpace(Index ndim, Index nterms)
Constructor, given the dimension of the matrix and the number of terms in the sum.
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:20
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:171
Class for Matrices which are sum of symmetric matrices.
int Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:17
Index NTerms() const
Number of terms in the sum.
#define IPOPTLIB_EXPORT
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:85
Class responsible for all message output.
const SumSymMatrixSpace * owner_space_
Copy of the owner_space as a SumSymMatrixSpace.
std::vector< SmartPtr< const SymMatrixSpace > > term_spaces_
EJournalCategory
Category Selection Enum.