--- ai05s/ai05-0047-1.txt 2007/04/05 01:49:15 1.1 +++ ai05s/ai05-0047-1.txt 2007/07/26 02:58:06 1.2 @@ -1,11 +1,12 @@ -!standard G.3.1 07-04-04 AI05-0047-1/01 +!standard G.3.1 07-06-21 AI05-0047-1/02 +!standard G.3.2 !class binding interpretation 07-04-04 !status work item 07-04-04 !status received 07-04-04 !priority Medium !difficulty Easy !qualifier Clarification -!subject Annoyances in the Generic_Real_Arrays package +!subject Annoyances in the array packages !summary @@ -14,7 +15,7 @@ !question I am using this AI to record a number of annoyances or bugs that I encountered during -the implementation of the Generic_Real_Arrays package. +the implementation of the array packages. 1 - The multiplication of matrices is defined to "involve inner products" (G.3.1(56/2)). In strict mode, this requires that each component of the result comply with the @@ -27,27 +28,21 @@ multiplication algorithms, so the accuracy requirements makes it impossible to implement Generic_Real_Arrays by interfacing to these libraries. -2 - Generic_Real_Arrays doesn't provide an operation to transpose a matrix. Transposition - is an operation that shows up very often, particularly in conjunction with orthogonal - matrices (and therefore with eigensystems). True, implementing your own transposition - is not too hard, but the same could be said of many of the operations provided by this - package. - -3 - The definition of Eigensystem does not impose any constraint on the length of the +2 - The definition of Eigensystem does not impose any constraint on the length of the out parameters Values and Vectors. Instead it has the mysterious sentence "The index ranges of the parameter Vectors are those of A". It is written as if Eigensystem had a way to change the constraints of Vectors, which is evidently false. It would seem that it should require that Values'Length, Vectors'Length(1) and Vectors'Length(2) be all equal and equal to A'Length(1). -4 - For some matrices, the QR iteration used to compute the eigenvalues will just not +3 - For some matrices, the QR iteration used to compute the eigenvalues will just not converge (no deflation will happen). While it is always possible to let it run forever, it is typical in this case to give up after some number of iterations. The RM makes - no provision for raising an exception in this case. The values computed for (some of) - the eigenvalues may be really bogus, so it would be better to raise an exception than - to return garbage to the user. + no provision for raising an exception. The values computed for (some of) the eigenvalues + may be really bogus, so it would be better to raise an exception than to return garbage + to the user. -5 - The index subtype for types Real_Vector and Real_Matrix is Integer. Presumably this was +4 - The index subtype for types Real_Vector and Real_Matrix is Integer. Presumably this was intended to provide maximum flexibility in selecting the index range. It has however unpleasant consequences. Consider: @@ -57,6 +52,26 @@ do that? Maybe to initialize a variable that will be used to iterate through the rows or column of the matrix. This is sure to bite many users, and using a slightly narrower index subtype would have been much wiser. + +5 - G.3.2(75/2, 76/2) defines a function "abs" that returns the Hermitian L2-norm of a + vector. However, the specification of this function is given as: + + function "abs" (Right : Complex_Vector) return Complex; + + The norm of a vector is always a (nonnegative) real number, so it doesn't make much sense + to return a complex number here. This function should return a Real'Base. As a matter + of fact it did in AI95-00418, but this AI was apparently incorrectly merged into the + RM and Amendment. + +6 - Section G.3.2 keeps talking about inner product, but never defines exactly what is meant + by this term. This is significant because in a complex vector space the natural inner + product is the Hermitian one, where the elements of the second vector are conjugated. + It is unclear if the function "*" conjugates the elements of Right. ISO/IEC 13813 + explicitly specified that "no complex conjugation is performed". While the "* operator + defined by such a rule is not a true inner product, it is probably more appropriate in + practice as it makes the conjugations explicit in the source: the user has to write + X * Conjugate (Y) which mimics the mathematical notation where conjugation is always + made explicit. At any rate, a clarification would be useful. !recommendation

Questions? Ask the ACAA Technical Agent