From a147f3ce46fae93ae39399d2e791d65392a1542a Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:04:44 +0000 Subject: [PATCH] lilypond-0.1.41 --- flower/VERSION | 2 +- flower/choleski.cc | 106 +++++++++++++++++++-------------------- flower/directed-graph.cc | 36 ++++++------- flower/string.cc | 10 ++-- 4 files changed, 77 insertions(+), 77 deletions(-) diff --git a/flower/VERSION b/flower/VERSION index 636df4b25f..fb9bbfb6d6 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 33 +PATCH_LEVEL = 35 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/choleski.cc b/flower/choleski.cc index 187fb26901..989a042603 100644 --- a/flower/choleski.cc +++ b/flower/choleski.cc @@ -24,23 +24,23 @@ Choleski_decomposition::full_matrix_solve (Vector &out, Vector const &rhs) const // forward substitution for (int i=0; i < n; i++) { - Real sum (0.0); - for (int j=0; j < i; j++) - sum += y (j) * L(i,j); - y (i) = (rhs (i) - sum)/L(i,i); + Real sum (0.0); + for (int j=0; j < i; j++) + sum += y (j) * L(i,j); + y (i) = (rhs (i) - sum)/L(i,i); } for (int i=0; i < n; i++) - y (i) /= D(i); + y (i) /= D(i); // backward subst Vector &x (out); // using input as return val. for (int i=n-1; i >= 0; i--) { - Real sum (0.0); - for (int j=i+1; j < n; j++) - sum += L(j,i)*x (j); - x (i) = (y (i) - sum)/L(i,i); + Real sum (0.0); + for (int j=i+1; j < n; j++) + sum += L(j,i)*x (j); + x (i) = (y (i) - sum)/L(i,i); } } @@ -51,7 +51,7 @@ Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs) const int b = L.band_i(); assert (n == L.dim()); - out.set_dim (n); + out.set_dim (n); Vector y; y.set_dim (n); @@ -59,22 +59,22 @@ Choleski_decomposition::band_matrix_solve (Vector &out, Vector const &rhs) const // forward substitution for (int i=0; i < n; i++) { - Real sum (0.0); - for (int j= 0 >? i - b; j < i; j++) - sum += y (j) * L(i,j); - y (i) = (rhs (i) - sum)/L(i,i); + Real sum (0.0); + for (int j= 0 >? i - b; j < i; j++) + sum += y (j) * L(i,j); + y (i) = (rhs (i) - sum)/L(i,i); } for (int i=0; i < n; i++) - y (i) /= D(i); + y (i) /= D(i); // backward subst Vector &x (out); // using input as return val. for (int i=n-1; i >= 0; i--) { - Real sum (0.0); - for (int j=i+1; j <= i + b&&j < n ; j++) - sum += L(j,i)*x (j); - x (i) = (y (i) - sum)/L(i,i); + Real sum (0.0); + for (int j=i+1; j <= i + b&&j < n ; j++) + sum += L(j,i)*x (j); + x (i) = (y (i) - sum)/L(i,i); } } @@ -83,10 +83,10 @@ Choleski_decomposition::solve (Vector &x, Vector const &rhs) const { if (L.band_b()) { - band_matrix_solve (x,rhs); + band_matrix_solve (x,rhs); } else - full_matrix_solve (x,rhs); + full_matrix_solve (x,rhs); } Vector @@ -101,23 +101,23 @@ void Choleski_decomposition::full_matrix_decompose (Matrix const & P) { - int n = P.dim(); + int n = P.dim(); L.unit(); for (int k= 0; k < n; k++) { - for (int j = 0; j < k; j++) - { - Real sum (0.0); - for (int l=0; l < j; l++) - sum += L(k,l)*L(j,l)*D(l); - L(k,j) = (P(k,j) - sum)/D(j); - } - Real sum=0.0; + for (int j = 0; j < k; j++) + { + Real sum (0.0); + for (int l=0; l < j; l++) + sum += L(k,l)*L(j,l)*D(l); + L(k,j) = (P(k,j) - sum)/D(j); + } + Real sum=0.0; - for (int l=0; l < k; l++) - sum += sqr (L(k,l))*D(l); - Real d = P(k,k) - sum; - D(k) = d; + for (int l=0; l < k; l++) + sum += sqr (L(k,l))*D(l); + Real d = P(k,k) - sum; + D(k) = d; } } @@ -131,19 +131,19 @@ Choleski_decomposition::band_matrix_decompose (Matrix const &P) for (int i= 0; i < n; i++) { - for (int j = 0 >? i - b; j < i; j++) - { - Real sum (0.0); - for (int l=0 >? i - b; l < j; l++) - sum += L(i,l)*L(j,l)*D(l); - L(i,j) = (P(i,j) - sum)/D(j); - } - Real sum=0.0; + for (int j = 0 >? i - b; j < i; j++) + { + Real sum (0.0); + for (int l=0 >? i - b; l < j; l++) + sum += L(i,l)*L(j,l)*D(l); + L(i,j) = (P(i,j) - sum)/D(j); + } + Real sum=0.0; - for (int l=0 >? i - b; l < i; l++) - sum += sqr (L(i,l))*D(l); - Real d = P(i,i) - sum; - D(i) = d; + for (int l=0 >? i - b; l < i; l++) + sum += sqr (L(i,l))*D(l); + Real d = P(i,i) - sum; + D(i) = d; } L.try_set_band(); assert (L.band_i() == P.band_i ()); @@ -157,15 +157,15 @@ Choleski_decomposition::band_matrix_decompose (Matrix const &P) */ Choleski_decomposition::Choleski_decomposition (Matrix const & P) - : L(P.dim()), D(P.dim ()) + : L(P.dim()), D(P.dim ()) { #ifdef PARANOID assert ((P-P.transposed()).norm ()/P.norm () < EPS); #endif if (P.band_b()) - band_matrix_decompose (P); + band_matrix_decompose (P); else - full_matrix_decompose (P); + full_matrix_decompose (P); #ifdef PARANOID @@ -190,10 +190,10 @@ Choleski_decomposition::inverse() const Vector inv (n); for (int i = 0; i < n; i++) { - e_i.set_unit (i); - solve (inv, e_i); - for (int j = 0 ; j - edge_in_l_arr_.find_l (this)); + assert (edge_out_l_arr_[i]-> + edge_in_l_arr_.find_l (this)); } for (int i=0; i < edge_in_l_arr_.size(); i++) - assert (edge_in_l_arr_[i]->contains_b (this)); + assert (edge_in_l_arr_[i]->contains_b (this)); #endif } @@ -87,10 +87,10 @@ Directed_graph_node::remove_edge_out (Directed_graph_node *d_l) PARANOID_OK(); for (int i=0; i < edge_out_l_arr_.size();) { - if (edge_out_l_arr_[i]== d_l) - remove_edge_out_idx (i); - else - i++; + if (edge_out_l_arr_[i]== d_l) + remove_edge_out_idx (i); + else + i++; } PARANOID_OK(); } @@ -112,21 +112,21 @@ void Directed_graph_node::unlink() { #ifdef PARANOID - PARANOID_OK(); + PARANOID_OK(); - Link_array t = edge_out_l_arr_; - t.concat (edge_in_l_arr_); + Link_array t = edge_out_l_arr_; + t.concat (edge_in_l_arr_); #endif - while (edge_out_l_arr_.size()) - remove_edge_out_idx (0); + while (edge_out_l_arr_.size()) + remove_edge_out_idx (0); - while (edge_in_l_arr_.size()) - remove_edge_in (edge_in_l_arr_[0]); + while (edge_in_l_arr_.size()) + remove_edge_in (edge_in_l_arr_[0]); #ifdef PARANOID - for (int i =0; i < t.size(); i++) - t[i]->OK(); + for (int i =0; i < t.size(); i++) + t[i]->OK(); #endif } @@ -141,7 +141,7 @@ Directed_graph_node::add (Directed_graph_node* dep_l) { PARANOID_OK(); if (!dep_l) - return ; + return ; dep_l->edge_in_l_arr_.push (this); edge_out_l_arr_.push (dep_l); PARANOID_OK(); diff --git a/flower/string.cc b/flower/string.cc index 2076a2a19b..504ba9811b 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -170,7 +170,7 @@ String::index_last_i (char const c) const return -1; char const* me = strh_.ch_C(); - char const* p = memrchr (me, length_i(), c); + char const* p = memrchr ((Byte*)me, length_i(), c); if (p) return p - me; return -1; @@ -216,7 +216,7 @@ String::index_i (char c) const } /** - find the substring. + find a substring. @return 1 index of leftmost occurrence of #searchfor# @@ -225,8 +225,9 @@ int String::index_i (String searchfor) const { char const* me = strh_.ch_C(); - char const* p = (char const *) memmem ( - me, length_i(), searchfor.ch_C(), searchfor.length_i ()); + + char const* p = (char const *) + memmem (me, length_i(), searchfor.ch_C(), searchfor.length_i ()); if (p) return p - me; @@ -369,4 +370,3 @@ String::value_f() const return String_convert::dec2_f (*this); } - -- 2.39.5