[BACK]Return to standard_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 / standard_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 Standard_Complex_Norms_Equals is

  function Max_Norm ( v : Vector ) return double_float is

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

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

  function Sum_Norm ( v : Vector ) return double_float is

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

  begin
    for i in v'first+1..v'last loop
      res := res + AbsVal(v(i));
    end loop;
    return res;
  end Sum_Norm;

  function Max_Norm ( m : Matrix ) return double_float is

    res : double_float := 0.0;

  begin
    for i in m'range(1) loop
      for j in m'range(2) loop
        declare
          abstmp : double_float := AbsVal(m(i,j));
        begin
          if abstmp > res
           then res := abstmp;
          end if;
        end;
      end loop;
    end loop;
    return res;
  end Max_Norm;

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

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

  begin
    return res;
  end Equal;

  function Equal ( x,y : Vector; tol : double_float ) 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 Standard_Complex_Norms_Equals;