1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- ADA.NUMERICS.GENERIC_REAL_ARRAYS --
9 -- Copyright (C) 2006, Free Software Foundation, Inc. --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
24 -- Boston, MA 02110-1301, USA. --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
36 ------------------------------------------------------------------------------
39 type Real
is digits <>;
40 package Ada
.Numerics
.Generic_Real_Arrays
is
41 pragma Pure
(Generic_Real_Arrays
);
45 type Real_Vector
is array (Integer range <>) of Real
'Base;
46 type Real_Matrix
is array (Integer range <>, Integer range <>) of Real
'Base;
48 -- Subprograms for Real_Vector types
50 -- Real_Vector arithmetic operations
52 function "+" (Right
: Real_Vector
) return Real_Vector
;
53 function "-" (Right
: Real_Vector
) return Real_Vector
;
54 function "abs" (Right
: Real_Vector
) return Real_Vector
;
56 function "+" (Left
, Right
: Real_Vector
) return Real_Vector
;
57 function "-" (Left
, Right
: Real_Vector
) return Real_Vector
;
59 function "*" (Left
, Right
: Real_Vector
) return Real
'Base;
61 function "abs" (Right
: Real_Vector
) return Real
'Base;
63 -- Real_Vector scaling operations
65 function "*" (Left
: Real
'Base; Right
: Real_Vector
) return Real_Vector
;
66 function "*" (Left
: Real_Vector
; Right
: Real
'Base) return Real_Vector
;
67 function "/" (Left
: Real_Vector
; Right
: Real
'Base) return Real_Vector
;
69 -- Other Real_Vector operations
74 First
: Integer := 1) return Real_Vector
;
76 -- Subprograms for Real_Matrix types
78 -- Real_Matrix arithmetic operations
80 function "+" (Right
: Real_Matrix
) return Real_Matrix
;
81 function "-" (Right
: Real_Matrix
) return Real_Matrix
;
82 function "abs" (Right
: Real_Matrix
) return Real_Matrix
;
83 function Transpose
(X
: Real_Matrix
) return Real_Matrix
;
85 function "+" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
86 function "-" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
87 function "*" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
89 function "*" (Left
, Right
: Real_Vector
) return Real_Matrix
;
91 function "*" (Left
: Real_Vector
; Right
: Real_Matrix
) return Real_Vector
;
92 function "*" (Left
: Real_Matrix
; Right
: Real_Vector
) return Real_Vector
;
94 -- Real_Matrix scaling operations
96 function "*" (Left
: Real
'Base; Right
: Real_Matrix
) return Real_Matrix
;
97 function "*" (Left
: Real_Matrix
; Right
: Real
'Base) return Real_Matrix
;
98 function "/" (Left
: Real_Matrix
; Right
: Real
'Base) return Real_Matrix
;
100 -- Real_Matrix inversion and related operations
102 function Solve
(A
: Real_Matrix
; X
: Real_Vector
) return Real_Vector
;
103 function Solve
(A
, X
: Real_Matrix
) return Real_Matrix
;
104 function Inverse
(A
: Real_Matrix
) return Real_Matrix
;
105 function Determinant
(A
: Real_Matrix
) return Real
'Base;
107 -- Eigenvalues and vectors of a real symmetric matrix
109 function Eigenvalues
(A
: Real_Matrix
) return Real_Vector
;
111 procedure Eigensystem
113 Values
: out Real_Vector
;
114 Vectors
: out Real_Matrix
);
116 -- Other Real_Matrix operations
120 First_1
: Integer := 1;
121 First_2
: Integer := 1) return Real_Matrix
;
124 -- The following operations are either relatively simple compared to the
125 -- expense of returning unconstrained arrays, or are just function wrappers
126 -- calling procedures implementing the actual operation. By having the
127 -- front end always inline these, the expense of the unconstrained returns
130 pragma Inline_Always
("+");
131 pragma Inline_Always
("-");
132 pragma Inline_Always
("*");
133 pragma Inline_Always
("/");
134 pragma Inline_Always
("abs");
135 pragma Inline_Always
(Eigenvalues
);
136 pragma Inline_Always
(Inverse
);
137 pragma Inline_Always
(Solve
);
138 pragma Inline_Always
(Transpose
);
139 pragma Inline_Always
(Unit_Matrix
);
140 pragma Inline_Always
(Unit_Vector
);
141 end Ada
.Numerics
.Generic_Real_Arrays
;