From 83a4f4c7aeb919b7850ae99d7856a2bdd3af1f4b Mon Sep 17 00:00:00 2001 From: fred Date: Thu, 19 Dec 1996 00:10:51 +0000 Subject: [PATCH] lilypond-0.0.18 --- src/linespace.cc | 2 +- src/qlp.cc | 75 ++++++++++++++++++++++++++---------------------- src/template3.cc | 1 + symbol.ini | 2 +- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/src/linespace.cc b/src/linespace.cc index fbab62449b..e403c2dcc0 100644 --- a/src/linespace.cc +++ b/src/linespace.cc @@ -130,6 +130,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const { quad.fill(0); lin.fill(0); + c = 0; for (int j=0; j < ideals.sz(); j++){ Idealspacing const*i=ideals[j]; int l = col_id(i->left); @@ -176,7 +177,6 @@ Spacing_problem::solve() const OK(); assert(check_feasible()); - /* optimalisatiefunctie */ Mixed_qp lp(cols.sz()); make_matrices(lp.quad,lp.lin, lp.const_term); diff --git a/src/qlp.cc b/src/qlp.cc index 3dd8e4227e..460bd86423 100644 --- a/src/qlp.cc +++ b/src/qlp.cc @@ -25,7 +25,8 @@ Ineq_constrained_qp::add_inequality_cons(Vector c, double r) Ineq_constrained_qp::Ineq_constrained_qp(int novars): quad(novars), - lin(novars) + lin(novars), + const_term (0.0) { } @@ -45,13 +46,6 @@ Ineq_constrained_qp::eval (Vector v) { return v * quad * v + lin * v + const_term; } -/* - eliminate appropriate variables, until we have a Ineq_constrained_qp - then solve that. - - PRE - cons should be ascending - */ Vector Mixed_qp::solve(Vector start) const { @@ -94,32 +88,59 @@ Ineq_constrained_qp::eliminate_var(int idx, Real value) - -Mixed_qp::Mixed_qp(int n) - : Ineq_constrained_qp(n) -{ -} - void -Mixed_qp::OK() const +Ineq_constrained_qp::assert_solution(Vector sol) const { -#ifndef NDEBUG - Ineq_constrained_qp::OK(); - assert(eq_consrhs.sz() == eq_cons.sz()); -#endif + svec binding; + for (int i=0; i < cons.sz(); i++) { + Real R=cons[i] * sol- consrhs[i]; + assert(R> -EPS); + if (R < EPS) + binding.add(i); + } + // KKT check... + // todo } + void Ineq_constrained_qp::print() const { #ifndef NPRINT mtor << "Quad " << quad; - mtor << "lin " << lin <<"\n"; + mtor << "lin " << lin <<"\n" + << "const " << const_term<<"\n"; for (int i=0; i < cons.sz(); i++) { mtor << "constraint["<= " << consrhs[i]; mtor << "\n"; } #endif } + +/****************/ + +/* + eliminate appropriate variables, until we have a Ineq_constrained_qp + then solve that. + + PRE + cons should be ascending + */ + + +Mixed_qp::Mixed_qp(int n) + : Ineq_constrained_qp(n) +{ +} + +void +Mixed_qp::OK() const +{ +#ifndef NDEBUG + Ineq_constrained_qp::OK(); + assert(eq_consrhs.sz() == eq_cons.sz()); +#endif +} + void Mixed_qp::print() const { @@ -131,17 +152,3 @@ Mixed_qp::print() const #endif } - -void -Ineq_constrained_qp::assert_solution(Vector sol) const -{ - svec binding; - for (int i=0; i < cons.sz(); i++) { - Real R=cons[i] * sol- consrhs[i]; - assert(R> -EPS); - if (R < EPS) - binding.add(i); - } - // KKT check... - // todo -} diff --git a/src/template3.cc b/src/template3.cc index be32eeceff..3e06cfdb23 100644 --- a/src/template3.cc +++ b/src/template3.cc @@ -16,3 +16,4 @@ IPL_instantiate(Command); IPL_instantiate(Input_command); IPL_instantiate(Commands_at); IPL_instantiate(Input_staff); +IPL_instantiate(Input_music); diff --git a/symbol.ini b/symbol.ini index 21226c079d..d0dd12453d 100644 --- a/symbol.ini +++ b/symbol.ini @@ -213,4 +213,4 @@ english_names = notenames { } default_table = symboltables { table_sixteen } -notenames { dutch_names } \ No newline at end of file +notenames { dutch_names } -- 2.39.5