| 93 | |
| 94 | TEST (quadratic_test){ |
| 95 | quadraticfn qf; |
| 96 | qf.Q = chmat(2); |
| 97 | qf.Q._Ch() = mat("1 -1 0; 0 0 0; 0 0 0"); |
| 98 | CHECK_CLOSE_EX(qf.eval(vec("1 2")), vec_1(1.0), 0.0000000000000001); |
| 99 | |
| 100 | LQG_universal lq; |
| 101 | lq.Losses = Array<quadraticfn>(1); |
| 102 | lq.Losses(0) = quadraticfn(); |
| 103 | lq.Losses(0).Q._Ch() = mat("1 -1 0; 0 0 0; 0 0 0"); |
| 104 | lq.Losses(0).rv = RV("{u up }"); |
| 105 | |
| 106 | lq.Models = Array<linfn>(1); |
| 107 | lq.Models(0) = linfn(mat("1"),vec("1")); |
| 108 | lq.Models(0).rv = RV("{x }"); |
| 109 | |
| 110 | lq.rv = RV("u",1); |
| 111 | |
| 112 | lq.redesign(); |
| 113 | CHECK_CLOSE_EX(lq.ctrlaction(vec("1,0")), vec("1.24, -5.6"), 0.0000001); |
| 114 | } |