[BACK]Return to total_degree_start_systems.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product

Annotation of OpenXM_contrib/PHC/Ada/Root_Counts/Product/total_degree_start_systems.adb, Revision 1.1.1.1

1.1       maekawa     1: with text_io;                           use text_io;
                      2: with Standard_Random_Numbers;           use Standard_Random_Numbers;
                      3: with Standard_Complex_Numbers;          use Standard_Complex_Numbers;
                      4: with Standard_Complex_Numbers_Polar;    use Standard_Complex_Numbers_Polar;
                      5: with Standard_Natural_Vectors;
                      6: with Standard_Complex_Polynomials;      use Standard_Complex_Polynomials;
                      7:
                      8: package body Total_Degree_Start_Systems is
                      9:
                     10:   procedure Total_Degree_Info is
                     11:
                     12:   -- DESCRIPTION :
                     13:   --   Displays information about the total degree on screen.
                     14:
                     15:     i : array(1..5) of string(1..65);
                     16:
                     17:   begin
                     18:     i(1):="  The  total  degree  is  the  product  of  the  degrees  of  the";
                     19:     i(2):="polynomials in the system.  The i-th equation of the start system";
                     20:     i(3):="is a univariate polynomial in the i-th unknown of the same degree";
                     21:     i(4):="as  the i-th polynomial in the system that has to be solved.  The";
                     22:     i(5):="total degree equals the number of solutions of the start system. ";
                     23:     for k in i'range loop
                     24:       put_line(i(k));
                     25:     end loop;
                     26:   end Total_Degree_Info;
                     27:
                     28:   procedure Start_Solutions
                     29:                ( level : in natural;
                     30:                  q : in Poly_Sys; c : in Vector; s : in out Solution;
                     31:                  qsols,qsols_last : in out Solution_List ) is
                     32:
                     33:   -- DESCRIPTION :
                     34:   --   All solutions to the polynomial system q are computed.
                     35:   --   The parameter level indicates the current component in the recursive
                     36:   --   application of the rule of de Moivre.
                     37:
                     38:     d : natural;
                     39:
                     40:   begin
                     41:     if level <= s.n
                     42:      then d := Degree(q(level));
                     43:           for j in 1..d loop
                     44:             s.v(level) := Root(c(level),d,j);
                     45:             Start_Solutions(level+1,q,c,s,qsols,qsols_last);
                     46:           end loop;
                     47:      else s.t := Create(0.0);
                     48:           s.m := 1;
                     49:           s.err := 0.0; s.rco := 1.0; s.res := 0.0;
                     50:           Append(qsols,qsols_last,s);
                     51:     end if;
                     52:   end Start_Solutions;
                     53:
                     54:   procedure Start_System
                     55:                ( p : in Poly_Sys; q : in out Poly_Sys; c : in Vector;
                     56:                  qsols : in out Solution_List ) is
                     57:
                     58:     t : Term;
                     59:     n : natural := p'length;
                     60:     s : Solution(n);
                     61:     last : Solution_List := qsols;
                     62:
                     63:   begin
                     64:     for i in p'range loop
                     65:       t.dg := new Standard_Natural_Vectors.Vector'(1..n => 0);
                     66:       t.dg(i) := Degree(p(i));
                     67:       t.cf := Create(1.0);
                     68:       q(i) := Create(t);
                     69:       Clear(t);
                     70:       t.dg := new Standard_Natural_Vectors.Vector'(1..n => 0);
                     71:       t.cf := -c(i);
                     72:       Add(q(i),t);
                     73:       Clear(t);
                     74:     end loop;
                     75:     Start_Solutions(1,q,c,s,qsols,last);
                     76:   end Start_System;
                     77:
                     78:   procedure Start_System
                     79:                ( p : in Poly_Sys; q : in out Poly_Sys;
                     80:                  qsols : in out Solution_List ) is
                     81:
                     82:     n : natural := p'length;
                     83:     c : Vector(1..n);
                     84:
                     85:   begin
                     86:     for i in c'range loop
                     87:       c(i) := Random1;
                     88:     end loop;
                     89:     Start_System(p,q,c,qsols);
                     90:   end Start_System;
                     91:
                     92: end Total_Degree_Start_Systems;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>