Ipopt Documentation  
IpSymMatrix.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 __IPSYMMATRIX_HPP__
8#define __IPSYMMATRIX_HPP__
9
10#include "IpUtils.hpp"
11#include "IpMatrix.hpp"
12
13namespace Ipopt
14{
15
16/* forward declarations */
17class SymMatrixSpace;
18
21{
22public:
25
27 inline SymMatrix(
28 const SymMatrixSpace* owner_space
29 );
30
32 virtual ~SymMatrix()
33 { }
35
38
39 inline Index Dim() const;
41
42 inline SmartPtr<const SymMatrixSpace> OwnerSymMatrixSpace() const;
43
44protected:
47
53 virtual void TransMultVectorImpl(
54 Number alpha,
55 const Vector& x,
56 Number beta,
57 Vector& y
58 ) const
59 {
60 // Since this matrix is symmetric, this is the same operation as MultVector
61 MultVector(alpha, x, beta, y);
62 }
63
68 virtual void ComputeColAMaxImpl(
69 Vector& cols_norms,
70 bool init
71 ) const
72 {
73 ComputeRowAMaxImpl(cols_norms, init);
74 }
76
77private:
82};
83
86{
87public:
90
94 Index dim
95 )
96 : MatrixSpace(dim, dim)
97 { }
98
101 { }
103
105 virtual SymMatrix* MakeNewSymMatrix() const = 0;
106
107 virtual Matrix* MakeNew() const
108 {
109 return MakeNewSymMatrix();
110 }
111
115 Index Dim() const
116 {
117 DBG_ASSERT(NRows() == NCols());
118 return NRows();
119 }
120
121private:
131
133
134 /* Copy constructor */
136 const SymMatrixSpace&
137 );
138
141 const SymMatrixSpace&
142 );
144
145};
146
147/* inline methods */
149 const SymMatrixSpace* owner_space
150)
151 : Matrix(owner_space),
152 owner_space_(owner_space)
153{ }
154
155inline Index SymMatrix::Dim() const
156{
157 return owner_space_->Dim();
158}
159
161{
162 return owner_space_;
163}
164
165} // namespace Ipopt
166
167#endif
#define DBG_ASSERT(test)
Definition: IpDebug.hpp:27
MatrixSpace base class, corresponding to the Matrix base class.
Definition: IpMatrix.hpp:327
Matrix Base Class.
Definition: IpMatrix.hpp:28
Template class for Smart Pointers.
Definition: IpSmartPtr.hpp:165
SymMatrixSpace base class, corresponding to the SymMatrix base class.
Definition: IpSymMatrix.hpp:86
Index Dim() const
Accessor method for the dimension of the matrices in this matrix space.
SymMatrixSpace(Index dim)
Constructor, given the dimension (identical to the number of rows and columns).
Definition: IpSymMatrix.hpp:93
SymMatrixSpace & operator=(const SymMatrixSpace &)
Default Assignment Operator.
SymMatrixSpace(const SymMatrixSpace &)
virtual Matrix * MakeNew() const
Pure virtual method for creating a new Matrix of the corresponding type.
SymMatrixSpace()
Default constructor.
virtual SymMatrix * MakeNewSymMatrix() const =0
Pure virtual method for creating a new matrix of this specific type.
virtual ~SymMatrixSpace()
Destructor.
This is the base class for all derived symmetric matrix types.
Definition: IpSymMatrix.hpp:21
virtual ~SymMatrix()
Destructor.
Definition: IpSymMatrix.hpp:32
SmartPtr< const SymMatrixSpace > OwnerSymMatrixSpace() const
const SymMatrixSpace * owner_space_
Copy of the owner space ptr as a SymMatrixSpace instead of a MatrixSpace.
Definition: IpSymMatrix.hpp:81
SymMatrix(const SymMatrixSpace *owner_space)
Constructor, taking the owner_space.
virtual void ComputeColAMaxImpl(Vector &cols_norms, bool init) const
Implementation of ComputeColAMaxImpl, which calls ComputeRowAMaxImpl.
Definition: IpSymMatrix.hpp:68
Index Dim() const
Dimension of the matrix (number of rows and columns)
virtual void TransMultVectorImpl(Number alpha, const Vector &x, Number beta, Vector &y) const
Implementation of TransMultVectorImpl, which calls MultVectorImpl.
Definition: IpSymMatrix.hpp:53
Vector Base Class.
Definition: IpVector.hpp:48
#define IPOPTLIB_EXPORT
Definition: config.h:94
This file contains a base class for all exceptions and a set of macros to help with exceptions.
ipindex Index
Type of all indices of vectors, matrices etc.
Definition: IpTypes.hpp:20
ipnumber Number
Type of all numbers.
Definition: IpTypes.hpp:17