MQuadExpr::MQuadExpr()
Construct a MQuadExpr object with the given shape and a constant.
Synopsis
MQuadExpr(const Shape<N> &shp, double constant)
Arguments
shp
: shape of MQuadExpr.
constant
: constant number.
MQuadExpr::MQuadExpr()
Construct a MQuadExpr object with the given shape and a quadratic expression.
Synopsis
MQuadExpr(const Shape<N> &shp, const QuadExpr &expr)
Arguments
shp
: shape of MQuadExpr.
expr
: a quadratic expression.
MQuadExpr::MQuadExpr()
Construct a MQuadExpr object with the given shape and a MQExpression object.
Synopsis
MQuadExpr(const Shape<N> &shp, const MQExpression &expr)
Arguments
shp
: shape of MQuadExpr.
expr
: a MQExpression object.
MQuadExpr::AddConstant()
Add constant to each quadratic expression in MQuadExpr object.
Synopsis
void AddConstant(double constant)
Arguments
constant
: the value of the constant.
MQuadExpr::AddConstant()
Add constants to each quadratic expression in MQuadExpr object.
Synopsis
template <class T> void AddConstant(const NdArray<T, N> &constants)
Arguments
constants
: N-dimension NdArray object.
MQuadExpr::AddExpr()
Add a linear expression to each quadratic expression in MQuadExpr object.
Synopsis
void AddExpr(const Expr &expr, double mult)
Arguments
expr
: linear expression object.
mult
: the multiplier of linear expression, default value is 1.0.
MQuadExpr::AddMExpr()
Add MExpression to each quadratic expression in MQuadExpr object.
Synopsis
void AddMExpr(const MExpression &expr, double mult)
Arguments
expr
: MExpression object.
mult
: the multiplier of MExpression, default value is 1.0.
MQuadExpr::AddMLinExpr()
Add linear expressions to MQuadExpr object.
Synopsis
void AddMLinExpr(const MLinExpr<N> &exprs, double mult)
Arguments
exprs
: N-dimension MLinExpr object.
mult
: the same multiplier for added linear expressions, default value is 1.0.
MQuadExpr::AddMQExpr()
Add MQExpression to each quadratic expression in MQuadExpr object.
Synopsis
void AddMQExpr(const MQExpression &expr, double mult)
Arguments
expr
: MQExpression object.
mult
: the multiplier of MQExpression, default value is 1.0.
MQuadExpr::AddMQuadExpr()
Add quadratic expressions to MQuadExpr object.
Synopsis
void AddMQuadExpr(const MQuadExpr<N> &exprs, double mult)
Arguments
exprs
: N-dimension MQuadExpr object.
mult
: the same multiplier for added quadratic expressions, default value is 1.0.
MQuadExpr::AddQuadExpr()
Add a quadratic expression to each quadratic expression in MQuadExpr object.
Synopsis
void AddQuadExpr(const QuadExpr &expr, double mult)
Arguments
expr
: quadratic expression object.
mult
: the multiplier of quadratic expression, default value is 1.0.
MQuadExpr::AddTerm()
Add a linear term to MQuadExpr object.
Synopsis
void AddTerm(const Var &var, double coeff)
Arguments
var
: variable of new term.
coeff
: coefficient of new term.
MQuadExpr::AddTerm()
Add a quadratic term to MQuadExpr object.
Synopsis
void AddTerm(
const Var &var1,
const Var &var2,
double coeff)
Arguments
var1
: first variable of new quadratic term.
var2
: second variable of new quadratic term.
coeff
: coefficient of new quadratic term.
MQuadExpr::AddTerms()
Add terms to quadratic expressions in MQuadExpr object.
Synopsis
void AddTerms(const MVar<N> &vars, double mult)
Arguments
vars
: N-dimension MVar object for added terms.
mult
: the same coefficient for added terms, default value 1.0.
MQuadExpr::AddTerms()
Add terms to quadratic expressions in MQuadExpr object.
Synopsis
void AddTerms(const MVar<N> &vars, const NdArray<double, N> &coeffs)
Arguments
vars
: N-dimension MVar object for added terms.
coeffs
: N-dimension NdArray object of coefficients for added terms.
MQuadExpr::Clear()
Clear MQuadExpr object.
Synopsis
void Clear()
MQuadExpr::Clone()
Clone MQuadExpr object.
Synopsis
MQuadExpr Clone()
Return
new MQuadExpr object.
MQuadExpr::Diagonal()
Get diagonals of MQuadExpr object.
Synopsis
MQuadExpr<N - 1> Diagonal(
int offset,
int axis1,
int axis2)
Arguments
offset
: offset of the diagonal from the main diagonal. Can be positive or negative.
axis1
: 1st axis of MQuadExpr.
axis2
: 2nd axis of MQuadExpr.Return
(N-1)-dimensional diagonals.
MQuadExpr::Expand()
Expand shape of MQuadExpr object.
Synopsis
MQuadExpr<N + 1> Expand(int axis)
Arguments
axis
: axis of MQuadExpr.Return
MQuadExpr object of (N+1)-dimensional shape.
MQuadExpr::Flatten()
Flatten a MQuadExpr object to a 1-dimensional shape.
Synopsis
MQuadExpr<1> Flatten()
Return
a MQuadExpr object collapsed into one dimension.
MQuadExpr::GetDim()
Get i-th dimension of MQuadExpr object.
Synopsis
size_t GetDim(int i)
Arguments
i
: index of dimensionReturn
i-th dimension.
MQuadExpr::GetND()
Get number of dimensions of MQuadExpr object.
Synopsis
int GetND()
Return
number of dimensions.
MQuadExpr::GetShape()
Get shape of MQuadExpr object.
Synopsis
Shape<N> GetShape()
Return
shape object.
MQuadExpr::GetSize()
Get size of MQuadExpr object.
Synopsis
size_t GetSize()
Return
number of MQExpressions.
MQuadExpr::Item()
Get quadratic expression of given index from MQuadExpr object.
Synopsis
MQExpression &Item(size_t idx)
Arguments
idx
: index of quadratic expression.Return
quadratic expression object.
MQuadExpr::operator[]()
Get quadratic expression of given index from MQuadExpr object.
Synopsis
MQExpression &operator[](size_t i)
Arguments
i
: index of quadratic expression.Return
quadratic expression object.
MQuadExpr::operator[]()
Get constraints of given view from MQuadExpr object.
Synopsis
MQuadExpr operator[](const View &view)
Arguments
view
: view of multi-dimensional array.Return
new MQuadExpr object.
MQuadExpr::Represent()
String representation of MQuadExpr object.
Synopsis
std::string Represent(size_t maxlen)
Arguments
maxlen
: max length of representation.Return
string object.
MQuadExpr::Reshape()
Reshape MQuadExpr object to new shape.
Synopsis
template <int M> MQuadExpr<M> Reshape(const Shape<M> &shape)
Arguments
shape
: new shape of M-dimensions.Return
M-dimensional MQuadExpr object.
MQuadExpr::SetItem()
Set quadratic expression of given index to MQuadExpr object.
Synopsis
void SetItem(size_t idx, const MQExpression &expr)
Arguments
idx
: index of element.
expr
: MQExpression object.
MQuadExpr::Squeeze()
Remove axis of length 1 from shape of MQuadExpr object.
Synopsis
MQuadExpr<N - 1> Squeeze(int axis)
Arguments
axis
: axis of MQuadExpr, where the length is 1.Return
MQuadExpr object of (N-1)-dimensional shape.
MQuadExpr::SubConstant()
Substract constants from each quadratic expression in MQuadExpr object.
Synopsis
template <class T> void SubConstant(const NdArray<T, N> &constants)
Arguments
constants
: N-dimension NdArray object.
MQuadExpr::Sum()
Sum of all quadratic expressions in MQuadExpr object.
Synopsis
MQuadExpr<0> Sum()
Return
sum in zero dimension.
MQuadExpr::Sum()
Sum of quadratic expressions at given axis of MQuadExpr object.
Synopsis
MQuadExpr<N - 1> Sum(int axis)
Arguments
axis
: axis of MQuadExpr.Return
MQuadExpr object in (N-1)-dimension.
MQuadExpr::Transpose()
Perform matrix transpose of MQuadExpr object.
Synopsis
MQuadExpr<N> Transpose()
Return
transposed MQuadExpr object.