1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- ADA.NUMERICS.GENERIC_REAL_ARRAYS --
9 -- Copyright (C) 2009, 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 3, 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. --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
37 type Real
is digits <>;
38 package Ada
.Numerics
.Generic_Real_Arrays
is
39 pragma Pure
(Generic_Real_Arrays
);
43 type Real_Vector
is array (Integer range <>) of Real
'Base;
44 type Real_Matrix
is array (Integer range <>, Integer range <>) of Real
'Base;
46 -- Subprograms for Real_Vector types
48 -- Real_Vector arithmetic operations
50 function "+" (Right
: Real_Vector
) return Real_Vector
;
51 function "-" (Right
: Real_Vector
) return Real_Vector
;
52 function "abs" (Right
: Real_Vector
) return Real_Vector
;
54 function "+" (Left
, Right
: Real_Vector
) return Real_Vector
;
55 function "-" (Left
, Right
: Real_Vector
) return Real_Vector
;
57 function "*" (Left
, Right
: Real_Vector
) return Real
'Base;
59 function "abs" (Right
: Real_Vector
) return Real
'Base;
61 -- Real_Vector scaling operations
63 function "*" (Left
: Real
'Base; Right
: Real_Vector
) return Real_Vector
;
64 function "*" (Left
: Real_Vector
; Right
: Real
'Base) return Real_Vector
;
65 function "/" (Left
: Real_Vector
; Right
: Real
'Base) return Real_Vector
;
67 -- Other Real_Vector operations
72 First
: Integer := 1) return Real_Vector
;
74 -- Subprograms for Real_Matrix types
76 -- Real_Matrix arithmetic operations
78 function "+" (Right
: Real_Matrix
) return Real_Matrix
;
79 function "-" (Right
: Real_Matrix
) return Real_Matrix
;
80 function "abs" (Right
: Real_Matrix
) return Real_Matrix
;
81 function Transpose
(X
: Real_Matrix
) return Real_Matrix
;
83 function "+" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
84 function "-" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
85 function "*" (Left
, Right
: Real_Matrix
) return Real_Matrix
;
87 function "*" (Left
, Right
: Real_Vector
) return Real_Matrix
;
89 function "*" (Left
: Real_Vector
; Right
: Real_Matrix
) return Real_Vector
;
90 function "*" (Left
: Real_Matrix
; Right
: Real_Vector
) return Real_Vector
;
92 -- Real_Matrix scaling operations
94 function "*" (Left
: Real
'Base; Right
: Real_Matrix
) return Real_Matrix
;
95 function "*" (Left
: Real_Matrix
; Right
: Real
'Base) return Real_Matrix
;
96 function "/" (Left
: Real_Matrix
; Right
: Real
'Base) return Real_Matrix
;
98 -- Real_Matrix inversion and related operations
100 function Solve
(A
: Real_Matrix
; X
: Real_Vector
) return Real_Vector
;
101 function Solve
(A
, X
: Real_Matrix
) return Real_Matrix
;
102 function Inverse
(A
: Real_Matrix
) return Real_Matrix
;
103 function Determinant
(A
: Real_Matrix
) return Real
'Base;
105 -- Eigenvalues and vectors of a real symmetric matrix
107 function Eigenvalues
(A
: Real_Matrix
) return Real_Vector
;
109 procedure Eigensystem
111 Values
: out Real_Vector
;
112 Vectors
: out Real_Matrix
);
114 -- Other Real_Matrix operations
118 First_1
: Integer := 1;
119 First_2
: Integer := 1) return Real_Matrix
;
122 -- The following operations are either relatively simple compared to the
123 -- expense of returning unconstrained arrays, or are just function wrappers
124 -- calling procedures implementing the actual operation. By having the
125 -- front end always inline these, the expense of the unconstrained returns
128 pragma Inline_Always
("+");
129 pragma Inline_Always
("-");
130 pragma Inline_Always
("*");
131 pragma Inline_Always
("/");
132 pragma Inline_Always
("abs");
133 pragma Inline_Always
(Eigenvalues
);
134 pragma Inline_Always
(Inverse
);
135 pragma Inline_Always
(Solve
);
136 pragma Inline_Always
(Transpose
);
137 pragma Inline_Always
(Unit_Matrix
);
138 pragma Inline_Always
(Unit_Vector
);
139 end Ada
.Numerics
.Generic_Real_Arrays
;