1 // Copyright (C) 2004, 2006 International Business Machines and others. 2 // All Rights Reserved. 3 // This code is published under the Common Public License. 4 // 5 // $Id: IpZeroMatrix.hpp 759 2006-07-07 03:07:08Z andreasw $ 6 // 7 // Authors: Carl Laird, Andreas Waechter IBM 2004-08-13 8 9 #ifndef __IPZEROMATRIX_HPP__ 10 #define __IPZEROMATRIX_HPP__ 11 12 #include "IpUtils.hpp" 13 #include "IpMatrix.hpp" 14 15 namespace SimTKIpopt 16 { 17 18 /** Class for Matrices with only zero entries. 19 */ 20 class ZeroMatrix : public Matrix 21 { 22 public: 23 24 /**@name Constructors / Destructors */ 25 //@{ 26 27 /** Constructor, taking the corresponding matrix space. 28 */ 29 ZeroMatrix(const MatrixSpace* owner_space); 30 31 /** Destructor */ 32 ~ZeroMatrix(); 33 //@} 34 35 protected: 36 /**@name Methods overloaded from matrix */ 37 //@{ 38 virtual void MultVectorImpl(Number alpha, const Vector& x, 39 Number beta, Vector& y) const override; 40 41 virtual void TransMultVectorImpl(Number alpha, const Vector& x, 42 Number beta, Vector& y) const override; 43 44 virtual void PrintImpl(const Journalist& jnlst, 45 EJournalLevel level, 46 EJournalCategory category, 47 const std::string& name, 48 Index indent, 49 const std::string& prefix) const override; 50 //@} 51 52 private: 53 /**@name Default Compiler Generated Methods 54 * (Hidden to avoid implicit creation/calling). 55 * These methods are not implemented and 56 * we do not want the compiler to implement 57 * them for us, so we declare them private 58 * and do not define them. This ensures that 59 * they will not be implicitly created/called. */ 60 //@{ 61 /** Default Constructor */ 62 ZeroMatrix(); 63 64 /** Copy Constructor */ 65 ZeroMatrix(const ZeroMatrix&); 66 67 /** Overloaded Equals Operator */ 68 void operator=(const ZeroMatrix&); 69 //@} 70 }; 71 72 /** Class for matrix space for ZeroMatrix. */ 73 class ZeroMatrixSpace : public MatrixSpace 74 { 75 public: 76 /** @name Constructors / Destructors */ 77 //@{ 78 /** Constructor, given the number of row and columns. 79 */ ZeroMatrixSpace(Index nrows,Index ncols)80 ZeroMatrixSpace(Index nrows, Index ncols) 81 : 82 MatrixSpace(nrows, ncols) 83 {} 84 85 /** Destructor */ ~ZeroMatrixSpace()86 virtual ~ZeroMatrixSpace() 87 {} 88 //@} 89 90 /** Overloaded MakeNew method for the MatrixSpace base class. 91 */ MakeNew() const92 virtual Matrix* MakeNew() const override 93 { 94 return MakeNewZeroMatrix(); 95 } 96 97 /** Method for creating a new matrix of this specific type. */ MakeNewZeroMatrix() const98 ZeroMatrix* MakeNewZeroMatrix() const 99 { 100 return new ZeroMatrix(this); 101 } 102 private: 103 /**@name Default Compiler Generated Methods 104 * (Hidden to avoid implicit creation/calling). 105 * These methods are not implemented and 106 * we do not want the compiler to implement 107 * them for us, so we declare them private 108 * and do not define them. This ensures that 109 * they will not be implicitly created/called. */ 110 //@{ 111 /** Default Constructor */ 112 ZeroMatrixSpace(); 113 114 /** Copy Constructor */ 115 ZeroMatrixSpace(const ZeroMatrixSpace&); 116 117 /** Overloaded Equals Operator */ 118 void operator=(const ZeroMatrixSpace&); 119 //@} 120 }; 121 } // namespace Ipopt 122 #endif 123