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,FREEMAIL_FROM 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!postnews.google.com!x25g2000yqj.googlegroups.com!not-for-mail From: Ada novice Newsgroups: comp.lang.ada Subject: Re: Interfacing Ada with C Date: Thu, 5 Aug 2010 02:14:52 -0700 (PDT) Organization: http://groups.google.com 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: 193.11.22.91 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1280999692 20446 127.0.0.1 (5 Aug 2010 09:14:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 5 Aug 2010 09:14:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x25g2000yqj.googlegroups.com; posting-host=193.11.22.91; posting-account=Rr9I-QoAAACS-nOzpA-mGxtAlZ46Nb6I User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12873 Date: 2010-08-05T02:14:52-07:00 List-Id: I have made some simple tests on some special matrices which can pose some problems. I limited myself to matrices with real values. I have tested: 1. non-symmetric real matrices with repeated values. No problem here 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. 3. a real skew-symmetric matrix. This is also interesting as all eigenvalues are imaginary. I tested the case from http://en.wikipedia.org/wiki/Skew-symmetric_matrix. In Matlab, eig([0, 2, -1; -2, 0, -4; 1, 4, 0]) gives the eigenvalues as 0 ; 0 + 4.582575694955841i and 0 - 4.582575694955841i Using the Ada code gives: 9.12635E-08 4.58258E+00 -5.31220E-08 1.92730E-07 3.95880E-08 -4.58258E+00 Here also exist some slight discrepancies. I believe as mentioned above that if we change use more precision digits, then we'll get "better" answers. Thanks. YC