Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
QuadraticCombination.hpp
Go to the documentation of this file.
1 /*
2  * $Id: QuadraticCombination.hpp 121 2013-06-23 16:18:51Z jdl3 $
3  * Copyright (C) 2013 John D Lamb
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or (at
8  * your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 
20 #ifndef IPO_FUNCTION_CONCRETE_QUADRATICCOMBINATION_HPP
21 #define IPO_FUNCTION_CONCRETE_QUADRATICCOMBINATION_HPP
22 
23 #include<ccgsl/blas.hpp>
24 #include"../Function.hpp"
25 #include"../DerivativesEstimates.hpp"
26 #include"../../ipo/IPOException.hpp"
27 
28 namespace ipo_function {
29  namespace concrete {
39  public:
48  QuadraticCombination( size_t const size = 0 );
53  void resize( size_t const size );
60  void setCoefficient( size_t const index, double const value );
69  void setCoefficient( size_t const row, size_t const col, double const value );
76  double getCoefficient( size_t const index ) const ;
86  double getCoefficient( size_t const row, size_t const col ) const ;
91  gsl::matrix const& getCoefficients() const;
97  void setCoefficients( gsl::matrix const& matrix );
103  virtual double operator()( gsl::vector const& vector );
110  virtual gsl::vector gradient( gsl::vector const& vector );
117  virtual gsl::matrix hessian( gsl::vector const& vector );
122  virtual void setVector( gsl::vector const& vector );
123  protected:
127  gsl::matrix coefficients;
128  };
129 
130  }
131 }
132 
133 #endif
gsl::matrix const & getCoefficients() const
Get the coefficients as a matrix by reference.
virtual gsl::matrix hessian() const
virtual gsl::vector gradient() const
virtual double value() const
Base class for derivative estimates with Hessian.
void resize(size_t const size)
Resize the matrix of coefficients.
void setCoefficients(gsl::matrix const &matrix)
Set coefficients from a matrix.
QuadraticCombination(size_t const size=0)
The constructor sets up function as a quadratic combination of size entries.
Namespace for functions that can be used by ipo::Objective and ipo::Constraint.
gsl::matrix coefficients
The matrix of coefficients;.
double getCoefficient(size_t const index) const
Get the value of a coefficient on the diagonal.
This class computes a function at a vector.
Definition: Function.hpp:38
virtual double operator()(gsl::vector const &vector)
The function operator: computes the sum of the vector entries.
virtual void setVector(gsl::vector const &vector)
Set a vector and compute function value, gradient and Hessian efficiently.
size_t const size
Size of vector arguments to supply to subclass functions.
void setCoefficient(size_t const index, double const value)
Set the value of a coefficient on the diagonal.
This class provides function objects representing quadratic combinations of the elements of their mat...