# Version 1.2 of ais/ai-00418.txt

Unformatted version of ais/ai-00418.txt version 1.2
Other versions for file ais/ai-00418.txt

!standard G.3.1(1)          05-03-11 AI95-00418-01/02
!standard G.3.2(1)
!class amendment 05-03-09
!status work item 05-03-09
!priority High
!difficulty Easy
!subject Vector norm
!summary
(See proposal.)
!problem
While the packages Generic_Real_Arrays and Generic_Complex_Arrays provide inner product, they do not provide a related operation that is often used in practice, the norm. Normalizing a vector is common and it seems unfriendly to require the user to implement the norm based on the inner product (and conjugation), especially as intermediate overflows/underflows could occur.
!proposal
Add "abs" operators implementing the L2-norm. Specify their accuracy.
!wording
function "abs" (Right : Real_Vector) return Real'Base;
function "abs" (Right : Real_Vector) return Real'Base;
This operation returns the L2-norm of Right (the square root of the inner product of the vector with itself).
AARM Note: Normalization of vectors is a frequent enough operation that it is useful to provide the norm as a basic operation. Furthermore, implementing the norm is not entirely straightforward, because the inner product might overflow while the final norm does not. An implementation cannot merely return Sqrt (X * X), it has to cope with a possible overflow of the inner product.
For the L2-norm, no accuracy requirements are specified in the relaxed mode. In the strict mode the relative error on the norm shall not exceed:
g / 2.0 + 3.0 * Real'Model_Epsilon
AARM Note: This is simply the combination of the error on the inner product with the error on Sqrt. A first order computation would lead to 2.0 * Real'Model_Epsilon above, but we are adding an extra Real'Model_Epsilon to account for higher order effects.
function "abs" (Right : Complex_Vector) return Real'Base;
function "abs" (Right : Complex_Vector) return Real'Base;
This operation returns the Hermitian L2-norm of Right (the square root of the inner product of the vector with its conjugate).
For the L2-norm, no accuracy requirements are specified in the relaxed mode. In the strict mode the relative error on the norm shall not exceed:
g / 2.0 + 3.0 * Real'Model_Epsilon
Where g has the definition appropriate for two complex operands.
!discussion
(See proposal.)
!example
--!corrigendum
!ACATS test
Test cases should be added to the ACATS tests created for AI-296.
!appendix
```
****************************************************************
```

Questions? Ask the ACAA Technical Agent