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

File: [local] / OpenXM_contrib / PHC / Ada / Root_Counts / Product / total_degree_start_systems.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:29 2000 UTC (23 years, 7 months ago) by maekawa
Branch: PHC, MAIN
CVS Tags: v2, maekawa-ipv6, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, HEAD
Changes since 1.1: +0 -0 lines

Import the second public release of PHCpack.

OKed by Jan Verschelde.

with text_io;                           use text_io;
with Standard_Random_Numbers;           use Standard_Random_Numbers;
with Standard_Complex_Numbers;          use Standard_Complex_Numbers;
with Standard_Complex_Numbers_Polar;    use Standard_Complex_Numbers_Polar;
with Standard_Natural_Vectors;
with Standard_Complex_Polynomials;      use Standard_Complex_Polynomials;

package body Total_Degree_Start_Systems is

  procedure Total_Degree_Info is

  -- DESCRIPTION :
  --   Displays information about the total degree on screen.

    i : array(1..5) of string(1..65);

  begin
    i(1):="  The  total  degree  is  the  product  of  the  degrees  of  the";
    i(2):="polynomials in the system.  The i-th equation of the start system";
    i(3):="is a univariate polynomial in the i-th unknown of the same degree";
    i(4):="as  the i-th polynomial in the system that has to be solved.  The";
    i(5):="total degree equals the number of solutions of the start system. ";
    for k in i'range loop
      put_line(i(k));
    end loop;
  end Total_Degree_Info;

  procedure Start_Solutions
               ( level : in natural;
                 q : in Poly_Sys; c : in Vector; s : in out Solution;
                 qsols,qsols_last : in out Solution_List ) is

  -- DESCRIPTION :
  --   All solutions to the polynomial system q are computed.
  --   The parameter level indicates the current component in the recursive
  --   application of the rule of de Moivre.

    d : natural;

  begin
    if level <= s.n
     then d := Degree(q(level));
          for j in 1..d loop
            s.v(level) := Root(c(level),d,j);
            Start_Solutions(level+1,q,c,s,qsols,qsols_last);
          end loop;
     else s.t := Create(0.0);
          s.m := 1;
          s.err := 0.0; s.rco := 1.0; s.res := 0.0;
          Append(qsols,qsols_last,s);
    end if;
  end Start_Solutions;

  procedure Start_System 
               ( p : in Poly_Sys; q : in out Poly_Sys; c : in Vector;
                 qsols : in out Solution_List ) is
  
    t : Term;
    n : natural := p'length;
    s : Solution(n);
    last : Solution_List := qsols;

  begin
    for i in p'range loop
      t.dg := new Standard_Natural_Vectors.Vector'(1..n => 0);
      t.dg(i) := Degree(p(i));
      t.cf := Create(1.0);
      q(i) := Create(t);
      Clear(t);
      t.dg := new Standard_Natural_Vectors.Vector'(1..n => 0);
      t.cf := -c(i);
      Add(q(i),t);
      Clear(t);
    end loop;
    Start_Solutions(1,q,c,s,qsols,last);
  end Start_System;
 
  procedure Start_System
               ( p : in Poly_Sys; q : in out Poly_Sys;
                 qsols : in out Solution_List ) is

    n : natural := p'length;
    c : Vector(1..n);

  begin
    for i in c'range loop
      c(i) := Random1;
    end loop;
    Start_System(p,q,c,qsols);
  end Start_System;

end Total_Degree_Start_Systems;