lilypond-0.1.41
authorfred <fred>
Sun, 24 Mar 2002 20:04:44 +0000 (20:04 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:04:44 +0000 (20:04 +0000)
flower/VERSION
flower/choleski.cc
flower/directed-graph.cc
flower/string.cc

index 636df4b25f7e370a0076cc4fdd6938eb4e328c13..fb9bbfb6d6b439b6cc22c3b0bc75063611da2b81 100644 (file)
@@ -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"
 #
index 187fb26901c61ee0865144b5c3d94704c37cf0e5..989a042603ec9f7baf65951435e2b5e888cd5e50 100644 (file)
@@ -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<n; j++)
-           invm (i,j) = inv (j);
+      e_i.set_unit (i);
+      solve (inv, e_i);
+      for (int j = 0 ; j<n; j++)
+       invm (i,j) = inv (j);
     }
   
 #ifdef PARANOID
index b13203e4fa19ca307eb39f7e9c2afd6bb9c3f592..50dafedf13e92cb801bb1aa3a519f9942700e41f 100644 (file)
@@ -38,7 +38,7 @@ void
 Directed_graph_node::copy_edges_out (Directed_graph_node const &s)
 {
   for (int i=0; i < s.edge_out_l_arr_.size(); i++)
-       add (s.edge_out_l_arr_[i]);
+    add (s.edge_out_l_arr_[i]);
 }
 
 void
@@ -47,11 +47,11 @@ Directed_graph_node::OK() const
 #ifndef NDEBUG
   for (int i=0; i < edge_out_l_arr_.size(); i++) 
     {
-       assert (edge_out_l_arr_[i]->
-              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<Directed_graph_node> t = edge_out_l_arr_;
-       t.concat (edge_in_l_arr_);
+  Link_array<Directed_graph_node> 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();
index 2076a2a19b52886b71ccb95d57bada8b4dadf8aa..504ba9811be61876f4e24226512138f2c83ad28a 100644 (file)
@@ -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);
 }
 
-