[R] Fwd: Quadratic programming, for loop
Berwin A Turlach
berw|n@tur|@ch @end|ng |rom gm@||@com
Tue Jun 26 14:01:36 CEST 2018
On Tue, 26 Jun 2018 11:16:55 +0300
Maija Sirkjärvi <maija.sirkjarvi using gmail.com> wrote:
> It seems that my Amat and dvec are incompatible. Amat is a matrix of
> zeros size: *2*J-3,J* and dvec is a vector of length *J*. There
> should be no problem, but apparently there is. [...]
solve.QP solves the quadratic program:
min(-d^T b + 1/2 b^T D b)
where A^T b >= b_0.
Note the transpose. :)
If dvec is of length *J*, then b will be of length J too, and Amat
should be Jx(2J-3) so that its transpose is (2j-3)xJ, making it
compatible for matrix multiplication with b.
This email has been checked for viruses by Avast antivirus software.
More information about the R-help