Template Class monomial

Template Parameter Order

  1. typename _Tp

Class Documentation

template<typename _Tp>
class monomial

Reference: S.P. Boyd, S.-J. Kim and L.Vandenberghe and A. Hassibi. A Tutorial on Geometric Programming. Available at http://www.standford.edu/~boyd/gp_tutorial.html Monomial function object. Let $x_1$, …, $x_n$ denote $n$ real positive variable and x = ($x_1$, …, $x_n$) a vector with components $x_i$. A read valued function f of x, with the form

f(x0, …, xn-1) = c * x0^a1 * x2^a2 … xn-1^an-1

where $c$ > 0 and $a_i R$, is called a monomial function, or more informally, a monomial (of the variables $x_1$, …, $x_n$). We refer to the constant $c$ as the coefficient of the monmial, and we refer to the constants $a_1$, … $a_n$ as the exponents of the monomial. As an example, $2.3 x_1^2 x_2^{-0.15}$ is a monomial of the variables $x_1$ and $x_2$, with coefficient 2.3 and $x_2$-exponent -0.15. Any positive constant is a monomial, as is any variable. Monomials are closed under multiplication and division: if $f$ and $g$ are both monomials then so are $f*g$ and $f/g$. (This includes scaling by any positive constant.) A monomial raise to any power is also a monomial.

The term `monomial’, as used here (in the context of geometric programming) is similar to, but differs from the standard definition of `monomial’ used in algebra. In algebra, a monomial has the form about, but the exponents $a_i$ must be non-negative integers, and the coefficent $c$ is one.

Todo:

: In current implementation, the exponent _a is represented by only <double>. The type should be _Tp in general such that it can be also be a <AAF>.

Public Functions

inline explicit monomial(size_t n)

Construct a monomial with n variables.

inline monomial(const _Tp &c, const Vec &a)

Constructor.

inline monomial(const _Tp &c, std::initializer_list<_Tp> lst)

Construct an array with an initializer_list of values.

inline monomial(size_t n, const _Tp &c)

Constructor

template<typename _Up, class Map>
monomial(const monomial<_Up> &mon, const Map &polarity)

Constructor (for AAF -> double)

inline monomial(size_t n, const _Tp ar[])
inline ~monomial()

Destructor

inline _Self &operator*=(const _Self &M)

Multiply and assign

inline _Self &operator/=(const _Self &M)

Divide and assign

inline _Self &operator*=(const _Tp &c)

Multiply and assign

inline _Self &operator/=(const _Tp &c)

Divide and assign

inline _Self operator*(const _Tp &c) const

Multiply

inline _Self operator/(const _Tp &c) const

Divide

inline void sqrt()

Square root

template<typename _Up>
inline _Tp lse(const std::valarray<_Up> &y) const

Function evaluation of log(f(exp(y))), i.e., res = b + dot(a,y).

template<typename _Up>
inline Vec lse_gradient(const _Up&) const

Gradient of log(f(exp(y)))

template<typename _Up>
inline _Tp log_exp_fvalue_with_gradient(const _Up &y, Vec &g) const

Function evaluation and gradient of log(f(exp(y))

template<typename _Up>
inline Vec lse_gradient(const _Up &y, _Tp &f) const

Function evaluation and gradient of log(f(exp(y))

inline void set_coeff(_Tp c)
template<>
monomial(const monomial<aaf> &mon, const pmap &polarity)

Constructor (for aaf -> double)

Public Members

_Tp _b

coefficient in log, i.e. log(c)

Vec _a

vector of exponents (a0, .. an-1)