14.2.29 Class Param¶
- mosek::fusion::Param¶
The class defines a set of static methods for manipulating parameters.
- Static members
Param.hstack – Stack a list of parameters horizontally (i.e. along the second dimension).
Param.repeat – Repeat a parameter a number of times in the given dimension.
Param.stack – Stack a list of parameters in an arbitrary dimension.
Param.vstack – Stack a list of parameters vertically (i.e. along the first dimension).
- Param.hstack¶
Parameter::t Param::hstack(shared_ptr<ndarray<Parameter::t,1>> p) Parameter::t Param::hstack(Parameter::t p1, Parameter::t p2) Parameter::t Param::hstack(Parameter::t p1, Parameter::t p2, Parameter::t p3)
Stack a list of parameters horizontally (i.e. along the second dimension). The parameters must have the same shape, except for the second dimension.
For example, if \(p^1,p^2,p^3\) are three parameters of shape
(n,1)
then their horizontal stack is the two-dimensional parameter\[\begin{split}\left[ \begin{array}{ccc} | & | & | \\ p^1 & p^2 & p^3 \\ | & | & | \end{array}\right]\end{split}\]of shape
(n,3)
.
- Param.repeat¶
Parameter::t Param::repeat(Parameter::t p, int n, int dim)
Repeat a parameter a number of times in the given dimension. This is equivalent to stacking
n
copies of the parameter in dimensiondim
; seeParam.stack
.
- Param.stack¶
Parameter::t Param::stack(shared_ptr<ndarray<Parameter::t,2>> p) Parameter::t Param::stack(int dim, shared_ptr<ndarray<Parameter::t,1>> p) Parameter::t Param::stack(int dim, Parameter::t p1, Parameter::t p2) Parameter::t Param::stack(int dim, Parameter::t p1, Parameter::t p2, Parameter::t p3)
Stack a list of parameters along an arbitrary dimension. All parameters must have the same shape, except for dimension
dim
.For example, suppose \(P,Q\) are two \(n\times m\) parameters. Then stacking them in the first dimension produces a parameter of shape
(2n,m)
:\[\begin{split}\left[\begin{array}{c}P\\ Q\end{array}\right],\end{split}\]stacking them in the second dimension produces a parameter of shape
(n,2m)
:\[\left[\begin{array}{cc}P & Q\end{array}\right],\]and stacking them in the third dimension produces a three-dimensional parameter of shape
(n,m,2)
.The version which takes a two-dimensional array of parameters constructs a block matrix parameter with the given parameters as blocks. The dimensions of the blocks must be suitably compatible.
- Param.vstack¶
Parameter::t Param::vstack(shared_ptr<ndarray<Parameter::t,1>> p) Parameter::t Param::vstack(Parameter::t p1, Parameter::t p2) Parameter::t Param::vstack(Parameter::t p1, Parameter::t p2, Parameter::t p3)
Stack a list of parameters vertically (i.e. along the first dimension). The parameters must have the same shape, except for the first dimension.
For example, if \(p^1,p^2,p^3\) are three parameters of shape
(1,n)
then their vertical stack is the two-dimensional parameter\[\begin{split}\left[ \begin{array}{c}- p^1 - \\ - p^2 - \\ - p^3 - \end{array}\right]\end{split}\]of shape
(3,n)
.