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: a07f3367d7,a83584e000bc28fa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.205.139.2 with SMTP id iu2mr921239bkc.7.1345343052050; Sat, 18 Aug 2012 19:24:12 -0700 (PDT) Path: m12ni115437bkm.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Leo Brewin Newsgroups: comp.lang.ada Subject: Re: ada lapack Date: Sat, 18 Aug 2012 19:24:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <698e8722-4e47-4aff-836a-9ca36e6207bf@googlegroups.com> References: <12f929e9-eea3-4dc9-b10d-71e4f5732e0d@googlegroups.com> <615dd222-9c8b-4878-94f7-b1cd4792bd3e@googlegroups.com> <36bc4009-6240-4797-991c-b72ec290cedc@googlegroups.com> <12606f3f-aec1-489c-8325-18e13007b6a6@googlegroups.com> <11959826-e12e-4455-b9d9-1ac4dcaf2952@googlegroups.com> <3bdbf14a-52ff-4b72-9e7b-42b543538959@googlegroups.com> <5865849c-3897-4be5-8d54-1de2e1acc3a7@googlegroups.com> <781001a0-3a99-40ac-bc5b-c8337124b29b@googlegroups.com> NNTP-Posting-Host: 118.209.200.189 Mime-Version: 1.0 X-Trace: posting.google.com 1345343051 17943 127.0.0.1 (19 Aug 2012 02:24:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 19 Aug 2012 02:24:11 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=118.209.200.189; posting-account=l8GBMwoAAADCbqdOJSbg4dBRqkD14dJd User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-18T19:24:11-07:00 List-Id: Looking through the Fortran sources for Lapack reveals lines like CALL DSCAL( N, S, V( K, 1 ), LDV ) and CALL DSCAL( N, S, V( 1, K ), 1 ) In the first case the intention is to scale row K of the matrix V by S, in the second case column K of V is rescaled. This is implemented in DSCAL by recasting V as a long vector DX. Stepping over columns of V is then equivalent to stepping through (a subset of) DX using a constant stride (LDV for the first case, 1 for the second). This is one example where Lapack makes explicit use of Fortran column major convention. There may be other examples (not just with DSCAL, I haven't checked). So, taking the approach of minimalist intervention, I opted to declare the Ada array types with the Fortran convention. Is there a penalty with this? I doubt it. At worst it's the cost of taking a transpose, which need only be done outside the Lapack code and should not add significantly to the overall execution time (which will be dominated by the Lapack code). In other places you will see code like CALL DSCAL( N, S, X, INCX ) where X is a vector. Converting each of these examples into Ada poses a problem. If we declare DSCAL as procedure DSCAL (N : Integer; S : Real; DX : in out Real_Vector; INCX : Integer); then the calls DSCAL (N,S,V(K,1),LDV); DSCAL (N,S,V(1,K),1); will give a compile time error, while DSCAL (N,S,X,INCX); can succeed (assuming X is of type Real_Vector). Changing the specification for DSCAL could solve the problem for the first two cases but will cause the third case to fail. The only solution that I could come up with (there may be others) was to pass the third argument by Address. Unless someone (not me) is prepared to re-write the Lapack code in Ada, from scratch, we are stuck with these kludges. I don't really care what the Ada version of the Lapack code looks like, I never plan to rewrite any of the Lapack side of the Ada_Lapack code and I never intend to call any of the Lapack codes directly (I use the interface routines like MatrixInverse). So it's not an issue for me if the code contains some of these oddities. The bottom line is -- it works, and that is all I need. Leo