From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,46f8241fa721a139,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Question on procedure parameter style Date: Thu, 23 Dec 2010 17:59:06 +0000 Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="4118"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nQEvzxBPLACHE4sDMg3m0jWS/6KHYJEY=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:QCwwVRlIpQEu1gU3wwJ/5GGBlo0= sha1:xCUDXZdheL+DzJ2azbbEso5WwN8= Xref: g2news2.google.com comp.lang.ada:17085 Date: 2010-12-23T17:59:06+00:00 List-Id: Hi all, Working on adding generalized eigenvalues to https://sourceforge.net/projects/gnat-math-extn/, I've started with -- Obtain the generalized eigenvalues and the right generalized -- eigenvectors of a pair of non-symmetric real matrices. -- -- A generalized eigenvalue for a pair of matrices (A,B) is a -- scalar lambda or a ratio alpha/beta = lambda, such that A - -- lambda*B is singular (or, equivalently, beta*A - alpha*B is -- singular). -- -- It is usually represented as the pair (alpha,beta), as there -- is a reasonable interpretation for beta = 0, and even for both -- being zero. -- -- The right eigenvector v(j) corresponding to the eigenvalue -- lambda(j) of (A,B) satisfies -- A * v(j) = lambda(j) * B * v(j). -- -- Alphas'Range and Betas'Range must be the same as A'Range (1). -- The ranges of A, B and Vectors must be the same. procedure Generalized_Eigensystem (A : Real_Arrays.Real_Matrix; B : Real_Arrays.Real_Matrix; Alphas : out Complex_Arrays.Complex_Vector; Betas : out Real_Arrays.Real_Vector; Vectors : out Real_Arrays.Real_Matrix); The comment is adapted from the man page for LAPACK's SGGEV. (BTW, clearly lambda is complex; is it OK to refer to lambda as a _scalar_?) My question is, what do people think about this way of returning the eigenvalues (in Alphas & Betas)? An alternative would be to declare types type Real_Eigenvalue is record Alpha : Complex; Beta : Real; end record; type Real_Eigenvalue_Vector is array (Integer range <>) of Real_Eigenvalue; and replace the Alphas and Betas 'out' parameters by Values : out Real_Eigenvalue_Vector; but then I have the problem that for the complex generalized eigenvalue problem I'd have to write type Complex_Eigenvalue is record Alpha : Complex; Beta : Complex; end record; type Complex_Eigenvalue_Vector is array (Integer range <>) of Complex_Eigenvalue; which is all geting a bit confusing (I was going to say "complex"...). Thanks in advance for any comments.