| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- ADA.NUMERICS.GENERIC_COMPLEX_ARRAYS -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- This specification is derived from the Ada Reference Manual for use with -- |
| 10 |
-- GNAT. In accordance with the copyright of that document, you can freely -- |
| 11 |
-- copy and modify this specification, provided that if you redistribute a -- |
| 12 |
-- modified version, any changes that you have made are clearly indicated. -- |
| 13 |
-- -- |
| 14 |
------------------------------------------------------------------------------ |
| 15 |
|
| 16 |
with Ada.Numerics.Generic_Real_Arrays, Ada.Numerics.Generic_Complex_Types; |
| 17 |
|
| 18 |
generic |
| 19 |
with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (<>); |
| 20 |
use Real_Arrays; |
| 21 |
with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real); |
| 22 |
use Complex_Types; |
| 23 |
package Ada.Numerics.Generic_Complex_Arrays is |
| 24 |
pragma Pure (Generic_Complex_Arrays); |
| 25 |
|
| 26 |
-- Types |
| 27 |
|
| 28 |
type Complex_Vector is array (Integer range <>) of Complex; |
| 29 |
type Complex_Matrix is |
| 30 |
array (Integer range <>, Integer range <>) of Complex; |
| 31 |
|
| 32 |
-- Subprograms for Complex_Vector types |
| 33 |
-- Complex_Vector selection, conversion and composition operations |
| 34 |
|
| 35 |
function Re (X : Complex_Vector) return Real_Vector; |
| 36 |
function Im (X : Complex_Vector) return Real_Vector; |
| 37 |
|
| 38 |
procedure Set_Re (X : in out Complex_Vector; Re : Real_Vector); |
| 39 |
procedure Set_Im (X : in out Complex_Vector; Im : Real_Vector); |
| 40 |
|
| 41 |
function Compose_From_Cartesian |
| 42 |
(Re : Real_Vector) return Complex_Vector; |
| 43 |
function Compose_From_Cartesian |
| 44 |
(Re, Im : Real_Vector) return Complex_Vector; |
| 45 |
|
| 46 |
function Modulus (X : Complex_Vector) return Real_Vector; |
| 47 |
function "abs" (Right : Complex_Vector) return Real_Vector renames Modulus; |
| 48 |
function Argument (X : Complex_Vector) return Real_Vector; |
| 49 |
|
| 50 |
function Argument |
| 51 |
(X : Complex_Vector; |
| 52 |
Cycle : Real'Base) return Real_Vector; |
| 53 |
|
| 54 |
function Compose_From_Polar |
| 55 |
(Modulus, Argument : Real_Vector) return Complex_Vector; |
| 56 |
|
| 57 |
function Compose_From_Polar |
| 58 |
(Modulus, Argument : Real_Vector; |
| 59 |
Cycle : Real'Base) return Complex_Vector; |
| 60 |
|
| 61 |
-- Complex_Vector arithmetic operations |
| 62 |
|
| 63 |
function "+" (Right : Complex_Vector) return Complex_Vector; |
| 64 |
function "-" (Right : Complex_Vector) return Complex_Vector; |
| 65 |
function Conjugate (X : Complex_Vector) return Complex_Vector; |
| 66 |
function "+" (Left, Right : Complex_Vector) return Complex_Vector; |
| 67 |
function "-" (Left, Right : Complex_Vector) return Complex_Vector; |
| 68 |
function "*" (Left, Right : Complex_Vector) return Complex; |
| 69 |
function "abs" (Right : Complex_Vector) return Real'Base; |
| 70 |
|
| 71 |
-- Mixed Real_Vector and Complex_Vector arithmetic operations |
| 72 |
|
| 73 |
function "+" |
| 74 |
(Left : Real_Vector; |
| 75 |
Right : Complex_Vector) return Complex_Vector; |
| 76 |
|
| 77 |
function "+" |
| 78 |
(Left : Complex_Vector; |
| 79 |
Right : Real_Vector) return Complex_Vector; |
| 80 |
|
| 81 |
function "-" |
| 82 |
(Left : Real_Vector; |
| 83 |
Right : Complex_Vector) return Complex_Vector; |
| 84 |
|
| 85 |
function "-" |
| 86 |
(Left : Complex_Vector; |
| 87 |
Right : Real_Vector) return Complex_Vector; |
| 88 |
|
| 89 |
function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex; |
| 90 |
function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex; |
| 91 |
|
| 92 |
-- Complex_Vector scaling operations |
| 93 |
|
| 94 |
function "*" |
| 95 |
(Left : Complex; |
| 96 |
Right : Complex_Vector) return Complex_Vector; |
| 97 |
|
| 98 |
function "*" |
| 99 |
(Left : Complex_Vector; |
| 100 |
Right : Complex) return Complex_Vector; |
| 101 |
|
| 102 |
function "/" |
| 103 |
(Left : Complex_Vector; |
| 104 |
Right : Complex) return Complex_Vector; |
| 105 |
|
| 106 |
function "*" |
| 107 |
(Left : Real'Base; |
| 108 |
Right : Complex_Vector) return Complex_Vector; |
| 109 |
|
| 110 |
function "*" |
| 111 |
(Left : Complex_Vector; |
| 112 |
Right : Real'Base) return Complex_Vector; |
| 113 |
|
| 114 |
function "/" |
| 115 |
(Left : Complex_Vector; |
| 116 |
Right : Real'Base) return Complex_Vector; |
| 117 |
|
| 118 |
-- Other Complex_Vector operations |
| 119 |
|
| 120 |
function Unit_Vector |
| 121 |
(Index : Integer; |
| 122 |
Order : Positive; |
| 123 |
First : Integer := 1) return Complex_Vector; |
| 124 |
|
| 125 |
-- Subprograms for Complex_Matrix types |
| 126 |
|
| 127 |
-- Complex_Matrix selection, conversion and composition operations |
| 128 |
|
| 129 |
function Re (X : Complex_Matrix) return Real_Matrix; |
| 130 |
function Im (X : Complex_Matrix) return Real_Matrix; |
| 131 |
|
| 132 |
procedure Set_Re (X : in out Complex_Matrix; Re : Real_Matrix); |
| 133 |
procedure Set_Im (X : in out Complex_Matrix; Im : Real_Matrix); |
| 134 |
|
| 135 |
function Compose_From_Cartesian (Re : Real_Matrix) return Complex_Matrix; |
| 136 |
|
| 137 |
function Compose_From_Cartesian |
| 138 |
(Re, Im : Real_Matrix) return Complex_Matrix; |
| 139 |
|
| 140 |
function Modulus (X : Complex_Matrix) return Real_Matrix; |
| 141 |
function "abs" (Right : Complex_Matrix) return Real_Matrix renames Modulus; |
| 142 |
|
| 143 |
function Argument (X : Complex_Matrix) return Real_Matrix; |
| 144 |
|
| 145 |
function Argument |
| 146 |
(X : Complex_Matrix; |
| 147 |
Cycle : Real'Base) return Real_Matrix; |
| 148 |
|
| 149 |
function Compose_From_Polar |
| 150 |
(Modulus, Argument : Real_Matrix) return Complex_Matrix; |
| 151 |
|
| 152 |
function Compose_From_Polar |
| 153 |
(Modulus : Real_Matrix; |
| 154 |
Argument : Real_Matrix; |
| 155 |
Cycle : Real'Base) return Complex_Matrix; |
| 156 |
|
| 157 |
-- Complex_Matrix arithmetic operations |
| 158 |
|
| 159 |
function "+" (Right : Complex_Matrix) return Complex_Matrix; |
| 160 |
function "-" (Right : Complex_Matrix) return Complex_Matrix; |
| 161 |
|
| 162 |
function Conjugate (X : Complex_Matrix) return Complex_Matrix; |
| 163 |
function Transpose (X : Complex_Matrix) return Complex_Matrix; |
| 164 |
|
| 165 |
function "+" (Left, Right : Complex_Matrix) return Complex_Matrix; |
| 166 |
function "-" (Left, Right : Complex_Matrix) return Complex_Matrix; |
| 167 |
function "*" (Left, Right : Complex_Matrix) return Complex_Matrix; |
| 168 |
function "*" (Left, Right : Complex_Vector) return Complex_Matrix; |
| 169 |
|
| 170 |
function "*" |
| 171 |
(Left : Complex_Vector; |
| 172 |
Right : Complex_Matrix) return Complex_Vector; |
| 173 |
|
| 174 |
function "*" |
| 175 |
(Left : Complex_Matrix; |
| 176 |
Right : Complex_Vector) return Complex_Vector; |
| 177 |
|
| 178 |
-- Mixed Real_Matrix and Complex_Matrix arithmetic operations |
| 179 |
|
| 180 |
function "+" |
| 181 |
(Left : Real_Matrix; |
| 182 |
Right : Complex_Matrix) return Complex_Matrix; |
| 183 |
|
| 184 |
function "+" |
| 185 |
(Left : Complex_Matrix; |
| 186 |
Right : Real_Matrix) return Complex_Matrix; |
| 187 |
|
| 188 |
function "-" |
| 189 |
(Left : Real_Matrix; |
| 190 |
Right : Complex_Matrix) return Complex_Matrix; |
| 191 |
|
| 192 |
function "-" |
| 193 |
(Left : Complex_Matrix; |
| 194 |
Right : Real_Matrix) return Complex_Matrix; |
| 195 |
|
| 196 |
function "*" |
| 197 |
(Left : Real_Matrix; |
| 198 |
Right : Complex_Matrix) return Complex_Matrix; |
| 199 |
|
| 200 |
function "*" |
| 201 |
(Left : Complex_Matrix; |
| 202 |
Right : Real_Matrix) return Complex_Matrix; |
| 203 |
|
| 204 |
function "*" |
| 205 |
(Left : Real_Vector; |
| 206 |
Right : Complex_Vector) return Complex_Matrix; |
| 207 |
|
| 208 |
function "*" |
| 209 |
(Left : Complex_Vector; |
| 210 |
Right : Real_Vector) return Complex_Matrix; |
| 211 |
|
| 212 |
function "*" |
| 213 |
(Left : Real_Vector; |
| 214 |
Right : Complex_Matrix) return Complex_Vector; |
| 215 |
|
| 216 |
function "*" |
| 217 |
(Left : Complex_Vector; |
| 218 |
Right : Real_Matrix) return Complex_Vector; |
| 219 |
|
| 220 |
function "*" |
| 221 |
(Left : Real_Matrix; |
| 222 |
Right : Complex_Vector) return Complex_Vector; |
| 223 |
|
| 224 |
function "*" |
| 225 |
(Left : Complex_Matrix; |
| 226 |
Right : Real_Vector) return Complex_Vector; |
| 227 |
|
| 228 |
-- Complex_Matrix scaling operations |
| 229 |
|
| 230 |
function "*" |
| 231 |
(Left : Complex; |
| 232 |
Right : Complex_Matrix) return Complex_Matrix; |
| 233 |
|
| 234 |
function "*" |
| 235 |
(Left : Complex_Matrix; |
| 236 |
Right : Complex) return Complex_Matrix; |
| 237 |
|
| 238 |
function "/" |
| 239 |
(Left : Complex_Matrix; |
| 240 |
Right : Complex) return Complex_Matrix; |
| 241 |
|
| 242 |
function "*" |
| 243 |
(Left : Real'Base; |
| 244 |
Right : Complex_Matrix) return Complex_Matrix; |
| 245 |
|
| 246 |
function "*" |
| 247 |
(Left : Complex_Matrix; |
| 248 |
Right : Real'Base) return Complex_Matrix; |
| 249 |
|
| 250 |
function "/" |
| 251 |
(Left : Complex_Matrix; |
| 252 |
Right : Real'Base) return Complex_Matrix; |
| 253 |
|
| 254 |
-- Complex_Matrix inversion and related operations |
| 255 |
|
| 256 |
function Solve |
| 257 |
(A : Complex_Matrix; |
| 258 |
X : Complex_Vector) return Complex_Vector; |
| 259 |
|
| 260 |
function Solve (A, X : Complex_Matrix) return Complex_Matrix; |
| 261 |
|
| 262 |
function Inverse (A : Complex_Matrix) return Complex_Matrix; |
| 263 |
|
| 264 |
function Determinant (A : Complex_Matrix) return Complex; |
| 265 |
|
| 266 |
-- Eigenvalues and vectors of a Hermitian matrix |
| 267 |
|
| 268 |
function Eigenvalues (A : Complex_Matrix) return Real_Vector; |
| 269 |
|
| 270 |
procedure Eigensystem |
| 271 |
(A : Complex_Matrix; |
| 272 |
Values : out Real_Vector; |
| 273 |
Vectors : out Complex_Matrix); |
| 274 |
|
| 275 |
-- Other Complex_Matrix operations |
| 276 |
|
| 277 |
function Unit_Matrix |
| 278 |
(Order : Positive; |
| 279 |
First_1, First_2 : Integer := 1) return Complex_Matrix; |
| 280 |
|
| 281 |
end Ada.Numerics.Generic_Complex_Arrays; |