[BACK]Return to standard_floating_two_norms.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_floating_two_norms.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.

with Standard_Mathematical_Functions;    use Standard_Mathematical_Functions;

package body Standard_Floating_Two_Norms is

  function Norm2 ( v : Vector ) return double_float is

    res : double_float := 0.0;

  begin
    for i in v'range loop
      res := res + v(i)*v(i);
    end loop;
    res := SQRT(res);
    return res;
  end Norm2;

  procedure Normalize ( v : in out Vector ) is

    nrm : constant double_float := Norm2(v);

  begin
    for i in v'range loop
      v(i) := v(i)/nrm;
    end loop;
  end Normalize;

  procedure Normalize( v : in out VecVec ) is
  begin
    for i in v'range loop
      Normalize(v(i).all);
    end loop;
  end Normalize;

end Standard_Floating_Two_Norms;