summaryrefslogtreecommitdiff
path: root/gcc/ada/s-gearop.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 14:53:39 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-07 14:53:39 +0000
commit736925387f41359c260af6de601b6bfd5118c083 (patch)
tree800812e8ad55fa893c772c327112a7dd5d669ba7 /gcc/ada/s-gearop.adb
parent3ae6bcd54d8f650874b3309d0f04dcf20632b612 (diff)
downloadgcc-736925387f41359c260af6de601b6bfd5118c083.tar.gz
2012-03-07 Robert Dewar <dewar@adacore.com>
* sem_ch5.adb, s-vaflop.adb, s-taprop-vms.adb, exp_ch6.adb, s-gearop.adb, sem_ch6.adb, s-bbthre.adb, g-trasym.adb: Minor reformatting. 2012-03-07 Javier Miranda <miranda@adacore.com> * a-ngrear.ads: Add documentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185053 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-gearop.adb')
-rw-r--r--gcc/ada/s-gearop.adb40
1 files changed, 24 insertions, 16 deletions
diff --git a/gcc/ada/s-gearop.adb b/gcc/ada/s-gearop.adb
index 3d9e4bffdd4..e1ce7e5d517 100644
--- a/gcc/ada/s-gearop.adb
+++ b/gcc/ada/s-gearop.adb
@@ -33,17 +33,15 @@ with Ada.Numerics; use Ada.Numerics;
package body System.Generic_Array_Operations is
- -- The local function Check_Unit_Last computes the index of the last
- -- element returned by Unit_Vector or Unit_Matrix. A separate function is
- -- needed to allow raising Constraint_Error before declaring the function
- -- result variable. The result variable needs to be declared first, to
- -- allow front-end inlining.
-
function Check_Unit_Last
(Index : Integer;
Order : Positive;
First : Integer) return Integer;
pragma Inline_Always (Check_Unit_Last);
+ -- Compute index of last element returned by Unit_Vector or Unit_Matrix.
+ -- A separate function is needed to allow raising Constraint_Error before
+ -- declaring the function result variable. The result variable needs to be
+ -- declared first, to allow front-end inlining.
--------------
-- Diagonal --
@@ -67,9 +65,9 @@ package body System.Generic_Array_Operations is
begin
if A'Length (1) /= A'Length (2) then
raise Constraint_Error with "matrix is not square";
+ else
+ return A'Length (1);
end if;
-
- return A'Length (1);
end Square_Matrix_Length;
---------------------
@@ -111,6 +109,10 @@ package body System.Generic_Array_Operations is
-- Elementary row operation that subtracts Factor * M (Source, <>) from
-- M (Target, <>)
+ -------------
+ -- Sub_Row --
+ -------------
+
procedure Sub_Row
(M : in out Matrix;
Target : Integer;
@@ -255,6 +257,10 @@ package body System.Generic_Array_Operations is
procedure Swap (X, Y : in out Scalar);
-- Exchange the values of X and Y
+ ----------
+ -- Swap --
+ ----------
+
procedure Swap (X, Y : in out Scalar) is
T : constant Scalar := X;
begin
@@ -418,8 +424,8 @@ package body System.Generic_Array_Operations is
begin
return R : Result_Matrix (Left'Range (1), Left'Range (2)) do
if Left'Length (1) /= Right'Length (1)
- or else
- Left'Length (2) /= Right'Length (2)
+ or else
+ Left'Length (2) /= Right'Length (2)
then
raise Constraint_Error with
"matrices are of different dimension in elementwise operation";
@@ -443,14 +449,15 @@ package body System.Generic_Array_Operations is
------------------------------------------------
function Matrix_Matrix_Scalar_Elementwise_Operation
- (X : X_Matrix;
- Y : Y_Matrix;
- Z : Z_Scalar) return Result_Matrix is
+ (X : X_Matrix;
+ Y : Y_Matrix;
+ Z : Z_Scalar) return Result_Matrix
+ is
begin
return R : Result_Matrix (X'Range (1), X'Range (2)) do
if X'Length (1) /= Y'Length (1)
- or else
- X'Length (2) /= Y'Length (2)
+ or else
+ X'Length (2) /= Y'Length (2)
then
raise Constraint_Error with
"matrices are of different dimension in elementwise operation";
@@ -817,7 +824,8 @@ package body System.Generic_Array_Operations is
procedure Update_Matrix_With_Matrix (X : in out X_Matrix; Y : Y_Matrix) is
begin
if X'Length (1) /= Y'Length (1)
- or else X'Length (2) /= Y'Length (2)
+ or else
+ X'Length (2) /= Y'Length (2)
then
raise Constraint_Error with
"matrices are of different dimension in update operation";