MPsdExpr::MPsdExpr()
Construct a MPsdExpr object with the given shape and a constant.
Synopsis
MPsdExpr(const Shape<N> &shp, double constant)
Arguments
shp
: shape of MPsdExpr.
constant
: constant number, default vlaue is 0.0.
MPsdExpr::MPsdExpr()
Construct a MPsdExpr object with the given shape and a PSD expression.
Synopsis
MPsdExpr(const Shape<N> &shp, const PsdExpr &expr)
Arguments
shp
: shape of MPsdExpr.
expr
: a PSD expression.
MPsdExpr::AddConstant()
Add constant to each quadratic expression in MPsdExpr object.
Synopsis
void AddConstant(double constant)
Arguments
constant
: the value of the constant.
MPsdExpr::AddConstant()
Add constants to each PSD expression in MPsdExpr object.
Synopsis
template <class T> void AddConstant(const NdArray<T, N> &constants)
Arguments
constants
: N-dimension NdArray object.
MPsdExpr::AddLinExpr()
Add a linear expression to each PsdExpr in MPsdExpr object.
Synopsis
void AddLinExpr(const Expr &expr, double mult)
Arguments
expr
: linear expression object.
mult
: the multiplier of linear expression, default value is 1.0.
MPsdExpr::AddMExpr()
Add MExpression to each PSD expression in MPsdExpr object.
Synopsis
void AddMExpr(const MExpression &expr, double mult)
Arguments
expr
: MExpression object.
mult
: the multiplier of MExpression, default value is 1.0.
MPsdExpr::AddMLinExpr()
Add linear expressions to MPsdExpr 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.
MPsdExpr::AddMPsdExpr()
Add PSD expressions to MPsdExpr object.
Synopsis
void AddMPsdExpr(const MPsdExpr<N> &exprs, double mult)
Arguments
exprs
: N-dimension MPsdExpr object.
mult
: the same multiplier for added PSD expressions, default value is 1.0.
MPsdExpr::AddPsdExpr()
Add a PSD expression to each PSD expression in MPsdExpr object.
Synopsis
void AddPsdExpr(const PsdExpr &expr, double mult)
Arguments
expr
: PSD expression object.
mult
: the multiplier of PSD expression, default value is 1.0.
MPsdExpr::AddTerm()
Add a linear term to MPsdExpr object.
Synopsis
void AddTerm(const Var &var, double coeff)
Arguments
var
: variable of new term.
coeff
: coefficient of new term.
MPsdExpr::AddTerm()
Add a PSD term to MPsdExpr object.
Synopsis
void AddTerm(const PsdVar &var, const SymMatrix &mat)
Arguments
var
: PSD variable of new PSD term.
mat
: coefficient matrix of new PSD term.
MPsdExpr::AddTerm()
Add a PSD term to MPsdExpr object.
Synopsis
void AddTerm(const PsdVar &var, const SymMatExpr &expr)
Arguments
var
: PSD variable of new PSD term.
expr
: coefficient expression of symmetric matrices of new PSD term.
MPsdExpr::AddTerms()
Add terms to PSD expressions in MPsdExpr 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.
MPsdExpr::AddTerms()
Add terms to PSD expressions in MPsdExpr 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.
MPsdExpr::Clear()
Clear MPsdExpr object.
Synopsis
void Clear()
MPsdExpr::Clone()
Clone MPsdExpr object.
Synopsis
MPsdExpr Clone()
Return
new MPsdExpr object.
MPsdExpr::Diagonal()
Get diagonals of MPsdExpr object.
Synopsis
MPsdExpr<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 MPsdExpr.
axis2
: 2nd axis of MPsdExpr.Return
(N-1)-dimensional diagonals.
MPsdExpr::Expand()
Expand shape of MPsdExpr object.
Synopsis
MPsdExpr<N + 1> Expand(int axis)
Arguments
axis
: axis of MPsdExpr.Return
MPsdExpr object of (N+1)-dimensional shape.
MPsdExpr::Flatten()
Flatten a MPsdExpr object to a 1-dimensional shape.
Synopsis
MPsdExpr<1> Flatten()
Return
a MPsdExpr object collapsed into one dimension.
MPsdExpr::GetDim()
Get i-th dimension of MPsdExpr object.
Synopsis
size_t GetDim(int i)
Arguments
i
: index of dimensionReturn
i-th dimension.
MPsdExpr::GetND()
Get number of dimensions of MPsdExpr object.
Synopsis
int GetND()
Return
number of dimensions.
MPsdExpr::GetShape()
Get shape of MPsdExpr object.
Synopsis
Shape<N> GetShape()
Return
shape object.
MPsdExpr::GetSize()
Get size of MPsdExpr object.
Synopsis
size_t GetSize()
Return
number of PSD expressions.
MPsdExpr::Item()
Get PSD expression of given index from MPsdExpr object.
Synopsis
PsdExpr &Item(size_t idx)
Arguments
idx
: index of PSD expression.Return
PSD expression object.
MPsdExpr::Item()
Get sub-arrays of MPsdExpr object, given view object.
Synopsis
MPsdExpr Item(const View &view)
Arguments
view
: view of multi-dimensional array.Return
sub-arrays of MPsdExpr object.
MPsdExpr::operator[]()
Get PSD expression of given index from MPsdExpr object.
Synopsis
PsdExpr &operator[](size_t i)
Arguments
i
: index of PSD expression.Return
PSD expression object.
MPsdExpr::operator[]()
Get PSD expressions of given view from MPsdExpr object.
Synopsis
MPsdExpr operator[](const View &view)
Arguments
view
: view of multi-dimensional array.Return
new MPsdExpr object.
MPsdExpr::Pick()
Given a list of indexes, get PSD expressions from MPsdExpr object.
Synopsis
MPsdExpr<1> Pick(const NdArray<int, 1> &indexes)
Arguments
indexes
: indexes of elements.Return
one-dimensional array of desired PSD expressions.
MPsdExpr::Pick()
Given a list of indexes, get PSD expressions from MPsdExpr object.
Synopsis
MPsdExpr<1> Pick(const NdArray<int, 2> &idxrows)
Arguments
idxrows
: indexes in format of 2-dimensional array, where each row is position of element.Return
one-dimensional array of desired PSD expressions.
MPsdExpr::Repeat()
Repeat each element of MPsdExpr along given axis.
Synopsis
MPsdExpr<N> Repeat(size_t repeats, int axis)
Arguments
repeats
: number of repetitions for each element.
axis
: axis of MPsdExpr.Return
new MPsdExpr object.
MPsdExpr::RepeatBlock()
Repeat an MPsdExpr a number of times along given axis.
Synopsis
MPsdExpr<N> RepeatBlock(size_t repeats, int axis)
Arguments
repeats
: number of repetitions.
axis
: axis of MPsdExpr.Return
new MPsdExpr object.
MPsdExpr::Represent()
String representation of MPsdExpr object.
Synopsis
std::string Represent(size_t maxlen)
Arguments
maxlen
: max length of representation.Return
string object.
MPsdExpr::Reshape()
Reshape MPsdExpr object to new shape.
Synopsis
template <int M> MPsdExpr<M> Reshape(const Shape<M> &shape)
Arguments
shape
: new shape of M-dimensions.Return
M-dimensional MPsdExpr object.
MPsdExpr::SetItem()
Set PSD expression of given index to MPsdExpr object.
Synopsis
void SetItem(size_t idx, const PsdExpr &expr)
Arguments
idx
: index of element.
expr
: PSD expression object.
MPsdExpr::Squeeze()
Remove axis of length 1 from shape of MPsdExpr object.
Synopsis
MPsdExpr<N - 1> Squeeze(int axis)
Arguments
axis
: axis of MPsdExpr, where the length is 1.Return
MPsdExpr object of (N-1)-dimensional shape.
MPsdExpr::Stack()
Stack with other MPsdExpr object along given axis.
Synopsis
MPsdExpr<N> Stack(const MPsdExpr<N> &other, int axis)
Arguments
other
: a MPsdExpr object.
axis
: an axis of MPsdExpr.Return
the result MPsdExpr object.
MPsdExpr::Stack()
Stack with other MLinExpr object along given axis.
Synopsis
MPsdExpr<N> Stack(const MLinExpr<N> &other, int axis)
Arguments
other
: a MLinExpr object.
axis
: an axis of MPsdExpr.Return
the result MPsdExpr object.
MPsdExpr::Stack()
Stack with other MVar object along given axis.
Synopsis
MPsdExpr<N> Stack(const MVar<N> &other, int axis)
Arguments
other
: a MVar object.
axis
: an axis of MPsdExpr.Return
the result MPsdExpr object.
MPsdExpr::Stack()
Stack with other NdArray object along given axis.
Synopsis
template <class T> MPsdExpr<N> Stack(const NdArray<T, N> &other, int axis)
Arguments
other
: a NdArray object.
axis
: an axis of MPsdExpr.Return
the result MPsdExpr object.
MPsdExpr::SubConstant()
Substract constants from each PSD expression in MPsdExpr object.
Synopsis
template <class T> void SubConstant(const NdArray<T, N> &constants)
Arguments
constants
: N-dimension NdArray object.
MPsdExpr::Sum()
Sum of all quadratic expressions in MPsdExpr object.
Synopsis
MPsdExpr<0> Sum()
Return
sum in zero dimension.
MPsdExpr::Sum()
Sum of quadratic expressions at given axis of MPsdExpr object.
Synopsis
MPsdExpr<N - 1> Sum(int axis)
Arguments
axis
: axis of MPsdExpr.Return
MPsdExpr object in (N-1)-dimension.
MPsdExpr::Transpose()
Perform matrix transpose of MPsdExpr object.
Synopsis
MPsdExpr<N> Transpose()
Return
transposed MPsdExpr object.