Active_constraints::status() const
{
String s("Active|Inactive [");
- for (int i=0; i< active.sz(); i++) {
+ for (int i=0; i< active.size(); i++) {
s += String(active[i]) + " ";
}
s+="| ";
- for (int i=0; i< inactive.sz(); i++) {
+ for (int i=0; i< inactive.size(); i++) {
s += String(inactive[i]) + " ";
}
s+="]";
}
void
-Active_constraints::OK() {
+Active_constraints::OK()
+{
+ #ifndef NDEBUG
H.OK();
A.OK();
- assert(active.sz() +inactive.sz() == opt->cons.sz());
+ assert(active.size() +inactive.size() == opt->cons.size());
assert(H.dim() == opt->dim());
- assert(active.sz() == A.rows());
- svec<int> allcons;
+ assert(active.size() == A.rows());
+ Array<int> allcons;
- for (int i=0; i < opt->cons.sz(); i++)
+ for (int i=0; i < opt->cons.size(); i++)
allcons.add(0);
- for (int i=0; i < active.sz(); i++) {
+ for (int i=0; i < active.size(); i++) {
int j = active[i];
allcons[j]++;
}
- for (int i=0; i < inactive.sz(); i++) {
+ for (int i=0; i < inactive.size(); i++) {
int j = inactive[i];
allcons[j]++;
}
- for (int i=0; i < allcons.sz(); i++)
+ for (int i=0; i < allcons.size(); i++)
assert(allcons[i] == 1);
+#endif
}
Vector
int cidx=inactive[k];
active.add(cidx);
- inactive.swap(k,inactive.sz()-1);
+ inactive.swap(k,inactive.size()-1);
inactive.pop();
Vector a( opt->cons[cidx] );
void
Active_constraints::drop(int k)
{
- int q=active.sz()-1;
+ int q=active.size()-1;
// drop indices
inactive.add(active[k]);
H(op->dim()),
opt(op)
{
- for (int i=0; i < op->cons.sz(); i++)
+ for (int i=0; i < op->cons.size(); i++)
inactive.add(i);
Choleski_decomposition chol(op->quad);
H=chol.inverse();