Version 1.4 of ais/ai-00418.txt
!standard G.3.1(1) 05-05-05 AI95-00418-01/03
!standard G.3.2(1)
!class amendment 05-03-09
!status Amendment 200Y 05-05-05
!status ARG Approved 10-0-1 05-04-16
!status work item 05-03-09
!status received 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
Add after G.3.1(9):
function "abs" (Right : Real_Vector) return Real'Base;
Add after G.3.1(39):
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.
AARM Implementation Note: While the definition is given in terms of
an inner product, the norm doesn't "involve an inner product" in the
technical sense. The reason is that it has accuracy requirements
substantially different from those applicable to inner products; and that
cancellations cannot occur, because all the terms are positive, so there
is no possibility of intermediate overflow.
Add after G.3.1(81):
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 is defined as above.
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.
Add after G.3.2(15):
function "abs" (Right : Complex_Vector) return Real'Base;
Add after G.3.2(73):
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).
AARM Implementation Note: While the definition is given in terms of
an inner product, the norm doesn't "involve an inner product" in the
technical sense. The reason is that it has accuracy requirements
substantially different from those applicable to inner products; and that
cancellations cannot occur, because all the terms are positive, so there
is no possibility of intermediate overflow.
Add after G.3.2(150):
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 G.3.1(01)
!comment A phony force a conflict item.
@dinsc
@i<@s8<Static Semantics>>
Nothing is really here.
!corrigendum G.3.2(01)
!comment A phony force a conflict item.
@dinsc
@i<@s8<Static Semantics>>
Nothing is really here, either.
!ACATS test
Test cases should be added to the ACATS tests created for AI-296.
!appendix
****************************************************************
Questions? Ask the ACAA Technical Agent