comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Question on procedure parameter style
Date: Thu, 23 Dec 2010 20:38:44 +0000
Date: 2010-12-23T20:38:44+00:00	[thread overview]
Message-ID: <m2hbe49qcr.fsf@pushface.org> (raw)
In-Reply-To: m2lj3g9xqt.fsf@pushface.org

Simon Wright <simon@pushface.org> writes:

> 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;

I've now read up on this at
http://en.wikipedia.org/wiki/Generalized_eigenvalue_problem#Generalized_eigenvalue_problem,
and there's a hint there that lambda is in fact complex.

So I think I'll go with

   type General_Eigenvalue is record
      Alpha : General;
      Beta  : General;
   end record;
   type General_Eigenvalue_Vector
   is array (Integer range <>) of General_Eigenvalue;

for both the Real and the Complex problem.

Also, instead of Generalized_Eigensystem, the procedure will be called
just Eigensystem (another overloading).



  parent reply	other threads:[~2010-12-23 20:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23 17:59 Question on procedure parameter style Simon Wright
2010-12-23 18:51 ` Ada novice
2010-12-23 20:38 ` Simon Wright [this message]
2010-12-23 21:21   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox