[BACK]Return to multprec_complex_norms_equals.adb CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices

File: [local] / OpenXM_contrib / PHC / Ada / Math_Lib / Matrices / multprec_complex_norms_equals.adb (download)

Revision 1.1.1.1 (vendor branch), Sun Oct 29 17:45:24 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.

package body Multprec_Complex_Norms_Equals is

  function Max_Norm ( v : Vector ) return Floating_Number is

    res : Floating_Number := AbsVal(v(v'first));

  begin
    for i in v'first+1..v'last loop
      declare
        abstmp : Floating_Number := AbsVal(v(i));
      begin
        if abstmp > res
         then Copy(abstmp,res);
        end if;
        Clear(abstmp);
      end;
    end loop;
    return res;
  end Max_Norm;

  function Sum_Norm ( v : Vector ) return Floating_Number is

    res : Floating_Number := AbsVal(v(v'first));

  begin
    for i in v'first+1..v'last loop
      declare
        abstmp : Floating_Number := AbsVal(v(i));
      begin
        Add(res,abstmp);
        Clear(abstmp);
      end;
    end loop;
    return res;
  end Sum_Norm;

  function Equal ( x,y : Complex_Number;
                   tol : Floating_Number ) return boolean is

    dif : Complex_Number := x-y;
    absdif : Floating_Number := AbsVal(dif);
    res : boolean := (absdif < tol);

  begin
    Clear(dif);
    Clear(absdif);
    return res;
  end Equal;

  function Equal ( x,y : Vector; tol : Floating_Number ) return boolean is
  begin
    for i in x'range loop
      if not Equal(x(i),y(i),tol)
       then return false;
      end if;
    end loop;
    return true;
  end Equal;

end Multprec_Complex_Norms_Equals;