#include "full-storage.hh"
/**
- Store a single-band matrix;
+ Store a matrix with a single-band.
- INVARIANT
+ @invariant
Diagonal_storage(i,j) == band_(i, j-i + band_size_i())
virtual void mult_next(int &i, int &j) const ;
virtual bool trans_ok(int i, int j) const;
virtual void trans_next(int &i, int &j) const;
- VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage);
+ DECLARE_VIRTUAL_COPY_CONS(Diagonal_storage, Matrix_storage);
DECLARE_MY_RUNTIME_TYPEINFO;
virtual bool try_right_multiply(Matrix_storage * dest, Matrix_storage const *)const;
};
#ifndef MOMENT_HH
#define MOMENT_HH
+#include <limits.h>
#include "rational.hh"
+
+/**
+ A really big time-moment.
+
+ Windhoze-suck-suck-suck-suck-suck-thank-you-cygnus
+
+ I get tired of all these incompatibilities. Let's just assume that
+ INT_MAX is really, really, really big.
+
+ Can't we name this Saint_jut_mom (Sintjuttemis ?) */
+
+const infinity_mom = Rational(INT_MAX);
+
class String;
typedef Rational Moment;
-void printm(Moment const&);
+
#endif //
#include "lily-proto.hh"
#include "colhpos.hh"
+
+/**
+ Statistics for the number of columns calced.
+ */
+struct Col_stats
+{
+ int count_i_;
+ int cols_i_;
+
+ Col_stats();
+ void add(Line_of_cols const&l);
+ String str()const;
+};
+
/** Class representation of an algorithm which decides where to put
the column, and where to break lines.
- TODO: a decent algorithm, based on dynamic programming or something
- a like. A "parindent", caching of breakpoints
+ TODO: A "parindent", caching of breakpoints
*/
class Break_algorithm {
- Line_spacer* generate_spacing_problem(Line_of_cols)const;
protected:
+
PScore *pscore_l_;
Real linelength;
/// search all pcols which are breakable.
Line_of_cols find_breaks() const;
- /// helper: solve for the columns in #curline#.
- Col_hpositions solve_line(Line_of_cols) const;
+ Line_of_cols all_cols() const;
+ Array<int> find_break_indices()const;
+
+
+ /// helper: solve for the columns in #curline#.
+ void solve_line(Col_hpositions*) const;
+
+ /// helper: approximate the energyv
+ void approximate_solve_line(Col_hpositions*) const;
/// does curline fit on the paper?
bool feasible(Line_of_cols)const;
- /** generate a solution with no regard to idealspacings or
- constraints. should always work */
- Col_hpositions stupid_solution(Line_of_cols) const;
+ Line_spacer* generate_spacing_problem(Line_of_cols)const;
+
virtual Array<Col_hpositions> do_solve()const=0;
+ void print_stats()const;
+
+ virtual void do_set_pscore();
public:
+ Col_stats approx_stats_;
+ Col_stats exact_stats_;
+
Line_spacer* (*get_line_spacer)();
- Break_algorithm(PScore&);
+ Break_algorithm();
+ void set_pscore(PScore*);
/// check if the spacing/breaking problem is well-stated
void problem_OK()const;
--- /dev/null
+/*
+ gourlay-breaking.hh -- declare Gourlay_breaking
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef GOURLAY_BREAKING_HH
+#define GOURLAY_BREAKING_HH
+
+#include "break.hh"
+
+/**
+ A dynamic programming solution to breaking scores into lines
+ */
+struct Gourlay_breaking : public Break_algorithm
+{
+ Real energy_bound_f_ ;
+
+ /// maximum number of measures in a line
+ int max_measures_i_;
+ void do_set_pscore();
+ Array<Col_hpositions> do_solve()const;
+ Gourlay_breaking();
+};
+#endif // GOURLAY_BREAKING_HH
virtual MInterval time_int()const;
};
+/**
+ The request is a collection of Requests. A note that you enter in mudela is
+ one Request_chord, one syllable of lyrics is one Request_chord
+ */
class Request_chord : public Chord {
public:
DECLARE_MY_RUNTIME_TYPEINFO;
#include "score-elem-info.hh"
#include "staff-info.hh"
+/**
+ Convert a music definition into a audio representation.
+ A baseclass
+ */
class Performer {
bool init_b_;
public:
#include "lily-proto.hh"
#include "varray.hh"
-/// data container.
+/**
+ Data container for broadcasts
+ */
struct Score_elem_info {
Score_elem * elem_l_;
Request*req_l_;
#include "line-spacer.hh"
#include "plist.hh"
#include "col-info.hh"
+#include "colhpos.hh"
-/** the problem, given by the columns (which include constraints) and
- intercolumn spacing. The problem is:
-
+/**
+ Determine positions of columns connected by springs and held apart by rods
+
+
Generate a spacing which
\begin{itemize}
\item
\item
Looks good, ie tries to conform to an ideal spacing as much as possible.
\end{itemize}
+
This is converted by regarding idealspacing as "springs" attached
to columns. The equilibrium of one spring is the ideal
distance. The columns have a size, this imposes "hard" constraints
The quality is given by the total potential energy in the
springs. The lower the energy, the better the configuration.
- TODO: make item widths work per pstaff.
+ TODO: make item widths work per Staff.
*/
void add_ideal(Idealspacing const *i);
Vector try_initial_solution() const;
void calc_idealspacing();
+ void set_fixed_cols(Mixed_qp&)const;
Score_column* scol_l(int);
void connect(int i,int j, Real,Real);
+ Line_of_cols error_pcol_l_arr()const;
public:
static Line_spacer *constructor();
- Array<PCol*> error_pcol_l_arr() const;
- virtual Array<Real> solve() const;
- virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0);
+ virtual void solve(Col_hpositions*) const;
+ virtual void lower_bound_solution(Col_hpositions*) const;
+ virtual void add_column(PCol *, bool fixed=false, Real fixpos=0.0);
virtual Vector default_solution() const;
- virtual bool check_constraints(Vector v) const;
- virtual void OK() const;
- virtual void print() const;
- virtual void prepare();
+ virtual bool check_constraints(Vector v) const;
+ virtual void OK() const;
+ virtual void print() const;
+ virtual void prepare();
virtual ~Spring_spacer(){}
};