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,c1bdceb867926fdb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: Interfacing Ada with C Date: Thu, 05 Aug 2010 09:23:51 -0400 Organization: The Wasteland Message-ID: References: <0ee9eec7-6024-4fb8-8df0-f65c146e4b84@i28g2000yqa.googlegroups.com> <143ef70b-7e74-426b-a621-a5fd157849be@x21g2000yqa.googlegroups.com> <06eb8f61-2a0c-4dda-93f3-8414d32b6e4f@f20g2000pro.googlegroups.com> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Xref: g2news1.google.com comp.lang.ada:12877 Date: 2010-08-05T09:23:51-04:00 List-Id: In article , Ada novice wrote: > 2. a real orthogonal matrix. Such a matrix gives all eigenvalues of > unit modulus. I tested the case from > http://en.wikipedia.org/wiki/Orthogonal_matrix. > In Matlab, > > eig([0, -0.8, -0.6; 0.8, -0.36, 0.48; 0.6, 0.48, -0.64]) > > gives the eigenvalues as 0 + 1i, 0 - 1i and -1. > > Using your Ada code gives: > > -1.78814E-08 1.00000E+00 > -8.72890E-09 -1.00000E+00 > -1.00000E+00 0.00000E+00 > > > Does the Blas code work with Fortran double-precision? In the above, > Matlab with double (15 digits precision). I don't see you using the > type Long_Float in the Ada code. I don't know how many digits are > being passed from the Fortran result to Ada. Maybe this is causing the > discrepancy between the expected results (all eigenvalues of modulus > one) and the output in Ada. Using these declarations in test_extensions.adb: subtype My_Float is Long_Float; Input : constant Complex_Matrix := (((0.0, 0.0), (-0.8, 0.0), -0.6, 0.0)), ((0.8, 0.0), (-0.36, 0.0), (0.48, 0.0)), ((0.6, 0.0), (0.48, 0.0), (-0.64, 0.0))); I get this result: ./test_extensions 0.00000000000000E+00 1.00000000000000E+00 -2.77555756156289E-17 -1.00000000000000E+00 -1.00000000000000E+00 0.00000000000000E+00 [...] -- John B. Matthews trashgod at gmail dot com