Annotation of OpenXM_contrib/PHC/Ada/Schubert/plane_representations.adb, Revision 1.1.1.1
1.1 maekawa 1: with Standard_Floating_Numbers; use Standard_Floating_Numbers;
2: with Standard_Complex_Numbers; use Standard_Complex_Numbers;
3:
4: package body Plane_Representations is
5:
6: function Localize ( locmap : Standard_Natural_Matrices.Matrix;
7: plamat : Standard_Complex_Matrices.Matrix )
8: return Standard_Complex_Matrices.Matrix is
9:
10: res : Standard_Complex_Matrices.Matrix(plamat'range(1),plamat'range(2));
11: tol : constant double_float := 10.0**(-10);
12: done_j : boolean;
13:
14: begin
15: for j in locmap'range(2) loop
16: done_j := false;
17: for i in locmap'range(1) loop
18: if locmap(i,j) = 1
19: then if AbsVal(plamat(i,j)) > tol
20: then for k in plamat'range(1) loop
21: if AbsVal(plamat(k,j)) > tol
22: then res(k,j) := plamat(k,j)/plamat(i,j);
23: else res(k,j) := plamat(k,j);
24: end if;
25: end loop;
26: res(i,j) := Create(1.0);
27: end if;
28: done_j := true;
29: else res(i,j) := plamat(i,j);
30: end if;
31: exit when done_j;
32: end loop;
33: end loop;
34: return res;
35: end Localize;
36:
37: function Vector_Rep ( plamat : Standard_Complex_Matrices.Matrix )
38: return Standard_Complex_Vectors.Vector is
39:
40: dim : constant natural := plamat'length(1)*plamat'length(2);
41: res : Standard_Complex_Vectors.Vector(1..dim);
42: cnt : natural := 0;
43:
44: begin
45: for i in plamat'range(1) loop
46: for j in plamat'range(2) loop
47: cnt := cnt + 1;
48: res(cnt) := plamat(i,j);
49: end loop;
50: end loop;
51: return res;
52: end Vector_Rep;
53:
54: function Vector_Rep ( locmap : Standard_Natural_Matrices.Matrix;
55: plamat : Standard_Complex_Matrices.Matrix )
56: return Standard_Complex_Vectors.Vector is
57:
58: dim : constant natural := plamat'length(1)*plamat'length(2);
59: res : Standard_Complex_Vectors.Vector(1..dim);
60: cnt : natural := 0;
61:
62: begin
63: for i in plamat'range(1) loop
64: for j in plamat'range(2) loop
65: if locmap(i,j) = 2
66: then cnt := cnt + 1;
67: res(cnt) := plamat(i,j);
68: end if;
69: end loop;
70: end loop;
71: return res(1..cnt);
72: end Vector_Rep;
73:
74: function Matrix_Rep ( locmap : Standard_Natural_Matrices.Matrix;
75: plavec : Standard_Complex_Vectors.Vector )
76: return Standard_Complex_Matrices.Matrix is
77:
78: res : Standard_Complex_Matrices.Matrix(locmap'range(1),locmap'range(2));
79: cnt : natural := 0;
80:
81: begin
82: for i in locmap'range(1) loop
83: for j in locmap'range(2) loop
84: if locmap(i,j) = 0
85: then res(i,j) := Create(0.0);
86: elsif locmap(i,j) = 1
87: then res(i,j) := Create(1.0);
88: else cnt := cnt + 1;
89: res(i,j) := plavec(cnt);
90: end if;
91: end loop;
92: end loop;
93: return res;
94: end Matrix_Rep;
95:
96: end Plane_Representations;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>